Agent skill · software engineering · aiskillstore

code-refactoring

Simplify and refactor code while preserving behavior, improving clarity, and reducing complexity. Use when simplifying complex code, removing duplication, or applying design patterns. Handles Extract Method, DRY principle, SOLID principles, behavior validation, and refactoring patterns.

Why this skill is useful

Provides specific refactoring patterns and techniques that improve code clarity and maintainability, which the AI wouldn't reliably generate on its own.

What it needs

About 6k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.

What this skill does

Code Refactoring When to use this skill Code review: Discovering complex or duplicated code Before adding new features: Cleaning up existing code After bug fixes: Removing root causes Resolving technical debt: Regular refactoring Instructions Step 1: Extract Method Before (long function): After (method extraction): Step 2: Remove Duplication Before (duplication): After (extract common logic): Step 3: Replace Conditional with Polymorphism Before (long if-else): After (polymorphism): Step 4: Introduce Parameter Object Before (many parameters): After (grouped into object): Step 5: Apply SOLID Principles Single Responsibility: Output format Refactoring Checklist Constraints Mandatory Rules (MUST) 1. Test first: Write tests before refactoring 2. Small steps: Change one thing at a time 3. Behavior preservation: No functional changes Prohibited (MUST NOT) 1. Multiple tasks simultaneously: No refactoring + feature addition at the same time 2. Refactoring without tests: Risk of regression Best practices 1. Boy Scout Rule: Leave code cleaner than you found it 2. Refactoring timing: Red-Green-Refactor (TDD) 3. Incremental improvement: Consistency over perfection 4. Behavior preservation: Refactoring involves no functional changes 5. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills aiskillstore/code-refactoring

View the source on GitHub

Browse the @skills marketplace