Keeping Routines Focused

Extract multi-responsibility routines into single-responsibility units during code reviews.

Updated Nov 27, 2025
One-click install
npx skills add https://github.com/barrydobson/dotfiles_extra --skill keeping-routines-focused
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Keeping Routines Focused
Source: https://github.com/barrydobson/dotfiles_extra/tree/main/packages/claude/dot-claude/skills/coding/keeping-routines-focused
Command: npx skills add https://github.com/barrydobson/dotfiles_extra --skill keeping-routines-focused

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses code complexity, hard-to-understand routines, and maintenance nightmares caused by functions doing too many things. It helps developers write cleaner, more manageable, and less error-prone code by ensuring each routine has a single, clear purpose.

Core Features & Use Cases

  • Single Responsibility Principle: Guides you to ensure each routine performs one task exceptionally well, improving functional cohesion.
  • Complexity Reduction: Provides techniques to break down "god functions" into smaller, focused units, such as extracting responsibilities or levels of abstraction.
  • Improved Testability & Maintainability: Makes code easier to test, modify, and reuse by clearly defining routine boundaries and purposes.
  • Use Case: When refactoring a 300-line processOrder function that validates, calculates, and saves, this skill helps you extract validateOrder, calculatePricing, and saveOrder into separate, focused routines.

Quick Start

Analyze the attached Python function handle_user_request. Identify if it has multiple responsibilities and suggest how to refactor it into more focused routines, applying the "and" test.

Frequently Asked Questions about Keeping Routines Focused

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

FAQPage Schema
How do I identify if my functions have too many responsibilities?

Functions doing too many things often contain 'and' in their description, exceed 200 lines, or have more than seven parameters. Apply the 'and' test: if you describe your function using 'and', it likely violates single responsibility. Break it into focused units, each handling one task.

What's the best way to refactor complex functions into simpler ones?

Extract multi-responsibility routines into single-responsibility units by identifying distinct tasks within the function. For example, split a 300-line `processOrder` function into `validateOrder`, `calculatePricing`, and `saveOrder`. Maintain consistent abstraction level across extracted functions.

Why does breaking functions into smaller units improve code quality?

Single-responsibility functions enforce functional cohesion, making code easier to test, modify, and reuse. Smaller, focused routines are simpler to understand, less error-prone, and reduce maintenance burden by clearly defining what each function does.

Can I apply single responsibility during code reviews?

Yes. Single responsibility applies during designing new functions, refactoring existing code, and code reviews. Check if routine descriptions contain 'and', exceed length thresholds, or have excessive parameters—these are signals to extract responsibilities into separate functions.

How does functional cohesion relate to writing cleaner code?

Functional cohesion means each routine performs one task exceptionally well. Enforcing cohesion with clear naming, consistent abstraction, and single responsibility reduces code complexity, improves testability, and makes codebases easier to navigate and maintain.

What naming practices help clarify single-responsibility functions?

Use clear, descriptive names that reflect the single purpose of each function. Avoid generic names; instead use action-verb patterns like `validateOrder`, `calculatePricing`, or `saveOrder`. Clear naming supports functional cohesion and makes responsibilities immediately obvious.