technical-debt

Technical debt management: Ward Cunningham's quadrant (Reckless/Prudent × Deliberate/Inadvertent), Martin Fowler taxonomy, quantification with SonarQube/SQALE/radon, Churn×Complexity hotspot matrix (Code Maat), Interest Rate concept, debt ticket format, Buy-vs-Pay-Down decision framework, communicating debt to non-technical stakeholders.

8 stars

Best use case

technical-debt is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Technical debt management: Ward Cunningham's quadrant (Reckless/Prudent × Deliberate/Inadvertent), Martin Fowler taxonomy, quantification with SonarQube/SQALE/radon, Churn×Complexity hotspot matrix (Code Maat), Interest Rate concept, debt ticket format, Buy-vs-Pay-Down decision framework, communicating debt to non-technical stakeholders.

Teams using technical-debt should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/technical-debt/SKILL.md --create-dirs "https://raw.githubusercontent.com/marvinrichter/clarc/main/skills/technical-debt/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/technical-debt/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How technical-debt Compares

Feature / Agenttechnical-debtStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Technical debt management: Ward Cunningham's quadrant (Reckless/Prudent × Deliberate/Inadvertent), Martin Fowler taxonomy, quantification with SonarQube/SQALE/radon, Churn×Complexity hotspot matrix (Code Maat), Interest Rate concept, debt ticket format, Buy-vs-Pay-Down decision framework, communicating debt to non-technical stakeholders.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Technical Debt Skill

Technical debt is not a bug, it's a financial metaphor. Like financial debt, some debt is strategic ("ship now, refactor later") and some is accidental ("we didn't know better"). Both accumulate *interest* — slowing down future development. This skill covers measuring, prioritizing, and paying down debt systematically.

## When to Activate

- Planning a tech-debt sprint or "hardening" quarter
- A team feels slow but can't point to what's wrong
- Communicating the cost of technical debt to non-technical stakeholders
- Deciding whether to pay down debt or continue building features
- Running a tech debt audit before a major new initiative

---

## The Debt Quadrant (Ward Cunningham + Martin Fowler)

```
                    DELIBERATE           INADVERTENT
                  ┌────────────────┬──────────────────┐
   RECKLESS       │ "No time for   │ "What's          │
                  │  design"       │  layering?"      │
                  ├────────────────┼──────────────────┤
   PRUDENT        │ "Ship now,     │ "Now we know     │
                  │  refactor      │  a better way"   │
                  │  later"        │                  │
                  └────────────────┴──────────────────┘
```

**Reckless + Deliberate**: Skipping design under time pressure. *Avoid.* The cost always exceeds the savings.

**Reckless + Inadvertent**: Lack of knowledge. *Invest in education.* Code reviews, pair programming, training.

**Prudent + Deliberate**: Strategic shortcut with documented intent. *Track and pay down.* Acceptable if the ticket exists.

**Prudent + Inadvertent**: Learned something new that invalidates old approach. *Normal engineering.* Refactor when touching the area.

---

## Measuring Technical Debt

### Complexity Metrics

**Cyclomatic Complexity** — number of independent paths through a function:
```bash
# JavaScript / TypeScript
npx complexity-report --format json src/

# Python
pip install radon
radon cc src/ -a -s  # -a: average, -s: show scores
radon mi src/ -s     # Maintainability Index

# Go
go install github.com/fzipp/gocyclo@latest
gocyclo -over 15 ./...  # Flag functions with complexity > 15

# Java (via SonarQube or standalone)
# Use SonarLint plugin in IDE for immediate feedback

# Ruby
gem install flog
flog app/
```

**Cognitive Complexity** (SonarQube, more human-aligned):
- Not just paths, but how hard the code is to *understand*
- Nested loops and conditionals cost more than flat code

**Target thresholds:**

| Rating | Cyclomatic Complexity | Action |
|--------|----------------------|--------|
| A | 1–5 | Good |
| B | 6–10 | Acceptable |
| C | 11–15 | Needs refactor |
| D | 16–25 | High debt |
| F | >25 | Critical — split immediately |

### Churn × Complexity Matrix (Adam Tornhill — Code Maat)

The most valuable metric: files that are *both* frequently changed and complex are your highest-priority debt.

```
High Complexity
     │   Low Churn         │  High Churn
     │   (complex but      │  (complex AND
     │   rarely touched)   │  frequently changed)
     │   → LOW priority    │  → HIGHEST PRIORITY
─────┼────────────────────────────────────────────
Low  │   Low Churn         │  High Churn
Complexity  (simple,      │  (simple, often changed)
     │   rarely touched)   │  → low risk
     │   → ignore          │
     └────────────────────────────────────────────
                            High Churn
```

```bash
# Git churn analysis (files changed most often last 6 months)
git log --after="6 months ago" --name-only --format="" | \
  sort | uniq -c | sort -rn | head -20

# Combine with complexity manually, or use Code Maat:
# https://github.com/adamtornhill/code-maat
git log --all --numstat --date=short --pretty=format:'--%h--%ad--%aN' > git.log
java -jar code-maat.jar -l git.log -c git2 -a coupling
```

### SonarQube / SonarCloud

```bash
# Run local SonarQube analysis
docker run -d -p 9000:9000 sonarqube:community

# Analyze (adjust for your language)
npx sonarqube-scanner \
  -Dsonar.projectKey=my-project \
  -Dsonar.sources=src \
  -Dsonar.host.url=http://localhost:9000

# Key metrics to track:
# - Technical Debt Ratio (SQALE): time to fix / time to develop
# - Reliability Rating: A-E for bugs
# - Maintainability Rating: A-E for code smells
# - Coverage: % lines tested
```

**SQALE Method** — estimates debt in time:
- SonarQube calculates remediation time for each code smell
- Debt Ratio = Total Remediation Time / Estimated Development Time
- < 5%: A (low debt) | 6–10%: B | 11–20%: C | 21–50%: D | > 50%: E

---

## The Interest Rate Concept

Not all debt is equally costly. Prioritize by *interest rate*:

**High interest debt** (slows you down daily):
- God Class that everyone must modify for every new feature
- Untested core service that causes fear of change
- Database schema that makes every query an adventure

**Low interest debt** (rarely costs you anything):
- Legacy utilities nobody uses
- One-off scripts in a /scripts folder
- Internal tooling with low change frequency

```
Annual Interest = (Hours lost per week due to this debt) × 52

Example:
- Legacy authentication module
- Everyone who changes auth spends 2h extra per change
- Team changes auth ~3x/month = 6h/month = 72h/year
- At $150/h = $10,800/year in interest
- Refactor estimate: 40h = $6,000 = pays for itself in 8 months
```

---

## Debt Ticket Format

Every tracked debt item should have:

```markdown
**Title**: [Debt] UserService: God Class with 1200 lines, 15 unrelated responsibilities
**Type**: Tech Debt
**Priority**: P1

**Why This Is Debt**
UserService was originally 100 lines. Over 3 years, every team added something here
because "it's where users are handled." It now includes: auth, profile management,
notification preferences, billing history, session management.

**Current Cost (Interest)**
- Every new user feature requires touching UserService → context switch for unrelated code
- Average 2h overhead per story that touches UserService
- ~8 stories/sprint × 2h = 16h/sprint wasted = ~0.5 engineer-weeks/sprint

**Proposed Fix**
Split into: AuthService, UserProfileService, BillingService (3 services)
Extract each responsibility behind an interface first (Branch-by-Abstraction).

**Estimated Effort**
3 sprints (6 weeks) for complete separation

**Break-Even Point**
At 16h/sprint interest, 3 sprints × 2 weeks × 16h = 96h of debt cost
Refactor cost: ~80h
Pays for itself immediately after completion.

**Acceptance Criteria**
- [ ] Each service has single responsibility
- [ ] Each service has >80% test coverage
- [ ] No circular dependencies
- [ ] Original UserService deleted
```

---

## Buy-vs-Pay-Down Framework

```
Should we pay down this debt now?

1. Calculate Annual Interest Rate
   If < 10h/year: DEFER (low interest)

2. Is it on the critical path of next 2 quarters?
   Yes: PAY DOWN (blocking progress)
   No: continue to step 3

3. Is the debt accumulating? (Getting worse each sprint)
   Yes: PAY DOWN (compounding interest)
   No: MONITOR

4. What's the morale impact?
   Significant frustration, attrition risk: PAY DOWN
   Low impact: DEFER

Decision matrix:
| Interest | Growth | Critical Path | Action |
|----------|--------|---------------|--------|
| High | Yes | Yes | Pay down now (P0) |
| High | Yes | No | Pay down this quarter (P1) |
| High | No | Yes | Pay down now (P0) |
| High | No | No | Pay down next quarter (P2) |
| Low | Any | No | Defer or delete |
```

---

## Communicating Debt to Non-Technical Stakeholders

**Avoid**: "We need to refactor the UserService."
**Use**: "Our checkout team spends 4 extra hours per feature on outdated auth code. In the last year, that's cost us ~200h of engineering time — equivalent to one engineer-month. A 2-week investment now eliminates this permanently."

**Templates:**

**The Technical Debt Tax:**
> "Every new feature in [area] currently takes X% longer than it should because of accumulated debt. We're paying a monthly tax of ~[N] engineer-days. Fixing it costs [Y] days upfront, and pays for itself in [Z] months."

**The Risk Frame:**
> "This code hasn't been meaningfully tested. Every change is a risk of breaking [business-critical flow]. Last quarter this caused [incident/near-miss]. A 3-week hardening sprint would reduce this risk from HIGH to LOW."

**The Opportunity Frame:**
> "If we spend 4 weeks on tech debt now, our next feature in this area goes from 3 months to 6 weeks. That's an additional feature shipped this quarter without hiring anyone."

---

## Definition of Done for Debt Tickets

"It's ongoing" is not an acceptable state. Each debt ticket must have:

- [ ] Clear acceptance criteria (not "improve the code")
- [ ] The old code is *deleted*, not "improved"
- [ ] Test coverage meets bar (80%+ for modified areas)
- [ ] Complexity metric measurably improved (cyclomatic complexity reduced)
- [ ] Code reviewed by someone who didn't write it
- [ ] Feature flag removed (if applicable)

---

## Reference Skills

- `legacy-modernization` — patterns for replacing legacy code (Strangler Fig, Branch-by-Abstraction)
- `engineering-metrics` — measuring impact of debt reduction on DORA metrics
- `/debt-audit` — command to run a systematic debt inventory

Related Skills

zero-trust-patterns

8
from marvinrichter/clarc

Zero-Trust security patterns — mTLS between microservices (Istio/SPIFFE), SPIRE workload identity, OPA/Envoy authorization, NetworkPolicy default-deny-all, short-lived credentials, service mesh security, and Kubernetes RBAC hardening.

wireframing

8
from marvinrichter/clarc

Wireframing and prototyping workflow: fidelity levels (lo-fi sketch → mid-fi wireframe → hi-fi prototype), tool selection (Figma, Excalidraw, Balsamiq), user flow diagrams, wireframe annotation standards, information architecture (IA) mapping, and the handoff from wireframe to visual design. For developers who need to communicate UI structure before writing code.

webrtc-patterns

8
from marvinrichter/clarc

WebRTC patterns — peer connection setup, ICE/STUN/TURN configuration, signaling server design, SFU vs mesh topology, screen sharing, media track management, and reconnect/ICE restart handling.

webhook-patterns

8
from marvinrichter/clarc

Webhook patterns for receiving, verifying (HMAC), and idempotently processing third-party events. Covers Stripe, GitHub, and generic webhook patterns, delivery guarantees, retry handling, and testing.

web-performance

8
from marvinrichter/clarc

Web performance optimization: Core Web Vitals (LCP, CLS, INP), Lighthouse CI with budget configuration, bundle analysis (webpack-bundle-analyzer, vite-bundle-visualizer), hydration performance, network waterfall reading, image optimization (WebP/AVIF, srcset), and font performance.

wasm-performance

8
from marvinrichter/clarc

WebAssembly performance: wasm-opt binary optimization, size reduction (panic=abort, LTO, strip), profiling WASM in Chrome DevTools, memory management (linear memory, avoiding GC pressure), SIMD, and multi-threading with SharedArrayBuffer.

wasm-patterns

8
from marvinrichter/clarc

WebAssembly patterns: wasm-pack, wasm-bindgen (JS↔Wasm interop), WASI, Component Model, wasm-opt, Rust-to-WASM compilation, JS integration (web workers, streaming instantiation), and production deployment (CDN, Content-Type headers).

visual-testing

8
from marvinrichter/clarc

Visual Regression Testing: tool comparison (Chromatic/Percy/Playwright screenshots/BackstopJS), pixel-diff vs AI-based comparison, baseline management, flakiness strategies (masks, tolerances, waitForLoadState), CI integration with GitHub Actions, and Storybook integration.

visual-identity

8
from marvinrichter/clarc

Brand identity development: color palette construction (primary/secondary/semantic/neutral), logo concept brief writing, typeface pairings, brand voice definition, mood board direction, and Brand Guidelines document structure. Use when establishing or evolving a visual brand — not for implementing existing tokens.

ux-micro-patterns

8
from marvinrichter/clarc

UX micro-patterns for every product state: Empty States, Loading States (skeleton screens, spinners, optimistic UI), Error States, Success States, Confirmation Dialogs, Onboarding Flows, and Progressive Disclosure. These patterns apply to every feature — done wrong, they're the biggest source of user confusion.

typography-design

8
from marvinrichter/clarc

Typography as a creative discipline: typeface selection criteria, type pairing (serif + sans, display + body), modular scale systems, line-height and tracking ratios, hierarchy construction, and web/mobile rendering considerations. The decisions behind design tokens, not the tokens themselves.

typescript-testing

8
from marvinrichter/clarc

TypeScript testing patterns: Vitest for unit/integration, Playwright for E2E, MSW for API mocking, Testing Library for React components. Core TDD methodology for TypeScript/JavaScript projects.