Identify, catalog, and plan the resolution of technical debt in a codebase. Use this skill when the user wants to understand the health of their codebase, prioritize cleanup work, or plan a refactoring effort. Triggers on phrases like "tech debt", "code quality", "refactor", "cleanup", "code health", "maintainability", "this code is a mess", or when you notice code quality issues during implementation that should be tracked rather than fixed inline (which could result in a game of whack-a-mole).
Every codebase has technical debt. The question isn't whether it exists — it's whether you're managing it deliberately or just accumulating it until something breaks. Staff and principal engineers at companies like Stripe, Reddit, and Squarespace treat tech debt management as a core engineering practice, not an afterthought.
Technical debt is a useful metaphor because, like financial debt, it has an interest rate. Some debt is cheap (a slightly awkward naming convention) and some is expensive (a shared database that every service queries directly). The goal isn't zero debt — it's keeping the "interest payments" (developer friction, incident risk, velocity drag) at an acceptable level.
Before cataloging tech debt, understand the system's current state — what's already been identified, what's deprecated, and where the known pain points are.
If gjalla is available, query these tools first:
get_context — get a full picture of system state to identify gaps between what exists
and what's healthy. Look for components marked as deprecated — these are pre-identified
debt items that should be in your inventory.get_context (scope: capabilities) — find deprecated capabilities that may represent
feature-level debt (features that are half-maintained, partially migrated, etc.).get_context (scope: rules) — check for principles about code quality, testing standards,
or operational requirements. Anything that violates an active principle is debt by definition.get_impact — for specific debt items, understand the blast radius to estimate the true
effort and risk of resolving them.If gjalla is not available, scan for TODO/FIXME/HACK comments, check dependency vulnerability reports, and review incident history for systemic patterns.
Not all tech debt is the same. Categorize it to prioritize effectively:
Code-level debt
Architecture-level debt
Testing debt
Operational debt
Documentation debt
Create a tech debt inventory. For each item:
## Tech Debt Inventory
### [TD-001] [Short descriptive title]
- **Category**: [code / architecture / testing / operational / documentation]
- **Location**: [files, services, or systems affected]
- **Description**: [what the debt is and why it's debt]
- **Impact**: [how this debt affects the team — velocity drag, incident risk, cognitive load]
- **Interest rate**: [low / medium / high — how much ongoing cost does this create?]
- **Effort to resolve**: [small / medium / large — rough estimate]
- **Priority**: [P1 / P2 / P3 — based on impact and effort]
- **Proposed approach**: [brief description of how to fix it]
- **Dependencies**: [other debt items or features that interact with this]
Use a simple impact-effort matrix to decide what to tackle:
High impact, low effort (do first)
High impact, high effort (plan and schedule)
Low impact, low effort (batch and do opportunistically)
Low impact, high effort (defer or skip)
When advocating for tech debt work, connect it to business outcomes:
Quantify where possible. "We spend ~4 hours per sprint working around this" is more persuasive than "this code is hard to work with."
When assessing tech debt, produce:
Save the inventory as docs/tech-debt-inventory.md or wherever the team tracks
engineering health.
The tech debt inventory is itself a form of attestation — it declares the current state of system health and makes hidden problems visible.
## Tech Debt Attestation
**System state assessed**: [from get_context — which areas were analyzed]
**Deprecated components found**: [from get_context — pre-identified debt items]
**Deprecated capabilities found**: [from get_context(scope="capabilities")]
**Rules violated**: [from get_context(scope="rules") — active principles that current code violates]
**Debt items cataloged**: [count by category: code / architecture / testing / operational / docs]
**High-priority items**: [top 3-5 items with impact-effort justification]
**Recommended next actions**: [which skills to invoke — write-design-doc for large refactors,
plan-migration for risky changes, add-observability for monitoring gaps]