agentleFS
jimtinjimtin/production-ai/skills/codebase-prune-review/SKILL.md

codebase-prune-review

Skill1 starsChanged 5 months agoMITView on GitHub

Review an existing codebase for redundant, legacy, dead, superseded, or attack-surface-increasing code paths and guide progressive removal with behavior mapping, test coverage, security review, and validation. Use when asked to remove old providers or integrations, clean redundant code paths, reduce tech debt, reduce attack surface, review dead code, retire obsolete routes, remove stale compatibility layers, or clean up after migrations such as Google Drive uploads to Vercel Blob.

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 5 are distinctive, and 10 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.

  • 10

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill to safely remove obsolete code from an existing repo without losing live functionality.

    line 10
  2. Distinctive:

    Start from current repo truth and live entrypoints.

    line 16
  3. Very specific:

    Do not remove unknown paths until usage is disproven by references, tests, runtime config, logs, or explicit user confirmation.

    line 19
  4. Distinctive:

    Add or update tests before removing a path when current behavior is not already covered.

    line 20
  5. Distinctive:

    Remove one coherent layer at a time and run targeted tests after each layer.

    line 21
  6. Distinctive:

    Keep rollback simple. Do not mix unrelated cleanup, formatting, dependency churn, or feature work into a prune layer.

    line 22
  7. Very specific:

    Use $security-threat-model when removals touch auth, uploads, parsers, webhooks, admin paths, secrets, provider clients, storage, payments, …

    line 23
  8. Very specific:

    Use $test-readiness-preflight before expensive validation and after each removal layer to clear predictable blockers.

    line 24
  9. Very specific:

    Use $feature-design-preflight when the prune follows a provider/platform replacement or migration whose new path still needs requirement …

    line 25
  10. Very specific:

    Baseline the repo: Read instructions, package scripts, deployment config, routes, jobs, API handlers, provider integrations, env examples, …

    line 29
  11. Very specific:

    Remove progressively: Follow references/removal-layers.md.

    line 33
  12. Very specific:

    Validate and report: Run the final local/container gate, dependency audit, containerized repo-scoped gitleaks, and security review when …

    line 34
  13. Very specific:

    Read references/discovery-checklist.md before proposing removal candidates.

    line 53
  14. Very specific:

    Read references/removal-layers.md before editing or deleting code.

    line 54
  15. Very specific:

    Read references/evidence-report.md for the behavior map, removal plan, and completion report format.

    line 55

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Codebase Prune Review

Purpose

Use this skill to safely remove obsolete code from an existing repo without losing live functionality. It audits current behavior, classifies removal candidates, proves test coverage, removes in small layers, and validates after each layer.

This is not a generic refactor pass. The goal is to reduce tech debt and attack surface by retiring code paths that are proven superseded, dead, or no longer part of the live product.

Operating Rules

  • Start from current repo truth and live entrypoints. Prefer code, runtime config, package scripts, deployment config, tests, and workflows over historical docs.
  • Build a behavior and ownership map before deleting anything.
  • Classify each candidate as active, compatibility, superseded, dead, or unknown.
  • Do not remove unknown paths until usage is disproven by references, tests, runtime config, logs, or explicit user confirmation.
  • Add or update tests before removing a path when current behavior is not already covered.
  • Remove one coherent layer at a time and run targeted tests after each layer.
  • Keep rollback simple. Do not mix unrelated cleanup, formatting, dependency churn, or feature work into a prune layer.
  • Use $security-threat-model when removals touch auth, uploads, parsers, webhooks, admin paths, secrets, provider clients, storage, payments, or deployment surfaces.
  • Use $test-readiness-preflight before expensive validation and after each removal layer to clear predictable blockers.
  • Use $feature-design-preflight when the prune follows a provider/platform replacement or migration whose new path still needs requirement tracing.

Workflow

  1. Baseline the repo. Read instructions, package scripts, deployment config, routes, jobs, API handlers, provider integrations, env examples, and tests. Use references/discovery-checklist.md.
  2. Map live behavior. List the functionality that must remain unchanged, the entrypoints that serve it, the providers it depends on, and the tests that prove it.
  3. Classify candidates. Mark each old path as active, compatibility, superseded, dead, or unknown. Record evidence for every classification.
  4. Build the proof plan first. Map each behavior to unit, integration, browser/E2E, visual, migration, security, and local/container validation as applicable. Add missing tests before deletion.
  5. Remove progressively. Follow references/removal-layers.md; remove one coherent layer, then run targeted tests. Update docs, env examples, fixtures, workflows, and dependency manifests as obsolete paths disappear.
  6. Validate and report. Run the final local/container gate, dependency audit, containerized repo-scoped gitleaks, and security review when push/readiness is in scope. Use references/evidence-report.md for the completion report.

Classification Rules

  • active: Used by current production behavior, runtime config, route handling, jobs, tests, or documented release flow. Do not remove.
  • compatibility: Preserved intentionally for migrations, old clients, rollback, data backfills, redirects, or external integrations. Keep unless a retirement plan exists.
  • superseded: Replaced by a newer live path and no longer needed after compatibility obligations are satisfied. Remove in a planned layer.
  • dead: No reachable runtime use, tests, config, imports, scripts, or deployment references. Remove once the evidence is recorded.
  • unknown: Usage cannot be proven or disproven. Keep by default and ask for confirmation only after reasonable repo evidence is exhausted.

Example Requests

  • "Use $codebase-prune-review to remove old Google Drive upload paths now that this repo uses Vercel Blob."
  • "Review this repo for superseded provider code and reduce attack surface."
  • "Find legacy compatibility routes and produce a progressive removal plan with tests."
  • "Clean redundant upload, webhook, and storage code after the migration."

References

  • Read references/discovery-checklist.md before proposing removal candidates.
  • Read references/removal-layers.md before editing or deleting code.
  • Read references/evidence-report.md for the behavior map, removal plan, and completion report format.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.