Sometimes I delete hundreds of lines of code from my own projects. After deleting, I run the tests, and they all pass.
It was an export feature I wrote two years ago. The requester was myself. It was used only once after launch and never called again. It sat in the repository, and every time I came across it I’d think “I might need to change this later,” so I kept a place for it, kept its tests, and left a line about it in the README. Over two years, the only benefit it brought was making me consider one more branch that didn’t need considering every time I refactored that module.
After this, I rethought the whole thing: when one person maintains a project, how should technical debt actually be managed?
In a team, technical debt has a natural reminder mechanism. During code review someone says “leave this for now, we’ll fix it later,” and another person remembers; a newcomer takes over and hits the pitfall; someone brings it up at the weekly meeting. When one person maintains it, all these mechanisms fail: no second pair of eyes, no handover, no meetings. The debt is still there, but no one nags.
So I no longer maintain a “to do later” list. Instead, I make every piece of debt carry its own expiry condition. Expiry doesn’t mean it must be paid off; it means a decision must be made.
First, distinguish which code will still be changed
Most technical debt tutorials assume all debt should be paid off. That’s a team perspective, because code will continue to be changed by multiple people. In a project maintained by one person, this premise often doesn’t hold.
My first step now isn’t to list debts; it’s to rate code by heat: files changed in the past six months, and directories never touched once. Only the former is worth paying debt on. Those modules that were never touched after being written should either be deleted or left alone. The cost of maintaining them is zero, provided they don’t participate in the build, don’t slow down tests, and don’t pop up to annoy you every time you rename something.
This judgment sounds crude, but it’s closer to one person’s reality than “all debt must be paid off.” One person’s time isn’t evenly invested across all files; most code enters a dormant state from the day it’s written. Paying debt on dormant code yields close to zero benefit, while the risk is real: you’ll introduce a bug in a branch no one uses, then spend more time fixing it back because you’re unfamiliar with the context.
I judge heat by only two signals: whether it’s still on the build and test path, and whether it’s been changed in the past six months. The former determines whether it will bite you; the latter determines whether you’ll still touch it. If neither applies, leave it alone for now.
Going through my project by this standard, the debt that actually needs handling is less than half. The remaining question becomes: how do I remember them?
Make every TODO carry an expiry condition
My old TODOs looked like this:
1 | # TODO: 这里以后改成增量更新 |
Writing it was the same as not writing it. Opening it half a year later, I didn’t know what I’d wanted to change, why I hadn’t changed it, or whether it still needed changing. Worse, this kind of comment multiplies: seven or eight pile up in one file, and eventually I just ignore them all.
The current format is fixed:
1 | # DEBT(2026-03): 现在每次全量重算,数据过万条就得改成按 updated_at 增量拉 |
There are two rules. In the parentheses is a month, not an exact date, because I only need it to be comparable when I scan. After the colon, I must clearly write “what it’s like now, and under what condition it must be touched.” Words like “optimize,” “improve,” or “refactor” that can’t be judged as complete are not allowed.
I don’t put debt into an issue list. Not because it’s bad, but because when one person maintains a project, it easily becomes an inbox that only takes in and never sends out. A comment next to the code has an advantage: when you change that piece of code, it will definitely come into view. Issues won’t; issues only get dug out by me on some weekend and then closed again.
Paired with a script of a dozen or so lines, placed at the repository root:
1 | import re, pathlib, datetime |
I hook it into the pre-commit check. Expired entries get printed but don’t block the commit. I hesitated on this: blocking commits is stricter, but when one person writes code, being stopped by your own script makes it easy to just add --no-verify to bypass it, which instead breeds bad habits. Printing it out for me to see is enough; once I see it, I’ll make a decision.
There are only three decisions: do it now; push the month back and add a note in the comment explaining why; or just delete the code. What’s not allowed is silently changing the date, which is the same as not writing it.
The value of this system isn’t in making debt smaller, but in making debt judgeable. Before, seeing a TODO only made me anxious; now I know it’s either handled now or has a clear reason to stay owed. When one person maintains a project, the worst thing is treating technical debt as a moral issue. Owing debt isn’t failure; forgetting is the trouble.
Debt repayment actions must be small enough to finish over a meal
In a one-person project, the biggest expense isn’t writing code; it’s re-entering the context. My experience is that anything estimated at more than half a day gets pushed back indefinitely, until it becomes a TODO from two years ago. So debt repayment must be chopped up.
The actions I’ve actually done that can wrap up within an hour are roughly these: split a two-hundred-line function into three without changing behavior at all; add three lines of logging to a critical path that has none; move a hardcoded path into a config file; delete a branch that’s always true; add three test cases for a pure function that has none.
The opposite is equally important: don’t both refactor and change behavior in the same commit. When one person maintains a project, no one catches you; if a mixed commit goes wrong, binary search for the cause will be painful. My rule is one commit does one thing, even if it’s only five lines.
Dependency upgrades are handled at this granularity too. About once a month I pick a day to upgrade only patch versions and run the tests; for minor versions I glance at the changelog before deciding; major versions get scheduled separately. If a dependency is more than three major versions behind, my choice is usually not to chase it, and instead rewrite it together with the code the next time that module actually needs changing. Chasing a version two years behind often costs more time than rewriting that feature, and a rewrite at least produces code I can understand myself.
There’s a boundary here: if what’s behind is a security-related dependency, or it’s blocking the next feature, then it can’t be handled as “later.” My criterion isn’t the version number, but whether it will block me in the near term, or whether it will leave me passive in production. The former determines priority; the latter determines whether to handle it immediately.
Some debt I owe on purpose
When one person maintains a project, the weight of “I can still understand it when I come back next time” is far higher than extensibility. So I deliberately owe these debts: no microservices, just one process; no message queue, synchronous calls, retry plus alert on failure; only one database, no splitting; abstraction level pressed to the minimum, three similar pieces of code left similar, no base class extracted.
In a team these practices would probably be blocked in review. When one person maintains a project, they instead save trouble, because the benefit of abstraction is multiple people and parallel development, and neither premise exists for me. What’s left is only cost: one more layer of indirection, one more convention to remember.
But deliberately owing debt has a premise: it must be written down. In the README I have a section called “Why Not,” recording why synchronous instead of a queue, why no cache layer, why all scheduled tasks are in one process. The purpose of writing it down isn’t for others to see; it’s to prevent the me of half a year later from excitedly “fixing” it and then spending two weekends changing it back.
This premise also has a boundary. If the project suddenly needs one more person, or needs to be delivered externally, those deliberately owed debts must be re-evaluated. Single-person maintenance, low concurrency, understandable by myself—once these conditions change, the ledger must be recalculated.
The last time I ran the script, three records popped up that had been expired for over a year. I fixed two on the spot; opening the remaining one, I saw that the entry point of that feature had long been replaced by another path, so I deleted the code directly, and the tests along with it. After deleting, the repository got smaller, the tests got a few seconds faster, and there was no other impact.
Next time I write DEBT into the code, I’ll first ask myself one question: under what circumstances must a decision be made about this record?
Comments