Agent skill
refactor-dedupe-and-cleanup
[Code Quality] Removes code duplication and cleans up dead code. Use to eliminate copy-paste code, consolidate similar logic, and remove unused code paths.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/refactor-dedupe-and-cleanup
SKILL.md
Refactor: Dedupe and Cleanup
Eliminate redundancy and remove dead code.
Deduplication Patterns
1. Extract Common Method
Move duplicated logic to shared function.
2. Template Method Pattern
Abstract common structure, vary details.
3. Consolidate Conditional Expression
Combine conditions with same result.
Dead Code Removal
Types to Remove
- Unreachable code - after return/throw
- Unused variables - declared but never read
- Unused functions - never called
- Commented code - use git history instead
- Unused imports - clutters namespace
Safe Removal Process
- Search for all references
- Check for reflection/dynamic usage
- Remove in small commits
- Run full test suite
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?