Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when working with tdd workflows tdd refactor
.claude/skills/dokhacgiakhoa-tdd-workflows-tdd-refactor/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-07 | ✗→✓ | ▲ Improved | 89% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 59% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 44% | 0% |
| case-05 | ✓→✗ | ▼ Worse | 106% | 0% |
| case-06 | ✓→✗ | ▼ Worse | -40% | 0% |
resources/implementation-playbook.md.Refactor code with confidence using comprehensive test safety net:
Extended thinking: This tool uses the tdd-orchestrator agent (opus model) for sophisticated refactoring while maintaining all tests green. It applies design patterns, improves code quality, and optimizes performance with the safety of comprehensive test coverage.]
Use Task tool with subagent_type="tdd-orchestrator" to perform safe refactoring.
Prompt: "Refactor this code while keeping all tests green: $ARGUMENTS. Apply TDD refactor phase:
1. Pre-Assessment
2. Code Smell Detection
3. Design Patterns
4. SOLID Principles
5. Refactoring Techniques
6. Performance Optimization
7. Incremental Steps
8. Architecture Evolution
9. Safety Verification
10. Advanced Patterns
Before committing:
If tests fail:
Before:
typescriptclass OrderProcessor { processOrder(order: Order): ProcessResult { // Validation if (!order.customerId || order.items.length === 0) { return { success: false, error: "Invalid order" }; } // Calculate totals let subtotal = 0; for (const item of order.items) { subtotal += item.price * item.quantity; } let total = subtotal + (subtotal * 0.08) + (subtotal > 100 ? 0 : 15); // Process payment... // Update inventory... // Send confirmation... } }
After:
typescriptclass OrderProcessor { async processOrder(order: Order): Promise<ProcessResult> { const validation = this.validateOrder(order); if (!validation.isValid) return ProcessResult.failure(validation.error); const orderTotal = OrderTotal.calculate(order); const inventoryCheck = await this.inventoryService.checkAvailability(order.items); if (!inventoryCheck.available) return ProcessResult.failure(inventoryCheck.reason); await this.paymentService.processPayment(order.paymentMethod, orderTotal.total); await this.inventoryService.reserveItems(order.items); await this.notificationService.sendOrderConfirmation(order, orderTotal); return ProcessResult.success(order.id, orderTotal.total); } private validateOrder(order: Order): ValidationResult { if (!order.customerId) return ValidationResult.invalid("Customer ID required"); if (order.items.length === 0) return ValidationResult.invalid("Order must contain items"); return ValidationResult.valid(); } }
Applied: Extract Method, Value Objects, Dependency Injection, Async patterns
Code to refactor: $ARGUMENTS"
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 36,596 | 26,227 | -28% | 1 | 1 | 0% | 6,394 | 5,109 | -20% | 0 | 0 | — |
case-07 | fail→pass | 15,592 | 18,318 | +17% | 1 | 1 | 0% | 1,647 | 3,117 | +89% | 0 | 0 | — |
case-02 | fail→fail | 42,974 | 15,652 | -64% | 1 | 1 | 0% | 7,765 | 1,714 | -78% | 0 | 0 | — |
case-03 | fail→fail | 42,375 | 14,657 | -65% | 1 | 1 | 0% | 7,937 | 1,548 | -80% | 0 | 0 | — |
case-04 | pass→pass | 24,872 | 26,046 | +5% | 1 | 1 | 0% | 4,322 | 4,929 | +14% | 0 | 0 | — |
case-05 | pass→fail | 9,694 | 4,671 | -52% | 1 | 1 | 0% | 762 | 1,572 | +106% | 0 | 0 | — |
case-06 | pass→fail | 17,276 | 16,129 | -7% | 1 | 1 | 0% | 2,627 | 1,589 | -40% | 0 | 0 | — |
case-08 | fail→pass | 15,274 | 10,691 | -30% | 1 | 1 | 0% | 1,344 | 2,135 | +59% | 0 | 0 | — |
case-09 | pass→pass | 15,227 | 7,537 | -51% | 1 | 1 | 0% | 1,675 | 2,644 | +58% | 0 | 0 | — |
case-10 | fail→pass | 13,643 | 19,203 | +41% | 1 | 1 | 0% | 2,236 | 3,227 | +44% | 0 | 0 | — |
case-11 | fail→fail | 29,503 | 11,467 | -61% | 1 | 1 | 0% | 3,963 | 1,596 | -60% | 0 | 0 | — |
case-12 | fail→fail | 45,160 | 14,480 | -68% | 1 | 1 | 0% | 3,312 | 1,481 | -55% | 0 | 0 | — |
case-13 | fail→fail | 20,694 | 8,999 | -57% | 1 | 1 | 0% | 2,888 | 1,681 | -42% | 0 | 0 | — |
case-14 | pass→pass | 23,468 | 17,970 | -23% | 1 | 1 | 0% | 2,696 | 3,586 | +33% | 0 | 0 | — |
case-15 | pass→pass | 25,886 | 20,246 | -22% | 1 | 1 | 0% | 2,787 | 3,928 | +41% | 0 | 0 | — |
case-16 | pass→pass | 38,718 | 15,509 | -60% | 1 | 1 | 0% | 2,652 | 3,151 | +19% | 0 | 0 | — |
case-17 | pass→pass | 17,846 | 15,831 | -11% | 1 | 1 | 0% | 2,034 | 2,904 | +43% | 0 | 0 | — |
case-18 | pass→pass | 15,940 | 14,725 | -8% | 1 | 1 | 0% | 1,714 | 2,861 | +67% | 0 | 0 | — |
case-19 | fail→fail | 17,459 | 5,242 | -70% | 1 | 1 | 0% | 3,194 | 1,654 | -48% | 0 | 0 | — |
case-20 | fail→fail | 26,021 | 5,271 | -80% | 1 | 1 | 0% | 3,934 | 1,596 | -59% | 0 | 0 | — |
case-21 | pass→pass | 22,231 | 12,218 | -45% | 1 | 1 | 0% | 2,741 | 3,502 | +28% | 0 | 0 | — |
case-22 | fail→fail | 31,066 | 24,144 | -22% | 1 | 1 | 0% | 5,382 | 6,346 | +18% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 15 counted toward the lift figure. The other 7 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +5 percentage points is the difference between those two pass rates over the 15 comparable cases. 3 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.