Agent skill
refactor-extract-and-isolate
[Code Quality] Extracts methods, classes, or modules to reduce complexity and improve isolation. Use when functions are too long, classes have too many responsibilities, or concerns are mixed.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/refactor-extract-and-isolate
SKILL.md
Refactor: Extract and Isolate
Break down complex code into focused, reusable units.
Extract Method
When to Extract
- Function > 20 lines
- Code block has a distinct purpose
- Same logic repeated
- Deep nesting (> 3 levels)
Extract Class
When to Extract
- Class > 300 lines
- Multiple distinct responsibilities
- Group of related methods/properties
- Feature envy
Extract Protocol/Interface
When to Extract
- Multiple implementations possible
- Testing requires mocking
- Dependency inversion needed
Checklist
- Identify extraction boundary
- Choose good name for new unit
- Move code to new location
- Update references
- Add tests for new unit
- Verify original tests pass
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?