/ekosistem-edho-ferdian:dead-code-cleanup-edho-ferdianfrom ekosistem-edho-ferdian
Removes dead code safely using stack-specific tools (knip, vulture, cargo-udeps), ranks by risk, and deletes dependencies, exports, files, and duplicates in staged, test-verified commits.
Ships in ekosistem-edho-ferdian. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are a refactoring specialist who deletes code, not one who merely flags it. Every deletion is staged, verified, and revertable on its own — never bundled into a pass that also does something else.
code-review-edho-ferdian's CQ-07 (Dead code) is a read-only review
check: it reports "this looks unused" as one line in a findings report and
stops there — no deletion, no verification loop, no staged batches. This
skill is the opposite half: it is what you run after CQ-07 (or your own
suspicion, or a scheduled cleanup) tells you dead code exists and you want it
actually gone, safely, in a codebase you may not have written yourself.
If the user just wants to know what's unused, point them at
code-review-edho-ferdian. If they want it removed, use this skill.
This skill's Phase 1-3 risk classification (SAFE/CAREFUL/RISKY) and its
"one cleanup pass = one isolatable, revertable unit of work, never mixed
with unrelated changes" rule (Global rule 5) are this ecosystem's general
surgical-changes default (skill-authoring-edho-ferdian §10) sharpened for
the deletion moment specifically: touch only the categories being cleaned
in this pass, never fold in an unrelated fix or improvement spotted along
the way. Full contract: skill-authoring-edho-ferdian §10.
references/worked-example.md — a knip run classified by risk and removed in three verified commits; vulture and jscpd equivalents. Read it when doing the work, not before routing.
| You say | What it does | Parameters it uses |
|---|---|---|
| "bersihkan kode mati di repo ini" | Phases 0-4, all four categories in fixed order | categories, test command |
| "hapus dependency yang tidak dipakai" | category 1 only, then a test run and a commit | categories = dependencies |
| "cleanup unused exports" | category 2; a published library's exports stay CAREFUL | categories, published package |
| "consolidate duplicates" | category 4, last because it changes call sites | categories |
| "remove dead code di service Python" | the Python tooling (vulture, deptry) | stack |
| Parameter | Required | Allowed values | Default |
|---|---|---|---|
categories | optional | dependencies, exports, files, duplicates | all four, always in that order, one commit each |
stack | optional | JS/TS, Python, Go, Rust, other | detected from the manifest, not asked |
test command | yes in practice | a runnable suite (npm test, pytest, go test, cargo test) | probed in Phase 0; with none, only unused dependencies go, after your confirmation |
published package | optional | yes or no | no; yes makes every export CAREFUL at minimum |
override | optional | remove a RISKY item after seeing the reason | off: RISKY items are reported, not removed |
Output: the Phase 4 report (removed per category with counts, items the Salak
check downgraded, CAREFUL/RISKY left alone, test status after each category)
and one revertable commit per category. Example: references/worked-example.md.
When the work reaches one of these, load that skill with the Skill tool and follow it — don't write its part from memory.
test-authoring-edho-ferdianbuild-fix-edho-ferdiancode-review-edho-ferdianskill-authoring-edho-ferdian §7.Phase 0 Stack detection & tool probe → references/detection-and-classification.md
Phase 1 Run detection tools, classify hits → references/detection-and-classification.md
Phase 2 Salak cross-check (the differentiator) → references/salak-cross-check.md
Phase 3 Staged removal + verification loop → references/removal-and-verification.md
Phase 4 Report + isolatable commit
Same stack-detection idea as the rest of this ecosystem's skills: read the repo's manifest file(s) to pick the right tooling automatically, don't ask.
package.json present → JS/TS stack → knip, depcheck, ts-prune, eslint
--report-unused-disable-directives.pyproject.toml / requirements.txt → Python stack → vulture, deptry,
unimport.go.mod → Go stack → deadcode, unused (staticcheck U1000).Cargo.toml → Rust stack → cargo-udeps, cargo-machete.references/detection-and-classification.md §1 for the full table);
if genuinely nothing applies, fall back to a scoped grep/Salak-only pass
and say so explicitly rather than silently skipping detection.Also probe: is there a test suite runnable right now (npm test, pytest,
go test, cargo test, ...)? This gates Phase 3 — cleanup without a
runnable test suite is materially riskier; if none exists, say so up front
and get explicit confirmation before removing anything beyond the most
obviously SAFE category (unused dependencies).
Also probe (silent, same pattern as dev-kickoff-edho-ferdian): is salak
installed? See Phase 2 — detect, defer, never require.
Run the stack's detection tools (in parallel where independent). Every hit
gets one of three risk labels before anything is touched — full definitions,
examples, and the detection commands table are in
references/detection-and-classification.md:
import(variableName), a route table built from a config string, a
reflection/DI lookup by name), where static tools structurally cannot see
the reference.A tool's "unused" verdict is a hypothesis, not a verdict — Phase 2 degrades or confirms it against ground truth before it's actionable.
This is what makes this skill materially better than running knip alone.
Static-heuristic tools alone have a known failure mode: they miss dynamic
usage (string-based imports, reflection, DI containers) and can over-report
symbols that look unused syntactically but have an inbound edge the tool's
AST walk didn't model.
If Salak (salak) is installed, every candidate must be cross-checked
against Salak's reverse-dependency data (salak query importers) before it
is deleted —
full procedure, exit-code contract, and the downgrade rule in
references/salak-cross-check.md. In short:
depends_on/imports edge is a false positive — downgrade
from SAFE to at least CAREFUL, or skip it outright.dev-kickoff-edho-ferdian/references/salak-integration.md — replicated,
not reinvented, in references/salak-cross-check.md.Hard rule: never delete in the same commit/pass as an unrelated change. A cleanup pass must be isolatable and revertable on its own — if the user asks for a feature change and a cleanup together, do the cleanup as its own commit(s) before or after the feature work, never interleaved.
Remove in this fixed order, one category at a time, running the test suite after each category — not just once at the end, so a regression is caught at the smallest possible blast radius:
Only SAFE (and Salak-confirmed) items proceed without extra confirmation. CAREFUL items get called out to the user before removal, with the specific reason they're not SAFE. RISKY items are reported, not removed, unless the user explicitly overrides after seeing the reasoning.
Full safety checklist, per-batch commit message format, and the "when NOT to
run this skill at all" list (active feature development, right before a
deploy, no test coverage, code you don't understand) are in
references/removal-and-verification.md.
Before removing anything currently classified SAFE, ask explicitly:
"Would removing this break a caller that isn't in this codebase — a published package's public API, a documented extension point, a webhook handler an external service calls by convention/name?"
If the code is a library's public surface (this repo publishes a package
others import/require), treat every export as CAREFUL minimum, never
SAFE — a zero-in-repo-reference export of a published library is exactly
the case static tools and even Salak's in-repo graph cannot rule out, because
the caller lives in someone else's repo.
After the last category, report to the user (Bahasa Indonesia for the narrative, English for identifiers/paths):
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Knip, Python, Rust, Go, JavaScript, TypeScript
npx claudepluginhub edhoferdian/eef --plugin ekosistem-edho-ferdian43 skills in this plugin
/api-design-edho-ferdianDesign and evolve API contracts: REST resource naming, status codes, pagination, versioning, and one authoritative OpenAPI/schema so client and server never drift. Use for "desain API untuk fitur ini", "struktur endpoint yang baik", "API contract berubah", "REST vs apa", or a new API surface./ask-eefEntry point to the EEF skills: reads the request and the project, then loads the right skill or sequence (dev-kickoff, design-engineering, build-fix, code-review...). Use at the start of a task when no skill is obviously right, or for "ask-eef", "pakai skill apa", "mulai dari mana", "bantu kerjakan ini", "aku mau bikin", "gimana caranya"./backend-engineering-edho-ferdianServer-side code: service layering and ports/adapters, typed errors, retry and circuit breakers, background jobs and queues, structured logging, new integrations; NestJS and Rails guides. Use for "struktur service layer", "error handling di backend", "retry/circuit breaker", "background job", "tambah integrasi baru", "bikin app Rails"./billing-ops-edho-ferdianDiagnose billing incidents (duplicate subscriptions, failed checkout, double charges, broken portal) and verify pricing/entitlement claims against code. Refunds, credits, cancellations need an explicit go-ahead. Use for "pelanggan minta refund", "subscription ganda", "checkout gagal", "kena tagih dua kali", "billing portal rusak"./build-fix-edho-ferdianFix build, compile, dependency and startup failures with a minimal verified diff, never a cast, ts-ignore or disabled check that hides the error; lenses for ~20 stacks. Load it even for one pasted error. Use for "build error", "gagal build", "compile error", "tidak bisa jalan", "fix the build", "dependency conflict", "migration error", or a stack trace./click-path-audit-edho-ferdianTrace each button, toggle or form submit through its full state changes to find handlers that undo each other, async races, stale closures and effects that reset state. Use for "tombolnya gak jalan", "diklik tapi gak ada yang terjadi", "the button does nothing", "state-nya balik lagi", or after refactoring a shared store.Other plugins' skills for the same job