legacy-code-disposition
Skill0 starsChanged 3 months agoMITView on GitHub
Decide what to do with 'seemingly unused' code (uncalled functions, commented-out logic, empty impls, half-finished stubs): delete, wire up, or preserve with contingency. Use when the user says 'should I delete this dead code?', 'why is this function never called?', 'is this logic still needed?'. Don't use for active feature work (use workspace-consistency).
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skill-recapSkill
- comm-link-debuggingSkill
- deep-comparison-analysisSkill
- industry-practice-surveySkill
- tech-selection-convergenceSkill
- dev-recap-docsSkill
- guide-and-manualSkill
- readme-syncSkill
- change-recapSkill
- code-reviewSkill
- error-handlingSkill
- phase-trackingSkill
- repo-hygieneSkill
- workspace-consistencySkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 42
Search the whole repo for references (definition + all call sites).
- Distinctive: line 47
Commit history can tell them apart: was the call "never added" or "added then deleted"?
- Distinctive: line 79
Write the delete / preserve rationale into docs (design doc / commit message / code comment) so it is traceable.
- Distinctive: line 81
Delete: record "X was once implemented, judged unneeded by Y (measured Z), deleted".
- Distinctive: line 96
Decision: delete (motivation not empirically grounded + measured as unneeded).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
legacy-code-disposition — Legacy Code Disposition Decisions
When to use
Encounter a stretch of "seemingly unused" code and need to decide what to do with it:
- Functions / methods that are never called
- Commented-out logic blocks
- Empty implementations / interfaces returning placeholder values
- Half-finished work that was computed but never wired into the main flow (typical:
val x = compute()followed by code that uses the raw value instead) - Code marked TODO / FIXME for a long time, no longer clear whether it is still wanted
When NOT to use
- Clearly temporary debug code — just delete it.
- Newly written code still in active use.
- Active feature work — use
workspace-consistencyfor end-of-work cleanup instead.
How this differs from related tools
- code-review / general review — review finds problems (what bug is in this code). This skill is for code that is already known to be unused; the decision is delete / keep / wire up.
- dev-recap-docs — produces understanding docs. This skill produces a disposition action.
- Sequence: use this skill first to decide "delete / keep / wire up", then use
dev-recap-docsto record the rationale.
Output
A reasoned disposition decision + execution (delete / wire up / preserve with annotation), with traceable rationale.
Methodology (6 steps)
1. Confirm it is truly unused
Search the whole repo for references (definition + all call sites). Distinguish two kinds of "unused":
- Computed but never used (half-finished): result is calculated / defined but never wired in → possibly a missing feature.
- Call removed after evaluation (falsified): was called, then removed when the approach changed → possibly genuinely unneeded.
Commit history can tell them apart: was the call "never added" or "added then deleted"?
2. Recover the original design intent
From comments / commit history / design docs, recover where it was supposed to plug in, what it was supposed to do, and why it was written. Notes like "for X / to prevent Y / to trigger Z" in comments are design motivations.
3. Build the current-state evidence chain
List every exit point where it should have been wired in, and confirm one by one that it is in fact not wired:
- Watch out for "looks unused but takes effect indirectly elsewhere" (reflection / config / callback invocation).
- For each exit point, give "confirmed not wired" evidence (grep shows no references / the flow skips it / a substitute value is used).
4. Verify the motivation is empirically grounded
The design intent from step 2 often says "may / might / could cause X" — ask:
- Is there empirical evidence in logs / docs / measured records? Or is it only a preventive speculation?
- Does the system currently (without this code wired in) actually run correctly? If it does, the motivation may already be falsified by reality.
Key insight: comments like "may be incompatible / may cause X" are usually preventive speculation written at the time, not empirically grounded. If the system runs fine in practice, the preventive concern may no longer hold.
5. Make the decision (three options)
| Decision | Condition | Action |
| Delete | Motivation not empirically grounded + measurement proves it is unneeded + no future reuse value | Delete the code |
| Wire up | Half-finished (computed but unused), supposed to take effect, is a missing feature | Add the wiring so it actually works |
| Preserve with contingency | May be needed in the future / uncertain | Keep + annotate "unused + trigger condition", do not leave silent |
6. Record the rationale
Write the delete / preserve rationale into docs (design doc / commit message / code comment) so it is traceable.
- Delete: record "X was once implemented, judged unneeded by Y (measured Z), deleted".
- Preserve with contingency: record "unused; enable when condition X triggers".
Red lines (reasoned, not absolute)
- Do not delete based on "looks unused" alone — walk the full evidence chain (step 3) first; otherwise you may delete code that takes effect indirectly.
- Do not treat "preventive speculation" as "confirmed problem" — step 4 must distinguish them.
- Do not delete without leaving a record — step 6 is mandatory; otherwise the same question will be re-litigated in the future.
Worked example: one full disposition (sanitized)
- Confirm unused: grep the whole repo; found the definition and one "computed but unused" call site (constructed a result variable, but subsequent send / cache code uses the raw value).
- Design intent: comment said "cleans a string to prevent the peer's parsing library from rejecting an extension field → dropping it → stalling".
- Evidence chain: each exit point where it should have been wired (send, cache refresh) confirmed to use the raw value; the result is never referenced.
- Empirical motivation: searched all joint-debug docs, no recorded "stall" evidence (motivation was speculation at writing time); after adding fallback config, the system actually connects fine.
- Decision: delete (motivation not empirically grounded + measured as unneeded).
- Record: rationale written into the relevant section of the design doc + commit message.
This is one instance, not the methodology itself.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

