
Refactor Assistant
- 26 installs
- 84 repo stars
- Updated January 28, 2026
- aidotnet/moyucode
refactor-assistant is a Claude Code skill that refactors code with design-pattern recommendations, code smell detection, and behavior-preserving transformations.
About
refactor-assistant is a Claude Code skill that improves code quality through systematic refactoring while preserving behavior. A developer invokes it to detect code smells and apply design patterns such as Extract Method, Strategy, and Factory. The SKILL.md shows before/after TypeScript examples for each transformation.
- Refactors code with design-pattern recommendations while preserving behavior
- Demonstrates Extract Method, Strategy, and Factory patterns
- Focused on code smell detection and safe transformations
Refactor Assistant by the numbers
- 26 all-time installs (skills.sh)
- Ranked #695 of 1,352 Code Review & Quality skills by installs in the Skillselion catalog
- Data as of Jul 28, 2026 (Skillselion catalog sync)
refactor-assistant capabilities & compatibility
- Capabilities
- refactoring · design patterns · code smell detection · code review
- Use cases
- refactoring · code review
- Pricing
- Free
What refactor-assistant says it does
Improve code quality through systematic refactoring with design pattern recommendations.
You are a refactoring expert that improves code quality while preserving behavior.
npx skills add https://github.com/aidotnet/moyucode --skill refactor-assistantAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 26 |
|---|---|
| repo stars | ★ 84 |
| Last updated | January 28, 2026 |
| Repository | aidotnet/moyucode ↗ |
What it does
Refactor code with design patterns and safe, behavior-preserving transformations.
Who is it for?
Applying design patterns and cleaning up code smells safely
Skip if: Writing new features from scratch
When should I use this skill?
You want to refactor code or apply a design pattern without changing behavior
What you get
Refactored code using design patterns while preserving behavior
- Refactored code with applied design patterns
By the numbers
- Demonstrates 3 refactoring patterns: Extract Method, Strategy, and Factory
Files
Refactor Assistant Skill
Description
Improve code quality through systematic refactoring with design pattern recommendations.
Trigger
/refactorcommand- User requests code improvement
- User asks about design patterns
Prompt
You are a refactoring expert that improves code quality while preserving behavior.
Extract Method
// ❌ Before: Long method with multiple responsibilities
function processOrder(order: Order) {
// Validate order
if (!order.items.length) throw new Error('Empty order');
if (!order.customer) throw new Error('No customer');
// Calculate total
let total = 0;
for (const item of order.items) {
total += item.price * item.quantity;
if (item.discount) {
total -= item.discount;
}
}
// Apply tax
const tax = total * 0.1;
total += tax;
// Save and notify
db.save(order);
emailService.send(order.customer.email, `Order total: ${total}`);
}
// ✅ After: Small, focused methods
function processOrder(order: Order) {
validateOrder(order);
const total = calculateTotal(order);
saveAndNotify(order, total);
}
function validateOrder(order: Order): void {
if (!order.items.length) throw new Error('Empty order');
if (!order.customer) throw new Error('No customer');
}
function calculateTotal(order: Order): number {
const subtotal = order.items.reduce((sum, item) => {
const itemTotal = item.price * item.quantity - (item.discount ?? 0);
return sum + itemTotal;
}, 0);
return subtotal * 1.1; // Include 10% tax
}Strategy Pattern
// ❌ Before: Switch statement for different behaviors
function calculateShipping(order: Order): number {
switch (order.shippingMethod) {
case 'standard': return order.weight * 0.5;
case 'express': return order.weight * 1.5 + 10;
case 'overnight': return order.weight * 3 + 25;
default: throw new Error('Unknown method');
}
}
// ✅ After: Strategy pattern
interface ShippingStrategy {
calculate(order: Order): number;
}
class StandardShipping implements ShippingStrategy {
calculate(order: Order): number {
return order.weight * 0.5;
}
}
class ExpressShipping implements ShippingStrategy {
calculate(order: Order): number {
return order.weight * 1.5 + 10;
}
}
class ShippingCalculator {
constructor(private strategy: ShippingStrategy) {}
calculate(order: Order): number {
return this.strategy.calculate(order);
}
}Factory Pattern
// ✅ Factory for creating different notification types
interface Notification {
send(message: string): Promise<void>;
}
class NotificationFactory {
static create(type: 'email' | 'sms' | 'push'): Notification {
switch (type) {
case 'email': return new EmailNotification();
case 'sms': return new SmsNotification();
case 'push': return new PushNotification();
}
}
}
// Usage
const notification = NotificationFactory.create('email');
await notification.send('Hello!');Tags
refactoring, design-patterns, code-quality, clean-code, architecture
Compatibility
- Codex: ✅
- Claude Code: ✅
Related skills
FAQ
Which design patterns does it demonstrate?
Extract Method, Strategy, and Factory patterns with before/after examples.
Does refactoring change behavior?
No. The skill emphasizes transformations that preserve existing behavior.