From claudekit
Refactors code structure for better readability and maintainability without changing behavior. Applies patterns like extract/inline/rename functions, eliminates duplication, addresses code smells like long functions and deep nesting.
npx claudepluginhub duthaho/claudekit --plugin claudekitThis skill uses the workspace's default tool permissions.
- Improving code structure without changing behavior
Refactors code to improve structure, readability, and maintainability while preserving behavior. Guides test-driven cycle, checklists, and patterns like extract function.
Refactors code surgically to improve maintainability without changing behavior: extracts functions, renames variables, breaks god functions, eliminates smells, boosts type safety, applies patterns. For gradual improvements on hard-to-maintain code.
Surgical refactoring improves code maintainability without behavior changes: extracts functions, renames variables, breaks god functions, boosts type safety, removes smells.
Share bugs, ideas, or general feedback.
feature-workflowsystematic-debugging (behavior change, not refactoring)performance-optimization| Topic | Reference | Key content |
|---|---|---|
| Refactoring patterns | references/patterns.md | Extract, inline, rename, move, decompose, introduce parameter object |
| Code smells | references/code-smells.md | Detection signals and recommended refactorings |
| Pattern | When | Example |
|---|---|---|
| Extract function | Long function, repeated logic | Pull 10-line block into named function |
| Inline function | Trivial wrapper adding no clarity | Remove getAge() that just returns this.age |
| Rename symbol | Name doesn't reveal intent | x → userCount |
| Introduce parameter object | 4+ related parameters | (name, email, age) → UserInput |
| Replace conditional with polymorphism | Long if/else or switch chains | Strategy pattern or subclass dispatch |
| Decompose conditional | Complex boolean expression | isEligible() instead of age > 18 && !banned && verified |
| Extract variable | Complex expression | const isOverBudget = total > limit * 1.1 |
dict bags to dataclasses or TypedDict@property instead of get/set methodsEnum instead of string constantsany with generics or unknown + narrowingas const objects for tree-shakingPick, Omit, Partial)testing — Ensure test coverage before refactoringwriting-concisely — Refactoring responses can be terse (show before/after)