agentsclimarketplace

Dead code elimination

Skill dgabreuu/react-skill-pack/skills/dead-code-elimination

Use when a React + Vite project needs an advisory scan for unreachable modules, unused imports or unreferenced dependencies before a manually reviewed cleanup.From its SKILL.md

Install
npx -y skills add dgabreuu/react-skill-pack --skill dead-code-elimination

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

3.2 KB, 676 tokens by cl100k_base, as published. Nobody here has run it

Dead Code Elimination

Purpose

Find cleanup candidates without automatically removing code. The analysis uses the static module graph, HTML and Vite entries, package.json, dynamic imports, workers, and known glob patterns. Reflection, runtime-generated imports, and external contracts still require human review.

Memory and patterns

Read the local MEMORY.md and follow ../.shared/SKILL-MEMORY-PROTOCOL.md; use node "<skills-root>/.shared/src/memory-cli.js" append ... for actionable results. The utility validates, renumbers, and retains up to 12 entries.

Before making decisions influenced by existing code, follow ../.shared/PATTERN-LEARNING-PROTOCOL.md and query the repository catalog with node "<skills-root>/.shared/src/pattern-learning/pattern-cli.js" query ...; after confirming a new or refined pattern in the code, consolidate it with node "<skills-root>/.shared/src/pattern-learning/pattern-cli.js" upsert ....

Usage

Compatible with React 18/19, Vite 7/8, and Node 22.13+.

node "<skill-dir>/scripts/scan-dead-code.js" \
  --project-dir <project> --format json --dry-run

Output flags and behavior follow the shared CLI contract in ../.shared/README.md.

When not to use

  • The goal is shrinking a measured bundle; use the bundle-optimization skill (tree shaking may already eliminate the code).
  • Findings would be removed without manual confirmation; this skill is advisory and authorizes no automatic removal.

Interpretation

  • high identifies strong local evidence, such as an import whose binding is never read.
  • medium identifies a graph candidate, such as a file that is unreachable from discovered entries.
  • confidence and action: review are required: no finding authorizes automatic removal.
  • peerDependencies, public exports, scripts, configuration files, HTML entries, tests, stories, workers, and polyfills are preserved or treated as roots.
  • A clean result does not prove a bundle improvement; Vite or Rolldown may already remove the code through tree shaking.

Safe process

  1. Run the scanner in JSON mode and preserve the report.
  2. Review each finding against package.json exports, HTML, scripts, aliases, glob patterns, and dynamic loading.
  3. Remove only items confirmed manually.
  4. Run functional tests and a production build.
  5. Compare raw, gzip, and Brotli bytes for the initial entry. Record 0 B when cleanup does not change the artifact.

Limitations

The scanner does not execute vite.config, interpret reflection or complex shadowing, or cover every glob variant. tsconfig.json aliases and common queries are resolved; aliases defined only in Vite, conditional exports, and advanced patterns require manual review. Use Knip, ESLint, or bundler analysis as complementary checks when the project requires coverage beyond the static graph.

Files

  • scripts/scan-dead-code.js: advisory scanner and CLI.
  • checklists/dead-code-checklist.md: manual review.
  • examples/: illustrative examples; they do not authorize removal.

What ships with it: 29 files

21.0 KB alongside SKILL.md, 21 of them executable

checklists/

scripts/

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.