Skip to content
Back to skills

Audit Tech Debt

ASecurity

Find what teaches agents bad habits in a repo: bad comments, unused code, copies, and hacks. Show them on a report page, talk through your choices, and after your go edit comments, file tickets, and add rules, with no code changed and nothing committed. Use when the user asks what in a repo teaches agents bad habits.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 1, 2026
ai-agentspythongogitapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned December 2, 2026

npx -y skills add linhvu0711/skills --skill audit-tech-debt --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Audit Tech Debt?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Audit Tech Debt
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/linhvu0711-audit-tech-debt/badge)](https://www.skillsdirectory.com/skills/linhvu0711-audit-tech-debt)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: audit-tech-debt
description: "Find what teaches agents bad habits in a repo: bad comments, unused code, copies, and hacks. Show them on a report page, talk through your choices, and after your go edit comments, file tickets, and add rules, with no code changed and nothing committed. Use when the user asks what in a repo teaches agents bad habits."
disable-model-invocation: true
---

Paths in this skill are relative to its real folder: the one that holds this `SKILL.md`, after links are followed, as `realpath` prints it. Before you run or read one of them, put that real folder's absolute path in front of it.

Agents copy what the code shows them. A `// temp fix, clean up later` comment reads as "hacks are fine here", a stale comment reads as truth, an unused function reads as the way to do a job, and a copy or a hack invites one more. This skill finds those, and after the user's go it edits comments, files a ticket for each fix, and adds a rule where one stops the next. It changes comment lines only: a fix to code is a ticket.

Read `../../core/subagents/facts.md` first: you are the brain, helpers retrieve, short lookups are yours.

Then read `../../core/clean-codebase/run.md` and follow it whole. It scans and reports, then hands the rows to the health flow of `../../core/clean-codebase/health-flow.md`: grill, gap check, change list, file, and writes. It asks this skill for four things: § Kinds, § Search, § Helper, and § Apply, below.

## Always stays

These comments are never a place, and no row names them:

- a short comment that says why: a reason, a limit, or a source the code cannot show, such as the reason for a magic number;
- a license header;
- a doc comment on a public function or type;
- a tool line with a reason, as `// eslint-disable-next-line no-console -- CLI output`;
- a shebang;
- a pragma;
- the `Given`, `When`, and `Then` lines in a test.

A long note of why is a Comments row, and a hack a Hacks row, even when its comment says why.

## Kinds

Four report kinds, each with its own helper (§ Helper).

### Comments

Id `comments`, title `Comments`. Five kinds of row, each with its advice:

- **Repeats the code**: `// loop over users` above the loop. Advice `fix`: delete. All such places are one row.
- **No longer true**: `// returns null` above code that throws, or a `TODO: retry` above code that retries. Advice `fix`: delete it, or correct it when the comment says something the code cannot show; the change list gives the new text. All such places are one row.
- **Code inside a comment**: `// const old = fetchV1()`. Advice `fix`: delete. All such places are one row.
- **Banner line**: `// ===== helpers =====`. Advice `fix`: delete. All such places are one row.
- **Long note of why**: many lines that explain a decision, as a twenty-line block above a retry loop. Advice `fix`: move it to an ADR and leave one line with its link. One row per note, and `choice` is true: whether it is worth an ADR, and its title, are the user's.
A tool line with no reason is not a row.

### Unused code

Id `unused`, title `Unused code`. A function, a file, a folder, a flag, or an option or mode that nothing uses, as an exported `formatV1` with no caller, or a `--legacy` flag that no script passes. One row per thing; a folder and its files are one row. Each place names the searches that found no caller: in the code, in text strings, in scripts, and in config, and whether a name built at run time could reach it. Advice `fix`: a ticket to delete it. When a caller can exist outside the repo, as an export of a published package, a public API route, or a command a user types, the place is `Inferred` and the row's `choice` is true: whether an outside caller still needs it is the user's.

### Copies

Id `copies`, title `Copies`. The same code in two or more places, as one date parser pasted into three modules. One row per group; each copy is a place. Advice `fix`: a ticket to keep one copy and call it from the others. `fine` when the copies must stay apart, as a script that has to run with no imports.

### Hacks

Id `hacks`, title `Hacks`. Code that goes around a problem and does not solve it, with a comment or without one. Some examples; the list is not complete:

- a line that turns a check off: `// eslint-disable-next-line`, `@ts-ignore`, `# noqa`;
- an unsafe cast: `as any`, `as unknown as User`;
- a wait that hides a timing problem: `sleep(500)` before a read;
- a `catch` that ignores the error: `catch {}`, `except: pass`;
- a guard that hides a bug: a null check for a state no correct caller reaches, per `../../core/review/general-rules.md` rule 7;
- a `TODO`, `HACK`, or `FIXME` note, as `// temp fix, Safari drops the first event` or `// don't touch, breaks prod`.

A tool line with a reason (§ Always stays) is not a hack. A hack whose comment links an ADR that still covers it was kept and marked already: it is not a place. A broken link, or an ADR about other code, keeps it a place; a ticket link is left to § Known and Came back of the run. Before it gives advice on a hack, the helper reads the history of its line with `../../core/history/trail.py`: when it came, the PR and issue behind it, and what its fix would be. One row per hack, unless one fix covers several. The advice:

- `fix`: a ticket with its fix, as a cast that a type the repo now has makes needless;
- `keep-and-mark` with a ticket, when the hack stays until a fix can come;
- `keep-and-mark` with an ADR, when it stays for good.

`choice` is true when the fix is unclear, or when the hack may still be needed.

## Borders

Some finds look like these kinds and belong to another skill. Leave them out of the report:

- The same code two times is a copy and belongs here. Two different ways to do one job, as `fetch` in one module and `axios` in another, belong to `audit-coding-standards`.
- A module that only passes calls on to the one under it belongs to the design skill, `audit-architecture`.
- A wait or a retry in a test or in CI, as a `sleep` in a test or a retry flag in a workflow, belongs to `audit-ci`.

## Search

From the repo root, list the files in scope with `git ls-files`, minus what the run leaves out. Then, per kind:

- **Comments**: find the comment lines with `rg -n`, using the comment markers of the languages present: `//`, `#`, `/*`, `--`, `<!--`, `;`. Keep only the files with a hit. A file's places are its comment lines.
- **Unused code**: every file that holds code, a script, or config. Prose, such as `.md` and `.txt`, is left out. The helper finds the places as it reads.
- **Copies**: pipe the same code, script, and config files to `python3 scripts/copies.py`. Each line it prints is one group, as `9 lines: src/orders.ts:12-24 src/billing.ts:40-52`. No line: no copies.
- **Hacks**: the same files as Unused code. The helper finds the places as it reads.

## Helper

One helper per kind, one per batch. Each brief holds the batch's files and the span start, and pastes in whole the sections named here:

- `comment-judge`: a batch of about ten files with comment lines. Its brief pastes § Always stays and § Kinds, Comments.
- `unused-judge`: a batch of about ten files. Its brief pastes § Kinds, Unused code, and § Borders.
- `copy-judge`: a batch of groups that hold about ten files in all; a group with more files is a batch of its own. Its brief holds the groups' lines and pastes § Kinds, Copies, and § Borders.
- `hack-judge`: a batch of about ten files. Its brief holds the full path of `../../core/history/trail.py` and pastes § Always stays, § Kinds, Hacks, and § Borders.

## Apply

- **Tickets.** A row on Unused code, Copies, or Hacks whose answer is `fix`, and a row whose answer is `keep-and-mark` with a ticket, is a ticket row, with its fix: `delete formatV1: no caller in the code, strings, scripts, or config`, `keep parseDate in src/dates.ts, call it from src/orders.ts and src/billing.ts`, or a workaround for a browser version the repo no longer supports.
- **Edits.** After the run filed the tickets and wrote the ADRs:
  - delete: the whole line when the comment is the whole line, else only the comment and the space before it;
  - correct: replace the comment's text with the new text from the change list;
  - long note of why: replace the note with one line in the file's comment form, `Why: see docs/adr/<file>.md`;
  - keep and mark: add ` see #<n>` for a ticket or ` see docs/adr/<file>.md` for an ADR at the end of the comment, in the repo's form for links when it has one. A tool line, as `// eslint-disable-next-line no-console`, gets the link on its own comment line above it instead, and above the whole stack when directives sit one over the other, as an `eslint-disable-next-line` over a `// @ts-ignore`, so each directive keeps its target. A place with no comment gets a new comment line above it, in the file's comment form, saying what it works around and the link, as `// cast until the API types land, see #123`.
- **No code fix.** A `fix` on Unused code, Copies, or Hacks changes no code here: its ticket is the change.
- **Diff check.** Then `git diff -U0` on the files you edited. Each changed line is a comment line, or keeps its code outside the comment as it was, as `foo(); // loop` that becomes `foo();`. A file with any other change: undo your edits in that file, and name it in chat with the line whose code changed.

## Examples

**User:** `/audit-tech-debt`

The scan holds 300 files and 4 copy groups: 12 comment, 30 unused, 1 copy, and 30 hack helpers. The report: `I found 7 things. I would fix 4. 2 need your choice. 1 is Known: an open ticket covers it.` `Comments that repeat the code` is Still spreading, with 3 new places since the last run. The grill asks two questions: a long note of why in `src/orders/retry.ts` becomes an ADR, the Safari hack gets a ticket, and an `as any` in `src/api/user.ts:40`, whose trail shows PR #88 added it until the API types land, is kept and marked with a ticket. The gap check finds nothing. The change list holds 2 tickets, an epic, 1 ADR, and 252 comment edits. The user says go, then go again on file-epic's breakdown. `R3 → #124 (epic #123)`, `R4 → #125 (epic #123)`, the ADR, the edits with ` see #125` on the `as any`, a line in the Run table, then `Ready for a pull request`.

**User:** `/audit-tech-debt src/billing`

The search finds comments in 6 files: 1 helper. Every comment there always stays. The page says `I found nothing to change.`, and the run ends with nothing written.

Files in this skill

  • README.md6.3 KB
  • SKILL.md10.2 KB
  • agents/comment-judge.md1.6 KB
  • agents/copy-judge.md2.1 KB
  • agents/hack-judge.md2.5 KB
  • agents/openai.yaml186 B
  • agents/unused-judge.md2.3 KB
  • scripts/copies.py2.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.