code-refactoring-dry
Remove code duplication by extracting shared logic into reusable components. Use when the same logic appears in multiple places.
Packaged view
This page reorganizes the original catalog entry around fit, installability, and workflow context first. The original raw source lives below.
Install command
npx @skill-hub/cli install aspiers-ai-config-code-refactoring-dry
Repository
Skill path: .agents/skills/code-refactoring-dry
Remove code duplication by extracting shared logic into reusable components. Use when the same logic appears in multiple places.
Open repositoryBest for
Primary workflow: Ship Full Stack.
Technical facets: Full Stack.
Target audience: everyone.
License: Unknown.
Original source
Catalog source: SkillHub Club.
Repository owner: aspiers.
This is still a mirrored public skill entry. Review the repository before installing into production workflows.
What it helps with
- Install code-refactoring-dry into Claude Code, Codex CLI, Gemini CLI, or OpenCode workflows
- Review https://github.com/aspiers/ai-config before adding code-refactoring-dry to shared team environments
- Use code-refactoring-dry for development workflows
Works across
Favorites: 0.
Sub-skills: 0.
Aggregator: No.
Original source / Raw SKILL.md
--- name: code-refactoring-dry description: Remove code duplication by extracting shared logic into reusable components. Use when the same logic appears in multiple places. --- # Code Refactoring: Don't Repeat Yourself Remove code duplication you just introduced by refactoring duplicated code to follow the DRY principle. ## When to Use This Skill Use this skill when: - You notice the same logic appearing in multiple places - Code has been copied and pasted with minor variations - A change needs to be made in multiple locations - Following the "NO DUPLICATED CODE!" rule from code review ## Instructions ### Step 1: Identify the Duplication Review the files you have been working on in this session to find: - Duplicated code patterns - Duplicated logic or structures - Copied and pasted blocks with minor variations ### Step 2: Clarify Scope (If Needed) If the duplication is not obvious, ask the user to clarify which specific duplication they want addressed before proceeding. ### Step 3: Refactor Once the duplication is identified: - Extract shared logic into reusable functions, classes, or modules - Replace duplicated code with calls to the shared implementation - Ensure the refactoring maintains the same functionality - Update all call sites to use the new shared implementation ### Step 4: Verify After refactoring: - Run tests if available - Verify the code still works as expected - Check that the solution is cleaner and more maintainable ## Goal Eliminate unnecessary duplication while maintaining code clarity and functionality. The refactored code should be easier to maintain and modify in the future. ## Benefits of DRY - **Single source of truth**: Changes only need to be made in one place - **Easier maintenance**: Bug fixes propagate automatically - **Reduced risk**: Consistency is enforced - **Better testing**: Test shared logic once