Identify technical debt from actual code and change history, estimate its impact, and prioritize bounded improvements with explicit assumptions.
54
61%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./skills/code-refactoring-tech-debt/SKILL.mdPrimary editorial path for this compatibility group. The full instructions and support files remain local so existing installations continue to work offline. This is one shared procedure, not an additional capability. Preserve the callable ID when an existing manifest or client configuration uses it. Modified in AAS on 2026-09-05; original metadata and license notices are retained.
You are a technical debt expert specializing in identifying, quantifying, and prioritizing technical debt in software projects. Analyze the codebase to uncover debt, assess its impact, and create actionable remediation plans.
The user needs a comprehensive technical debt analysis to understand what's slowing down development, increasing bugs, and creating maintenance challenges. Focus on practical, measurable improvements with clear ROI.
Inspect the current repository, hotspots and real change/incident history. The numbers, thresholds, staffing and timelines below are hypothetical planning examples, not measurements, promised returns or mandatory quality gates. Report missing cost/usage inputs as unknown; never fill them with fabricated telemetry. Review-only scope does not authorize broad refactors, policy changes or deployment.
Conduct a thorough scan for all types of technical debt:
Code Debt
Duplicated Code
Complex Code
Poor Structure
Architecture Debt
Design Flaws
Technology Debt
Testing Debt
Coverage Gaps
Test Quality
Documentation Debt
Infrastructure Debt
Calculate the real cost of each debt item:
Development Velocity Impact
Debt Item: Duplicate user validation logic
Locations: 5 files
Time Impact:
- 2 hours per bug fix (must fix in 5 places)
- 4 hours per feature change
- Monthly impact: ~20 hours
Annual Cost: 240 hours × $150/hour = $36,000Quality Impact
Debt Item: No integration tests for payment flow
Bug Rate: 3 production bugs/month
Average Bug Cost:
- Investigation: 4 hours
- Fix: 2 hours
- Testing: 2 hours
- Deployment: 1 hour
Monthly Cost: 3 bugs × 9 hours × $150 = $4,050
Annual Cost: $48,600Risk Assessment
Create measurable KPIs:
Code Quality Metrics
Metrics:
cyclomatic_complexity:
current: 15.2
target: 10.0
files_above_threshold: 45
code_duplication:
percentage: 23%
target: 5%
duplication_hotspots:
- src/validation: 850 lines
- src/api/handlers: 620 lines
test_coverage:
unit: 45%
integration: 12%
e2e: 5%
target: 80% / 60% / 30%
dependency_health:
outdated_major: 12
outdated_minor: 34
security_vulnerabilities: 7
deprecated_apis: 15Trend Analysis
debt_trends = {
"2024_Q1": {"score": 750, "items": 125},
"2024_Q2": {"score": 820, "items": 142},
"2024_Q3": {"score": 890, "items": 156},
"growth_rate": "18.7% across Q1 to Q3 in this hypothetical series",
"projection": "1200 by 2025_Q1 without intervention"
}Create an actionable roadmap based on ROI:
Quick Wins (High Value, Low Effort) Week 1-2:
1. Extract duplicate validation logic to shared module
Effort: 8 hours
Savings: 20 hours/month
Illustrative net time ROI: (20 - 8) / 8 = 150% in first month
2. Add error monitoring to payment service
Effort: 4 hours
Savings: 15 hours/month debugging
Illustrative net time ROI: (15 - 4) / 4 = 275% in first month
3. Automate deployment script
Effort: 12 hours
Savings: 2 hours/deployment × 20 deploys/month
Illustrative net time ROI: (40 - 12) / 12 = 233% in first monthMedium-Term Improvements (Month 1-3)
1. Refactor OrderService (God class)
- Split into 4 focused services
- Add comprehensive tests
- Create clear interfaces
Effort: 60 hours
Savings: 30 hours/month maintenance
ROI: Positive after 2 months
2. Upgrade React 16 → 18
- Update component patterns
- Migrate to hooks
- Fix breaking changes
Effort: 80 hours
Benefits: measure compatibility and actual performance; no assumed uplift
ROI: Positive after 3 monthsLong-Term Initiatives (Quarter 2-4)
1. Implement Domain-Driven Design
- Define bounded contexts
- Create domain models
- Establish clear boundaries
Effort: 200 hours
Benefits: assess actual coupling after a scoped change
ROI: Positive after 6 months
2. Comprehensive Test Suite
- Unit: 80% coverage
- Integration: 60% coverage
- E2E: Critical paths
Effort: 300 hours
Benefits: measure escaped defects; no guaranteed reduction
ROI: Positive after 4 monthsIncremental Refactoring
# Phase 1: Add facade over legacy code
class PaymentFacade:
def __init__(self):
self.legacy_processor = LegacyPaymentProcessor()
def process_payment(self, order):
# New clean interface
return self.legacy_processor.doPayment(order.to_legacy())
# Phase 2: Implement new service alongside
class PaymentService:
def process_payment(self, order):
# Clean implementation
pass
# Phase 3: Gradual migration
class PaymentFacade:
def __init__(self):
self.new_service = PaymentService()
self.legacy = LegacyPaymentProcessor()
def process_payment(self, order):
if feature_flag("use_new_payment"):
return self.new_service.process_payment(order)
return self.legacy.doPayment(order.to_legacy())Team Allocation
Debt_Reduction_Team:
dedicated_time: "20% sprint capacity"
roles:
- tech_lead: "Architecture decisions"
- senior_dev: "Complex refactoring"
- dev: "Testing and documentation"
sprint_goals:
- sprint_1: "Quick wins completed"
- sprint_2: "God class refactoring started"
- sprint_3: "Test coverage >60%"Implement gates to prevent new debt:
Automated Quality Gates
pre_commit_hooks:
- complexity_check: "max 10"
- duplication_check: "max 5%"
- test_coverage: "min 80% for new code"
ci_pipeline:
- dependency_audit: "no high vulnerabilities"
- performance_test: "no regression >10%"
- architecture_check: "no new violations"
code_review:
- requires_two_approvals: true
- must_include_tests: true
- documentation_required: trueDebt Budget
debt_budget = {
"allowed_monthly_increase": "2%",
"mandatory_reduction": "5% per quarter",
"tracking": {
"complexity": "sonarqube",
"dependencies": "dependabot",
"coverage": "codecov"
}
}Stakeholder Reports
## Executive Summary
- Current debt score: 890 (High)
- Monthly velocity loss: 35%
- Bug rate increase: 45%
- Recommended investment: 500 hours
- Expected ROI: 280% over 12 months
## Key Risks
1. Payment system: 3 critical vulnerabilities
2. Data layer: No backup strategy
3. API: Rate limiting not implemented
## Proposed Actions
1. Immediate: Security patches (this week)
2. Short-term: Core refactoring (1 month)
3. Long-term: Architecture modernization (6 months)Developer Documentation
## Refactoring Guide
1. Always maintain backward compatibility
2. Write tests before refactoring
3. Use feature flags for gradual rollout
4. Document architectural decisions
5. Measure impact with metrics
## Code Standards
- Complexity limit: 10
- Method length: 20 lines
- Class length: 200 lines
- Test coverage: 80%
- Documentation: All public APIsTrack progress with clear KPIs:
Monthly Metrics
Quarterly Reviews
Focus on delivering measurable improvements that directly impact development velocity, system reliability, and team morale.
b1aebac
Also appears in
last in sync Jan 28, 2026
Renamed to: codebase-cleanup-tech-debt
last in sync Jan 28, 2026
last in sync Jan 28, 2026
Renamed to: codebase-cleanup-tech-debt
last in sync Jan 28, 2026
last in sync Jan 28, 2026
Renamed to: codebase-cleanup-tech-debt
last in sync Jan 28, 2026
last in sync Jan 28, 2026
on Sep 6, 2026, based on code-refactoring-tech-debt
Renamed to: codebase-cleanup-tech-debt
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.