Why "we need a refactoring sprint" keeps losing
A lead asks for two weeks to "clean up the billing module". The product director asks what the company gets for those two weeks. The lead says "fewer bugs, faster work later". The sprint goes to a feature. Six months later the same module eats a release, and the same conversation repeats with worse numbers.
My position: technical debt is a business argument that engineers keep making with engineering words. You win time for it when you can show where it sits, what it costs per month and what you will measure after paying it down. This article is for leads and architects who have to make that case: four ways to measure debt, how to turn them into hours and money, three budgeting models, and a checklist to run before you ask.
First, which debt are you talking about
Martin Fowler's technical debt quadrant, published in 2009, splits debt along two axes: deliberate or inadvertent, prudent or reckless. It is useful less as a theory than as a sorting tool for the backlog.
| Quadrant | What it sounds like in a team | What to do with it |
|---|---|---|
| Deliberate, prudent | "We ship with a single region now and split it after the launch" | Write it down with a trigger date; this is a loan with terms |
| Deliberate, reckless | "No time for tests, we will add them later" | Stop taking it; it is usually cheaper to cut scope |
| Inadvertent, reckless | Nobody on the team knew the pattern was a problem | Training and review, then fix the hot spots only |
| Inadvertent, prudent | "Now we see what the design should have been" | Normal; plan the redesign where change is frequent |
Only the first and last rows deserve a budget conversation. The middle two are process problems, and paying them down without changing the process just refills the backlog.
Four signals that measure debt
No single number describes debt. I use four, from cheapest to collect to most convincing.
Static analysis debt ratio
SonarQube estimates remediation effort for every maintainability issue and divides it by the cost to write the code, assuming 30 minutes per line by default. A ratio up to 5% rates A, 5 to 10% B, 10 to 20% C, 20 to 50% D, above 50% E. It is a quick baseline. Its limit: it counts rule violations everywhere, including code nobody has touched in three years.
Churn times complexity: hot spots
Adam Tornhill's method, built into CodeScene: take how often each file changes from Git history and cross it with how hard the code is to work with. In one CodeScene example, prioritised hot spots were about 1.2% of the codebase but took 12.5% of development effort and held about 45% of the fixed bugs. Debt in a file that never changes costs nothing. Debt in a file changed every week is a monthly bill.
Lead time for changes, per module
The DORA metric, measured per service or module instead of for the whole company: time from commit to production. If changes to the billing module take 9 days and the rest of the code takes 2, that gap is the debt expressed in calendar time.
Change failure in hot spots
The share of deployments touching a module that need a rollback or hotfix. This is the number a product director understands without translation: "one in four releases that touch this code breaks something".
The research behind signal 2 is worth quoting to the business. Tornhill and Borg studied 39 proprietary codebases and 30,737 files in 2022: low-quality code had 15 times more defects, issues in it took on average 124% longer to resolve, and the worst-case cycle times were 9 times longer. That last figure matters most to a product team, because unpredictability is what breaks roadmaps.
Turning debt into hours and money
The business does not buy "code health". It buys hours back, fewer incidents and dates it can trust. The conversion is simple arithmetic, and doing it badly is still better than not doing it.
| Signal | Conversion | Example |
|---|---|---|
| Extra lead time in a module | Extra days × changes per month | 7 extra days × 12 changes: features wait 84 change-days a month |
| Hotfixes in a hot spot | Hotfixes × hours per hotfix × loaded hourly cost | 6 a month × 10 hours × $90 = $5,400 a month |
| Slower work in the file | Hours spent in hot spots × share lost | 200 hours a month, if a third is friction: about 67 hours |
| Onboarding | Weeks until a new hire ships in the module | "New people need 6 weeks before they touch billing" |
The example figures in the table are illustrative; use your own from Git, the tracker and the incident log. For a sense of scale, Stripe's Developer Coefficient survey from September 2018 asked developers and executives how much time goes to maintenance: the mean was 17.3 hours a week, against an average work week of 41.1 hours. Your team will differ. The survey is a sanity check, not your baseline.
Then promise one number back. "After four weeks on checkout, lead time for its changes drops from 9 days to under 4, and hotfixes from 6 a month to 2." If you cannot name the number, the business is right to say no.
Three ways to budget the time
I have not found a credible source for the "always spend 20%" rule that circulates in talks, so treat the share as a choice you make and revisit, not a law.
| Model | How it works | Works when | Fails when |
|---|---|---|---|
| Fixed share of capacity | A set slice of every sprint, agreed with product for a quarter | Debt is spread across many modules | The slice gets raided the first time a deadline slips |
| Attached to features | Each feature touching a hot spot includes its cleanup in the estimate | Hot spots sit on the roadmap path | Debt lives in code no feature touches soon |
| Targeted project | 2 to 6 weeks on one module, with a before and after metric | One hot spot dominates incidents or lead time | There is no metric, so nobody can tell if it worked |
Most teams I would advise end up with a mix: a small fixed share for everyday cleanup, cleanup attached to features, and a targeted project once or twice a year where the data points at one place. The fixed share is the one to protect in writing, with the product owner's name on it.
One page for the business
The pitch that works fits on one page and has five lines. Where: the module and its share of incidents or changes. Cost now: hours and money per month from the table above. Ask: weeks of whose time. Result: the one metric and its target. Check date: when you will report back, even if the result is bad.
Leave out the debt ratio unless someone asks. A product director who hears "rating C" learns nothing; one who hears "1 in 4 releases touching checkout needs a hotfix" asks when you can start. This kind of trade-off reasoning is also what staff and principal interviews probe, and a practice round on a pair mock interview is a cheap place to rehearse it out loud.
Before you ask for a debt sprint
If you ticked fewer than three, spend a week collecting data before the meeting. A weaker case presented twice is worse than a strong one presented once.
The short version
Sort debt by Fowler's quadrant and only budget for the prudent kind. Measure it with hot spots, lead time per module and change failure; keep the static debt ratio as a baseline, not an argument. Translate it into hours and money, promise one metric back, and choose the budget model that fits where the debt sits.
Related: do AI coding assistants make teams faster, system design theory: 12 concepts, when your manager will not promote you.
Questions readers ask
-
How do you measure technical debt?
Combine several signals: a static analysis debt ratio as a baseline, hot spots from change frequency and code complexity, lead time for changes per module, and change failure rate in the modules that change most. No single number covers it.
Link to this answer -
Is the SonarQube debt ratio enough?
It is a quick baseline, but it counts issues everywhere, including code nobody touches. Debt in rarely changed code costs little, so cross the ratio with change frequency before acting on it.
Link to this answer -
What percentage of a sprint should go to technical debt?
There is no credible universal number. Pick a share with your product owner for a quarter, protect it in writing, and adjust it based on lead time and incident data.
Link to this answer -
How do I explain technical debt to non-engineers?
In hours, money and risk: extra days per change, hotfixes per month times their cost, and how often releases touching the module break. Promise one metric back and a date to report it.
Link to this answer -
What is a hot spot in code?
A file or module where frequent change meets hard-to-work-with code. In one CodeScene example, hot spots were about 1.2% of the code but held about 45% of the fixed bugs.
Link to this answer -
Should we stop features for a debt sprint?
Only when one module clearly dominates incidents or lead time and you can measure the result. Otherwise attach cleanup to features that touch the hot spots and keep a small fixed share.
Link to this answer
Sources
- Martin Fowler: Technical Debt Quadrant
- SonarQube documentation: metrics definitions (technical debt ratio, maintainability rating)
- CodeScene documentation: hotspots
- Tornhill and Borg: Code Red, the business impact of code quality (2022)
- Stripe: The Developer Coefficient (September 2018)
- DORA: software delivery performance metrics
Figures were checked against these pages in October 2026. Pay and dates change; the links show where to recheck.