Keeping Routines Focused

Refactor multi-responsibility routines into single-purpose functions with functional cohesion.

Updated Dec 4, 2025
One-click install
npx skills add https://github.com/dallascrilley/dowser --skill keeping-routines-focused-dallascrilley
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: Keeping Routines Focused
Source: https://github.com/dallascrilley/dowser/tree/main/skills/keeping-routines-focused
Command: npx skills add https://github.com/dallascrilley/dowser --skill keeping-routines-focused-dallascrilley

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Routines that do many things at once are hard to name, test, understand, and modify. This Skill provides diagnostic signals and extraction techniques to split unfocused routines into single-responsibility functions. ## Core Features & Use Cases - Diagnostic Signals: Detect unfocused routines using the "and" test, parameter counts over 7, lengths over 200 lines, vague names, and mixed abstraction levels. - Extraction Techniques: Extract by responsibility, by abstraction level, and by complex conditional logic into well-named boolean functions. - Cohesion Framework: Classify routines across seven cohesion levels from coincidental to functional, targeting functional cohesion. - Use Case: When reviewing a 300-line order handler that validates, prices, checks inventory, persists, and emails, split it into a thin orchestrator calling focused routines like validate_order_request and calculate_pricing. ## Quick Start Review this function and extract each responsibility into its own focused routine with a clear single-purpose name.

Frequently Asked Questions about Keeping Routines Focused

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor a function that does too many things?▼

Identify each responsibility by checking if the description contains "and", then extract each one into its own named routine. Leave the original function as a thin orchestrator that calls the focused routines in sequence.

What is functional cohesion in software design?▼

Functional cohesion means a routine does exactly one thing completely, and it is the strongest cohesion type. Weaker types include coincidental, logical, temporal, procedural, communicational, and sequential cohesion.

How long should a function be before splitting it?▼

Most routines should stay under 50 lines, warrant review past 100 lines, and strongly signal extraction past 200 lines. Length alone is not decisive; extract only when natural boundaries improve clarity.

When should I not extract code into a separate function?▼

Skip extraction when the inline version is simpler, the logic is used only once with no duplication, or no natural boundary exists. Arbitrary splits can make code harder to understand than the original.

Does this refactoring guidance apply to all programming languages?▼

Yes, the skill declares language-agnostic applicability. The cohesion principles, extraction patterns, and diagnostic signals like parameter counts and abstraction levels apply to functions and methods in any language.