From code-quality-toolkit
Generates refactoring plans for code smells like long methods, god classes, duplicated code. Assesses risks, provides templates, and guides incremental execution with tests.
How this skill is triggered — by the user, by Claude, or both
Slash command
/code-quality-toolkit:refactoring-advisorThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Plan refactoring based on identified issues:
Plan refactoring based on identified issues:
Analyze the code:
| Problem | Strategy | Risk |
|---|---|---|
| Long Method | Extract Method | Low |
| God Class | Extract Class | Medium |
| Duplicated Code | Extract Method | Low |
| Switch Statement | Replace with Polymorphism | High |
| Long Parameter List | Introduce Parameter Object | Medium |
Template:
## Refactoring: [Name]
**Problem:** [Description]
**Goal:** [Desired outcome]
**Risk Level:** [Low/Medium/High]
### Prerequisites
- [ ] Tests exist and pass
- [ ] Code is committed
- [ ] Dependencies identified
### Steps
1. [First small change]
2. [Run tests]
3. [Next small change]
4. [Run tests]
...
### Validation
- [ ] All tests pass
- [ ] No functionality changed
- [ ] Code is cleaner
Golden Rule: Make the change easy, then make the easy change
Before:
function printOwing(invoice) {
let outstanding = 0;
console.log("***********************");
console.log("**** Customer Owes ****");
console.log("***********************");
for (const o of invoice.orders) {
outstanding += o.amount;
}
console.log(`name: ${invoice.customer}`);
console.log(`amount: ${outstanding}`);
}
Plan:
After:
function printOwing(invoice) {
printBanner();
const outstanding = calculateOutstanding(invoice);
printDetails(invoice, outstanding);
}
function printBanner() {
console.log("***********************");
console.log("**** Customer Owes ****");
console.log("***********************");
}
function calculateOutstanding(invoice) {
return invoice.orders.reduce((sum, o) => sum + o.amount, 0);
}
function printDetails(invoice, outstanding) {
console.log(`name: ${invoice.customer}`);
console.log(`amount: ${outstanding}`);
}
Before:
class Person {
name;
officeAreaCode;
officeNumber;
getTelephoneNumber() {
return `(${this.officeAreaCode}) ${this.officeNumber}`;
}
}
Plan:
After:
class TelephoneNumber {
areaCode;
number;
toString() {
return `(${this.areaCode}) ${this.number}`;
}
}
class Person {
name;
telephoneNumber;
getTelephoneNumber() {
return this.telephoneNumber.toString();
}
}
Before refactoring:
During refactoring:
After refactoring:
npx claudepluginhub p/armanzeroeight-code-quality-toolkit-plugins-code-quality-toolkitGuides safe, incremental refactoring to improve code quality without changing behavior. Generates analysis/plans via refactor:analyze/plan commands, covers smells and patterns like Extract Method.
Applies disciplined refactoring in small, verifiable steps to improve code structure without changing behavior: extract functions, rename, move code.
Identifies code smells, assesses refactoring risk, and builds incremental execution plans with rollback strategies. Activates on refactoring, code cleanup, tech debt, or duplication reduction requests.