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.