Tech debt

From qa-aman/claude-skills · View interactive version

Tech debt is an AI agent skill from the GitHub repository qa-aman/claude-skills. Document and prioritize technical debt. Use when the user says "tech debt", "legacy code", "this code is a mess", "refactoring plan", "we need to clean this up", "paying down debt", "this is hard to change", "how do we fix this codebase", or has code that's difficult to understand or modify - even i

How to use this skill

Skill file

Overview

Based on "Working Effectively with Legacy Code" by Michael Feathers. Feathers' definition: legacy code is code without tests. His central technique: find the "seams" - places where you can insert test coverage without changing the code under test. Once a seam has test coverage, you can safely refactor. The discipline: never refactor without a safety net. Never add features to untested code without first covering it.

Workflow

Step 1: Define the debt

Before prioritizing, describe the debt specifically:

Debt item: [name]
Location: [file:line or module]
What it is: [one sentence description]
Why it's a problem: [what it makes harder]
Symptom: [what developers experience because of it]

Vague debt ("the codebase is messy") can't be prioritized. Specific debt can.

Step 2: Classify the debt type

| Type | Description | Urgency |

|------|-------------|---------|

| Reckless/Deliberate | Shortcuts taken knowingly ("we'll fix it later") | High |

| Reckless/Inadvertent | Mistakes made without knowing better | High |

| Prudent/Deliberate | Conscious tradeoff: ship now, fix later | Medium |

| Prudent/Inadvertent | Learned better approach after the fact | Low |

Step 3: Find the seams (Feathers)

A seam is a place where you can change behavior without editing existing code - typically a function call boundary or an interface.

For each debt item:

Step 4: Estimate the cost of the debt

| Dimension | Questions |

|-----------|-----------|

| Cost of carry | How much does this slow development each sprint? |

| Cost of fix | How many days to resolve? |

| Blast radius | How many systems/teams are affected? |

| Risk if ignored | What breaks if this is never fixed? |

Step 5: Prioritize the backlog

Prioritize debt that:

Deprioritize debt in stable areas that are rarely touched.

Step 6: Write the debt ticket

Title: [specific debt item]
Location: [file/module]
Type: [reckless/prudent x deliberate/inadvertent]
Impact: [what this costs the team per sprint]
Fix plan:
  1. Add seam tests: [specific tests to write first]
  2. Refactor: [what to change once tests exist]
  3. Verify: [how to confirm the refactor is safe]
Effort estimate: [days]
Priority: [P1/P2/P3]

Anti-Patterns

1. Refactoring without tests

Bad: "Let me clean this up" without adding test coverage first.

Good: Find the seam. Write tests. Then refactor. Tests prove you didn't break behavior.

2. Big bang rewrites

Bad: "We'll rewrite the whole module from scratch."

Good: Feathers: big rewrites fail. Incrementally improve with seam-by-seam coverage. Ship working code at every step.

3. Paying debt in high-risk sprints

Bad: Refactoring core payment code the week before a major release.

Good: Pay debt in low-risk windows. Prioritize timing as much as priority.

4. Debt without business context

Bad: "This code is bad, we need to fix it." (to a PM or stakeholder)

Good: "This debt costs us 2 days per sprint. Fixing it is a 5-day investment that pays back in 3 sprints."

Quality Checklist

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.