Glossary · Code health

What is technical debt?

Technical debt is the future cost of choosing a quick or imperfect solution in code now. Like financial debt, it accrues interest: each later change to that code takes longer and risks more bugs until the shortcut is repaid. Ward Cunningham coined the metaphor in 1992. It covers code, design, tests and documentation.

Last reviewed: November 2026

Also called Tech debt, Code debt, Design debt

In depth How to prioritize technical debt: ranking debt by churn, bug history, reach and effort, with the commands to build the list.

How technical debt is measured

There is no single agreed unit. Three approaches are common:

ApproachWhat it countsWeakness
Debt ratioEstimated remediation effort divided by the cost of developing the code (SonarQube maps 5% or less to an A rating)Built from rule violations on one snapshot; the effort figures are estimates
Code metricsComplexity, duplication, nesting, file size per fileSays how messy code is, not whether it hurts
History signalsHow often a file changes, how many bug fixes it collects, how many people touch itNeeds git history; says nothing about code nobody changes

Why the last row matters: two files both have a function with cyclomatic complexity 30. One changed 40 times last quarter and collected 6 bug fixes; the other has not changed in two years. Metrics give the size of the loan, change frequency the interest.

Why technical debt matters

The metaphor comes from Ward Cunningham's 1992 OOPSLA experience report on the WyCash portfolio system: shipping code that reflects an immature understanding is like taking a loan, fine if you repay it by refactoring, costly if you keep paying interest. Fowler's 2009 quadrant adds that debt is not always a mistake. Deliberate, prudent debt (ship now, repay next sprint) is a trade. Inadvertent debt is the kind teams discover later.

The consequence is speed: features in indebted code take longer and changes break things that look unrelated. The cost concentrates in the files that change often and many others import.

How to measure technical debt yourself

Free tools cover the inputs:

  • Complexity per function: radon cc -s -a src/ (Python), lizard src/ (many languages), ESLint complexity, gocyclo -over 10 . (Go).
  • Change frequency: git log --since="90 days ago" --name-only --pretty=format: | sort | uniq -c | sort -rn | head -20.
  • An effort-based debt number tracked per pull request: SonarQube is the established choice.

Join the first two lists: complex, frequently changed files are debt with interest. SonarQube gives a tidier single figure but does not read git history.

How repowise measures technical debt

repowise scores every file from 1.0 to 10.0 for code health using 59 deterministic detectors, no LLM, and then ranks the files by what to fix first, with the first edit, an effort estimate and the tests to run for each item.

  • Where you see it: repowise health on the CLI (top fix-first items, lowest-scoring files), repowise next for the cross-layer list, and get_health over MCP. See the code health feature page.
  • History counts: churn, change entropy, ownership and prior bug-fix commits are inputs, so a messy file nobody changes ranks below a moderately messy file changed every week.
  • Dead code first: unused code is debt you can delete instead of refactor; see dead code.

For the ranking method, read how to prioritize technical debt. For tool comparisons, see technical debt measurement tools compared.

FREQUENTLY ASKED

Technical debt: questions

What are the four types of technical debt?

Martin Fowler's technical debt quadrant (2009) crosses two questions: was the debt deliberate or inadvertent, and was it reckless or prudent. That gives four types: deliberate and reckless ("we have no time for design"), deliberate and prudent ("ship now, deal with the consequences"), inadvertent and reckless ("what is layering?"), and inadvertent and prudent ("now we know how we should have done it").

Is technical debt a bug?

No. A bug is behavior that is wrong today. Technical debt is code that works but is costly to change, so it raises the odds and the price of future bugs. The two meet in practice: files with debt tend to collect bug fixes.

What is an example of technical debt?

A 400-line function copied into three services because sharing it needed a refactor nobody scheduled. It works, but every fix must now be made three times, and the copies drift apart.

How do you reduce technical debt?

Pay down debt in files that change often and are widely imported, delete code nothing uses, and add tests before refactoring risky code. Debt in code nobody touches costs almost nothing to carry, so leave it.

See it on your own repository.

Index a repository free and read the result for your own code and history. Rolling it out to a team? We will walk you through it.