agentleFS
mo-cmykmo-cmyk/mazarbul/.claude/skills/dead/SKILL.md

dead

Skill2 starsChanged 35 days agoApache-2.0View on GitHub

Detect and remove unused code across Go and web. USE WHEN diff is substantive (>30 LoC), after implementing a feature, when /go-strict requests dead-code audit, when Stop hook flags Cleanup-opportunities, or when user asks 'is anything unused' or 'clean up dead code'. Runs `mise run dead` (Go reachability) + `pnpm exec knip` (web unused exports/files/deps) + reports a unified punch list. NOT FOR active development , only after a feature lands.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After a feature lands (>30 LoC) and before opening a PR

    line 13
  2. Very specific:

    When /go-strict reports Cleanup-opportunities

    line 14
  3. Very specific:

    When Stop hook's last-check.md shows unreachable-code warnings

    line 15
  4. Very specific:

    When the user types /dead or asks "anything unused?"

    line 16
  5. Very specific:

    Only after explicit "apply X, Y, Z" from the user.

    line 57
  6. Distinctive:

    Remove "almost dead" code that has one caller in a test file (often legitimate)

    line 64
  7. Distinctive:

    Remove proto-generated unused types (regenerate the proto instead)

    line 65
  8. Very specific:

    Stop hook , writes unreachable-code findings to .claude/last-check.md Cleanup-opportunities

    line 79

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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

/dead , Unified dead-code detection

Detect and report unused code in one pass across both backends. Apply surgical cuts only after user confirmation.

When to invoke

  • After a feature lands (>30 LoC) and before opening a PR
  • When /go-strict reports Cleanup-opportunities
  • When Stop hook's last-check.md shows unreachable-code warnings
  • When the user types /dead or asks "anything unused?"

How it runs

Step 1 , Scope detection

git diff --name-only HEAD

Bucket files:

  • Go changes → run mise run dead (deadcode reachability scan)
  • Web changes under web/ → run pnpm exec knip (unused exports + files + deps)

Skip if neither surface changed.

Step 2 , Run scans in parallel

ToolCommandWhat it finds
deadcodemise run dead (from repo root)Unreachable Go functions/methods
knipcd web && pnpm exec knipUnused exports, files, dependencies, types in TS/TSX

Both are read-only , they only report, never modify.

Step 3 , Report

Unified table:

File                                  | Symbol / Export      | Type      | Recommendation
internal/kernel/navigate/walk.go:142  | listOrphanedEdges    | function  | delete , no callers
web/src/lib/format-priority.ts:1      | (entire file)        | file      | delete , no imports
web/src/components/legacy/old-card.tsx| OldCard             | export    | delete , superseded by Card
go.mod / package.json                 | unused dep: lodash   | dep       | run pnpm rm lodash

Sum the LoC saved estimate. Ask user which cuts to apply.

Step 4 , Apply selected cuts surgically

Only after explicit "apply X, Y, Z" from the user. Each cut is a separate Edit. Verify with go build ./... (for Go) or # (no frontend) (for web) after each batch.

What this skill deliberately does NOT do

  • Apply cuts without user approval
  • Touch generated code (gen/, web/src/gen/)
  • Modify audit log code (append-only, compliance-protected)
  • Remove "almost dead" code that has one caller in a test file (often legitimate)
  • Remove proto-generated unused types (regenerate the proto instead)

Gotchas

  • knip false-positives on Next.js dynamic routes: pages under app/[param]/page.tsx look unused but are entry points. The web/knip.json config lists these as entry:. If knip flags one, check the config first.
  • deadcode misses RPC handlers: methods registered via reflection (MCP tool registration) aren't always reachable from main. Cross-check with grep -r "MethodName" internal/api/ before deleting.
  • init() functions can hide live code: deadcode treats init as a root. If you delete a file with only init-side-effect code, the side effect disappears silently.
  • Tests don't anchor production code: a function only called by _test.go is still considered dead by deadcode. Decide case-by-case , sometimes it's a helper meant for both.
  • knip's --include-entry-exports matters: by default knip won't flag exports from entry files. If a re-export in index.ts is unused, knip needs --include-entry-exports to see it.

Pairs well with

  • /simplify , dead code is one of simplify's 4 audit dimensions
  • /go-strict , invokes /dead inside its auto-iteration loop
  • Stop hook , writes unreachable-code findings to .claude/last-check.md Cleanup-opportunities

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.