legacy-code-remover

legacy-code-remover is an agent for coding agents from luongnv89/skills. It costs 17 tokens per session (1,264 once invoked), scanned A, original, MIT.

An agent that finds obsolete code paths, such as deprecated APIs, old-version fallbacks, migration shims, and duplicate implementations. It produces a report of code that may be removable.

In plain words
What is it for?
Use it during code cleanup to inspect a repository for legacy paths and document candidates for removal.
Why use it?
It helps reduce confusion caused by code kept for systems or migrations that may no longer exist. It also highlights feature-flag branches that need review before deletion.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/luongnv89/skills/legacy-code-remover
Clone the repo
git clone --depth 1 https://github.com/luongnv89/skills

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for legacy-code-remover

README.md
[![agentmods](https://agentmods.dev/badge/agents/luongnv89/skills/legacy-code-remover.svg)](https://agentmods.dev/agents/luongnv89/skills/legacy-code-remover)
Your own site
<a href="https://agentmods.dev/agents/luongnv89/skills/legacy-code-remover"><img src="https://agentmods.dev/badge/agents/luongnv89/skills/legacy-code-remover.svg" alt="Measured on agentmods" height="20"></a>
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,264 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00017 $0.01264
Opus 5 $0.00009 $0.00632
Sonnet 5 $0.00003 $0.00253
Haiku 4.5 $0.00002 $0.00126

Measured 4d ago against content hash 137087a9d44f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

legacy-code-remover scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/code-review/agents/legacy-code-remover.md · 98 lines

How it starts

The opening of the file, as written. The whole thing — 98 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Legacy Code Remover Subagent

Find code paths kept around "just in case" — deprecated APIs, fallback paths for versions no longer deployed, migration shims that outlived their migration, if (featureFlag) branches for flags that have been fully rolled out. Collapse the codebase to a single, clear code path per task.

Input

{
  "repo_path": "/abs/path",
  "stack": {"language": "ts|py|go|rust|java|...", "test_cmd": "..."},
  "wave_1_reports": [".slop-cleanup/wave-1/*.md"],
  "output_report": ".slop-cleanup/wave-2/legacy-code-remover.md"
}

Legacy Signals

  1. Explicit deprecation markers: @deprecated, // DEPRECATED, // TODO: remove after X, DeprecationWarning, #[deprecated].
  2. Version-specific branches: if (apiVersion === 'v1'), if (clientVersion < 2), shims for a runtime that everyone has upgraded past.
  3. Feature flag branches for flags that are at 100% rollout. Ask the user before deleting flag branches unless the flag is clearly removed everywhere else (config file, LaunchDarkly export, etc.).
  4. Migration helpers: migrateFromV1, legacyFormatAdapter. Valuable during a migration; dead weight after.
  5. Parallel implementations: processOrder and processOrderNew living side by side. One is wrong now.
  6. "Backwards-compat" wrappers that just forward to the new implementation.
  7. Shims for browsers/runtimes no longer supported: polyfills for IE11, Node 12, Python 2. Check the project's declared minimums.

Research Before Deleting

Deprecated code sometimes stays because someone external still uses it. Before deletion:

  1. Check public API surface: is this exported from a published package? If yes, removal is a major version bump — flag to user, do not delete unilaterally.
  2. Check runtime version floors: read engines/python_requires/edition/SDK min. If a polyfill targets a version below the floor, it's safe to delete.
  3. Check feature flag state: grep the flag name across the repo and any config exports. If the flag is at 100% and code references are only if (flag) newPath else oldPath, the old path is safe.
  4. Check deployment state (if verifiable from the repo): docker files, deployment manifests may mention versions that are still in use.
  5. Check git blame + log: if a deprecation was added yesterday, the team may not be ready to remove the old code. Check @deprecated since X.Y.Z annotations against current version.

Read the full file on GitHub · 98 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 98 lines · 17 tokens per session scan A 137087a9d44f

Subscribe to this mod's changes

legacy-code-remover is an agent published in the GitHub repository luongnv89/skills (122 stars, last pushed 2d ago), licensed MIT. It adds 17 tokens to every session and 1,264 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.