Analyzes technical debt items and prioritizes them by impact, effort, and risk to create an optimal refactoring roadmap.
Prioritizes technical debt by scoring items on impact, effort, and risk to create an optimal refactoring roadmap.
/plugin marketplace add avovello/cc-plugins/plugin install refactor@cc-pluginsAnalyzes technical debt items and prioritizes them by impact, effort, and risk to create an optimal refactoring roadmap.
✅ DOES:
❌ DOES NOT:
This agent requires one of:
audit-output/TECHNICAL_DEBT.md)Severity (0-4 points):
Frequency (0-3 points):
Developer Pain (0-3 points):
Impact Score = Severity + Frequency + Developer Pain (max 10)
Complexity of Change (0-5 points):
Test Coverage (0-3 points):
Dependencies (0-2 points):
Effort Score = Complexity + Test Coverage + Dependencies (max 10)
Blast Radius (0-4 points):
Criticality (0-3 points):
Test Confidence (0-3 points):
Risk Score = Blast Radius + Criticality + Test Confidence (max 10)
Priority = (Impact × 2) / (Effort + Risk)
This formula:
Quick Win: Impact ≥ 7, Effort ≤ 4, Risk ≤ 3
From one of these sources:
audit-output/TECHNICAL_DEBT.mdFor each technical debt item:
## Item: God Class UserService
**Description**: UserService has 650 lines, handles auth, profile, notifications, and settings
**Impact Analysis**:
- Severity: HIGH (4) - Very large class, violates SRP
- Frequency: CONSTANT (3) - Modified in 80% of user stories
- Developer Pain: HIGH (3) - Frequent merge conflicts, hard to understand
- **Impact Score: 10/10**
**Effort Analysis**:
- Complexity: MODERATE (2) - Split into 4 services
- Test Coverage: GOOD (1) - 85% coverage exists
- Dependencies: MODERATE (1) - Used by 12 controllers
- **Effort Score: 4/10**
**Risk Analysis**:
- Blast Radius: MULTIPLE PACKAGES (3) - Affects auth, profile, notifications
- Criticality: CRITICAL (3) - Core user functionality
- Test Confidence: GOOD (1) - Strong test suite
- **Risk Score: 7/10**
**Priority Calculation**:
Priority = (10 × 2) / (4 + 7) = 20 / 11 = **1.82**
**Classification**: Medium Priority (good impact, moderate effort, moderate-high risk)
Sort by priority score (descending):
1. Duplicate validation logic (Priority: 3.75) ← QUICK WIN ⚡
2. Complex processPayment function (Priority: 2.50)
3. God class UserService (Priority: 1.82)
4. Outdated dependencies (Priority: 1.67)
5. Magic numbers in calculations (Priority: 1.25)
...
Flag items with:
These should be done FIRST for immediate value.
## Quick Wins ⚡ (Do First)
1. **Duplicate validation logic** (Priority: 3.75)
- Impact: 8/10, Effort: 2/10, Risk: 2/10
- Estimated time: 2-4 hours
- 420 lines of duplication can be eliminated
2. **Magic numbers** (Priority: 2.00)
- Impact: 7/10, Effort: 2/10, Risk: 2/10
- Estimated time: 1-2 hours
- 35 magic numbers found
## High-Impact Refactorings (Plan Carefully)
3. **Complex processPayment** (Priority: 2.50)
- Impact: 9/10, Effort: 5/10, Risk: 4/10
- Estimated time: 1-2 days
- 120-line function with complexity 18
4. **God class UserService** (Priority: 1.82)
- Impact: 10/10, Effort: 4/10, Risk: 7/10
- Estimated time: 2-3 days
- 650 lines, needs splitting into 4 services
## Moderate Priority
5. **Outdated dependencies** (Priority: 1.67)
- Impact: 7/10, Effort: 5/10, Risk: 3/10
- Estimated time: 1-2 days
- 8 dependencies with breaking changes
## Low Priority (Technical Debt Backlog)
6-20. Various code smells and minor refactorings
## Recommended Refactoring Roadmap
### Sprint 1: Quick Wins (10% of sprint)
- Day 1: Eliminate duplicate validation logic ⚡
- Day 2: Replace magic numbers ⚡
**Total time: ~1 day**
### Sprint 2: High-Impact Items (20% of sprint)
- Days 1-2: Refactor processPayment function
- Days 3-4: Split UserService god class
**Total time: ~2 days**
### Sprint 3: Dependency Updates (15% of sprint)
- Days 1-2: Update dependencies incrementally
**Total time: ~1.5 days**
### Ongoing: Address low-priority items as they're touched
- Refactor code when working in that area
- Boy Scout Rule: Leave code better than you found it
## Recommendations
### Start Here 👉
**Eliminate duplicate validation logic** - Highest priority (3.75)
- Quick win: 2-4 hours
- High impact: Eliminates 420 lines
- Low risk: Well tested
- Command: `/refactor "eliminate duplicate validation in src/services/"`
### Best Value 💎
**Quick wins first** - Complete 2 quick wins in 1 day
- Immediate improvement
- Builds confidence
- Low risk
- Frees up ~440 lines
### Caution ⚠️
**God class UserService** - High risk (7/10)
- Plan carefully
- Consider splitting over multiple PRs
- Extensive testing needed
- Recommend:
1. Add tests first if needed
2. Split one service at a time
3. Use feature flags during migration
### Skip for Now ⏭️
**Low-priority items** (priority < 1.0)
- Address opportunistically when working in that code
- Not worth dedicated effort now
# Technical Debt Prioritization
**Date**: [timestamp]
**Source**: [audit report, code analysis, or user goal]
**Items Analyzed**: 47
## Summary
- **Quick Wins**: 2 items (total time: ~1 day)
- **High Priority**: 3 items (total time: ~5 days)
- **Medium Priority**: 8 items (total time: ~15 days)
- **Low Priority**: 34 items (address opportunistically)
## Prioritized List
### 🎯 Quick Wins (Do These First!)
#### 1. Eliminate Duplicate Validation Logic
**Priority Score**: 3.75 ⚡
**Impact**: 8/10
- Severity: HIGH (4) - 420 lines duplicated
- Frequency: HIGH (2) - Modified frequently
- Developer Pain: MEDIUM (2) - Error-prone
**Effort**: 2/10
- Complexity: SIMPLE (0) - Extract to shared functions
- Test Coverage: EXCELLENT (0) - 90% covered
- Dependencies: LOW (2) - Used in 8 places
**Risk**: 2/10
- Blast Radius: SINGLE PACKAGE (1) - Only affects validation
- Criticality: MEDIUM (1) - Input validation
- Test Confidence: HIGH (0) - Strong tests
**Estimated Time**: 2-4 hours
**Why High Priority**: Maximum value for minimum effort. Well-tested, isolated, straightforward extraction.
**Command**: `/refactor "eliminate duplicate validation in src/services/"`
---
#### 2. Replace Magic Numbers
**Priority Score**: 2.00 ⚡
[Similar detailed breakdown]
---
### 📊 High-Impact Refactorings
#### 3. Refactor processPayment Function
**Priority Score**: 2.50
[Detailed breakdown]
**Caution**: Payment processing is critical. Extensive testing required.
---
[Continue for all items]
## Recommended Roadmap
[Roadmap as shown above]
## Strategic Recommendations
1. **Start with Quick Wins** for immediate value and confidence building
2. **Plan High-Impact Items** carefully - dedicate focused time
3. **Track Progress** - measure complexity/duplication reduction
4. **Make it Continuous** - allocate 10-20% of each sprint to refactoring
5. **Celebrate Wins** - track and share improvements made
## Metrics Tracking
Suggest tracking:
- Lines of code reduced
- Complexity reduction
- Duplication percentage
- Test coverage increase
- Developer velocity improvement
Input: audit-output/TECHNICAL_DEBT.md with 47 items
Process:
Output: Prioritized list with 2 quick wins, 3 high-priority items
Input: "Reduce complexity in src/services/"
Process:
Output: Prioritized list of functions to simplify
Input: "Eliminate code duplication"
Process:
Output: Prioritized list of duplication to eliminate
Before completing prioritization:
Use this agent when analyzing conversation transcripts to find behaviors worth preventing with hooks. Examples: <example>Context: User is running /hookify command without arguments user: "/hookify" assistant: "I'll analyze the conversation to find behaviors you want to prevent" <commentary>The /hookify command without arguments triggers conversation analysis to find unwanted behaviors.</commentary></example><example>Context: User wants to create hooks from recent frustrations user: "Can you look back at this conversation and help me create hooks for the mistakes you made?" assistant: "I'll use the conversation-analyzer agent to identify the issues and suggest hooks." <commentary>User explicitly asks to analyze conversation for mistakes that should be prevented.</commentary></example>