code-refactoring-dry
Remove code duplication by extracting shared logic into reusable components. Use when the same logic appears in multiple places.
Best use case
code-refactoring-dry is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Remove code duplication by extracting shared logic into reusable components. Use when the same logic appears in multiple places.
Teams using code-refactoring-dry should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/code-refactoring-dry/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How code-refactoring-dry Compares
| Feature / Agent | code-refactoring-dry | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Remove code duplication by extracting shared logic into reusable components. Use when the same logic appears in multiple places.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
SKILL.md Source
# 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
Related Skills
code-refactoring-small
Refactor overly large code units into smaller, more focused components. Use when code has grown too large or complex.
xlsx-to-csv
Convert XLSX spreadsheets (single or multi-sheet) to CSV files you can read and grep. Use whenever you need to process an .xlsx report from Xero, Cryptio, bank exports, or any tool that delivers spreadsheet output.
xero-mcp
Use the Xero MCP server — obtain/refresh OAuth2 bearer tokens, troubleshoot authentication, and pick up other operational notes for working with Xero MCP tools. Use when Xero MCP tools fail with authentication errors, when the bearer token has expired (tokens last ~30 min), before starting any Xero workflow, or for general guidance on Xero MCP usage.
xero-browser
General Xero browser automation notes. Use when automating any Xero page with agent-browser — covers non-standard UI patterns, waiting, and dropdown menus.
test-running
Run tests according to repository guidelines. Use after linting passes, before staging changes.
task-orchestration
Orchestrate the complete development workflow for implementing sub-tasks from a task list. Use for end-to-end feature implementation with quality controls.
task-implementation
Implement a single sub-task from a task list. Use when working on feature development with existing task lists.
task-generation
Generate a detailed task list from a PRP. Use after a PRP is created and ready for implementation planning.
subagent-authoring
Create subagent definitions for Claude Code and OpenCode that delegate to skills. Use when creating new subagents or refactoring existing ones to follow the delegation pattern.
slow-command-running
Pipe long running commands through tee(1) to allow watching output and repeated analyses without rerunning
skill-authoring
Create and maintain Claude Code skills following Anthropic best practices. Use when building new skills, refactoring existing ones, or ensuring skills follow official guidelines for structure, naming, progressive disclosure, and testing.
safe-rm
Safely delete files / directories without asking for permission