Fix knip unused exports
Skill zacharygcook/agent-skills/skills/fix-knip-unused-exports
A curated collection of practical, evidence-backed skills for coding agents.
npx -y skills add zacharygcook/agent-skills --skill fix-knip-unused-exportsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 26 days oldThe repository was created 26 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 2 stars2 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.
What its author says it does
Copied from the file, not written here
Resolve Knip unused-export findings by classifying each symbol before editing and preferring dead-code deletion, local visibility, or deliberate package contracts over suppression. Use for unused exports, exported types, barrel re-exports, test-only exports, and apparent false positives.
SKILL.md
2.1 KB, as published. Nobody here has run it
Fix Knip Unused Exports
Unused-export reports are small but easy to “fix” incorrectly. Search the whole repository, classify the contract, then make the smallest truthful change.
Workflow
- Run the repository's Knip command from its expected root.
- Search each symbol globally and separately outside tests.
- Inspect package entry points, export maps, generated imports, and dynamic consumers.
- Classify the finding.
- Apply the preferred fix.
- Rerun Knip plus focused typecheck, lint, and tests.
Classification
| Category | Evidence | Preferred fix |
|---|---|---|
| Internally used | Referenced only in its defining module | Remove export |
| Dead code | No real caller | Delete it and newly orphaned helpers |
| Dead barrel entry | Re-exported but not consumed | Remove the re-export |
| Test-only seam | Export exists only for tests | Test public behavior or extract a genuinely shared helper |
| Real consumer | Production/generated/dynamic consumer exists | Correct Knip entry/config/export metadata |
Do not add broad ignores, dummy imports, speculative barrel exports, or @public comments solely to silence the tool.
Contract Checks
Before removing a package export, inspect:
package.jsonexports and types;- workspace consumers and build scripts;
- framework conventions for discovered files;
- code generation and dynamic import strings;
- documentation examples that form a supported API.
When deleting a value, remove stale tests, imports, docs, and adjacent helpers only after confirming they have no independent use. Preserve intentional public APIs even when the current monorepo has no internal consumer; document that decision in Knip configuration narrowly.
Handoff
Report each classification, the change made, any intentional suppression, and validation results.