Skip to content

Tech Debt Analysis

Estimated time: ~30 minutes

Prerequisite: Module 9.3 (Legacy Test Generation)

Outcome: After this module, you will have a framework for analyzing tech debt with Claude, know how to prioritize debt repayment, and be able to create actionable improvement roadmaps for legacy codebases.


Your legacy codebase has problems everywhere. Outdated dependencies. Inconsistent patterns. Copy-pasted code. Magic numbers. No types. Where do you even start? You could refactor for years and never finish.

The answer isn’t “fix everything.” The answer is “fix the RIGHT things.” Tech debt analysis helps you identify which debt is actively hurting you (pay now), which is future risk (pay later), and which is acceptable (live with it). Claude can analyze faster than you — but needs a framework.


Technical debt is code or architecture choices that trade short-term speed for long-term cost. Not all debt is bad — sometimes it’s the right trade-off. The problem is UNMANAGED debt that compounds over time.

CategoryExamplesImpact
Code QualityLong functions, deep nesting, unclear namingMaintenance cost
ArchitectureTight coupling, wrong patterns, scalability limitsFeature development blocked
DependenciesOutdated packages, security vulnerabilitiesSecurity/compatibility risk
TestingLow coverage, flaky tests, no testsRegression risk
DocumentationMissing docs, outdated docs, no onboardingKnowledge silos
PatternsInconsistent styles, multiple ways to do same thingCognitive load
Low EffortHigh Effort
High Impact🔥 Do NOW📅 Plan carefully
Low Impact✅ Quick wins❄️ Maybe never
  • High-interest debt: Gets worse over time (security vulnerabilities, broken tests) → Pay first
  • Low-interest debt: Static cost (code style, naming) → Pay when convenient

Scenario: Analyze a legacy e-commerce backend for tech debt prioritization.

You: Analyze src/ for technical debt. Give me a high-level inventory.
Categorize by: Code Quality, Architecture, Dependencies, Testing,
Documentation, Patterns.
Claude:
CODE QUALITY:
- paymentService.js: 800-line file, functions > 100 lines
- Multiple files with deep nesting (4-5 levels)
ARCHITECTURE:
- Circular dependency: orderService ↔ inventoryService
- Direct database access in route handlers
DEPENDENCIES:
- Express 3.x (current: 4.x, security advisories)
- lodash 3.x (known vulnerabilities)
TESTING:
- Overall coverage: 23%
- Payment and order logic: 5% coverage
DOCUMENTATION:
- README last updated 3 years ago
- No API documentation
PATTERNS:
- Mix of callbacks and promises
- 3 different validation approaches
You: Rank the top 5 debt items by Impact and Effort (S/M/L/XL).
Claude:
1. lodash vulnerability — Impact: HIGH, Effort: S → DO NOW
2. Express 3.x upgrade — Impact: HIGH, Effort: M → PLAN
3. Payment test coverage — Impact: HIGH, Effort: L → PLAN
4. Circular dependency — Impact: MEDIUM, Effort: M → LATER
5. Inconsistent async — Impact: MEDIUM, Effort: L → LATER
You: Create a 3-sprint roadmap for the top items.
Claude:
Sprint 1 (Quick Wins):
- Upgrade lodash (2 hours)
- Add basic tests to payment flow (1 day)
Sprint 2 (Critical Upgrade):
- Express 3 → 4 migration (3 days)
- Add tests for affected routes (2 days)
Sprint 3 (Architecture):
- Resolve circular dependency (2 days)
- Increase order test coverage to 50% (2 days)
You: Create TECH_DEBT.md with inventory, roadmap, and accepted debt.
Claude: [Creates documentation file]

Check outdated dependencies:

Terminal window
$ npm outdated

Output:

Package Current Wanted Latest
lodash 3.10.1 3.10.1 4.17.21
express 3.21.2 3.21.2 4.18.2

Goal: Create a categorized tech debt inventory.

Instructions:

  1. Pick a module/directory in any project
  2. Ask Claude to analyze for tech debt
  3. Create a categorized inventory
  4. Estimate effort (S/M/L/XL) for each item
💡 Hint
"Analyze [directory] for technical debt.
Categorize by: Code Quality, Architecture, Dependencies, Testing.
For each item, estimate effort: S/M/L/XL."

Goal: Practice impact vs. effort prioritization.

Instructions:

  1. Take your inventory from Exercise 1
  2. Plot items on the Impact vs. Effort matrix
  3. Identify: Do Now / Plan / Later / Never
  4. Ask Claude to validate your prioritization

Goal: Create an actionable roadmap.

Instructions:

  1. Take your prioritized list
  2. Create a 3-sprint roadmap
  3. Ensure Sprint 1 has quick wins (motivation!)
  4. Ensure critical items are planned, not just listed
✅ Solution

Roadmap structure:

  • Sprint 1: Quick wins (S effort, high impact) — build momentum
  • Sprint 2: Critical items (M effort, high impact) — address risks
  • Sprint 3: Architecture improvements (L effort) — long-term health
  • Document accepted debt — things you’re choosing NOT to fix

Code Quality | Architecture | Dependencies | Testing | Documentation | Patterns

Low EffortHigh Effort
High Impact🔥 NOW📅 Plan
Low Impact✅ Quick win❄️ Maybe never
"Analyze [scope] for tech debt. Categorize and prioritize."
"Top 5 improvements, ranked by impact and effort?"
"If I could only fix 3 things, what and why?"
"Create a debt repayment roadmap for 3 sprints."
TypeExamplesAction
High interestSecurity, broken testsPay now
Low interestStyle, namingPay when convenient

Create TECH_DEBT.md: Inventory + Roadmap + Accepted Debt


❌ Mistake✅ Correct Approach
Trying to fix all debtPrioritize. Some debt is acceptable.
Only looking at code qualityInclude architecture, dependencies, testing, docs.
Listing debt without effort estimatesImpact without effort = can’t prioritize.
Ignoring “interest rate”Security and broken tests compound. Fix first.
Starting with big refactorsStart with quick wins. Build momentum.
No documentation of decisionsTECH_DEBT.md: what, why, when.
Analyzing entire codebase at onceStart with high-traffic areas. Iterate.

Scenario: Vietnamese startup, 4-year-old codebase, team of 5 developers. “Everything needs fixing” paralysis — nobody knew where to start.

Claude-assisted debt analysis (2 days):

Day 1 — Inventory:

  • Scanned 200 files with Claude
  • Found: 47 code quality issues, 12 architecture debts, 8 outdated dependencies (3 with CVEs), 15% test coverage

Day 2 — Prioritization:

  • Claude ranked by impact/effort
  • Top 3: Security vulnerabilities (S effort, critical), missing auth tests (M effort, high risk), circular dependencies (L effort, blocking features)

Roadmap created:

  • Sprint 1: Security fixes + auth tests
  • Sprint 2: Untangle order module
  • Sprint 3: Increase coverage to 40%

Accepted Debt (documented):

  • Inconsistent naming conventions (low impact, would take months)
  • Old util functions (working, not worth changing)

Result: Team had clear direction. First sprint completed in 1 week. Morale improved — “We’re making progress instead of drowning.”


Phase 9 Complete! You can now work effectively with legacy codebases — exploring, refactoring safely, adding tests, and prioritizing improvements.

Next Phase: Phase 10: Team Collaboration — Use Claude Code in team settings.