fix-knip-unused-exports — Claude Code skill: resolve unused exports
fix-knip-unused-exports resolves knip “Unused exports” violations by removing or relocating exports that have no production consumers. Use when npm run knip reports unused code.
no license 147 installs ★ 129 updated 2026-10-25
npx skills add Factory-AI/factory-plugins --skill fix-knip-unused-exports -a claude-codeWhat fix-knip-unused-exports does
When running npm run knip, the tool flags four categories of violations: exports used only in tests (extract to a separate file), re-exports through a barrel index.ts with no consumers (delete from index.ts), exports used only within their own file (drop the export keyword), and completely unused code (remove). The skill classifies each violation by searching the entire repository to find all call sites, then recommends the right fix strategy.
For test-only exports, the skill helps plan safe extraction: determine which helper functions move with the export, check for circular dependency risks, and decide whether constants need a separate file. For dead barrel re-exports, it can suggest adding a subpath export to package.json so tests in other packages still have an import path.
After each fix, run the full verification suite: npm run knip, tests, and type checking. This matters because one fix sometimes exposes a new violation downstream.
What it helps with
- Extract an export that is used only by test files
- Remove a re-export from index.ts when production code imports via relative paths
- Convert an export to a private const if nothing outside the file needs it
- Plan extraction of a function to a new file without introducing circular dependencies
Example prompts for the agent
- npm run knip reported an unused export — help me figure out which category it is and how to fix it
- I need to extract a test-only function into its own file — check the structure and watch for circular imports
- Remove this re-export from index.ts and add a subpath export to package.json if needed
How to install fix-knip-unused-exports
1Skills CLI (Vercel)
npx skills add Factory-AI/factory-plugins --skill fix-knip-unused-exports -a claude-code2Manually: put the files in place
~/.claude/skills/fix-knip-unused-exports/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/fix-knip-unused-exports/
1Skills CLI (Vercel)
npx skills add Factory-AI/factory-plugins --skill fix-knip-unused-exports -a codex2Manually: put the files in place
.agents/skills/fix-knip-unused-exports/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add Factory-AI/factory-plugins --skill fix-knip-unused-exports -a cursor2Manually: put the files in place
.cursor/skills/fix-knip-unused-exports/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install Factory-AI/factory-plugins plugins/typescript/skills/fix-knip-unused-exports2Manually: put the files in place
.github/skills/fix-knip-unused-exports/SKILL.md1Skills CLI (Vercel)
npx skills add Factory-AI/factory-plugins --skill fix-knip-unused-exports -a gemini-cli2Platform CLI
gemini skills install https://github.com/Factory-AI/factory-plugins --path plugins/typescript/skills/fix-knip-unused-exportsManually: put the files in place
.devin/skills/fix-knip-unused-exports/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add Factory-AI/factory-plugins --skill fix-knip-unused-exports -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about fix-knip-unused-exports
How do I install fix-knip-unused-exports in Claude Code?
Run npx skills add Factory-AI/factory-plugins --skill fix-knip-unused-exports -a claude-code. The skill installs to ~/.claude/skills/fix-knip-unused-exports/SKILL.md and becomes available in Claude Code.
What does fix-knip-unused-exports do?
It helps resolve knip violations about unused exports. The skill identifies which category each violation falls into (test-only export, dead barrel re-export, internal-only usage, or dead code), suggests the right fix approach, and helps implement it safely without creating circular imports or breaking other lint rules.
When should I not use this skill?
If the export is actually used by production code in another file, knip may have misconfigured scope or the import path is wrong. The skill won't help diagnose knip config issues; check your knip setup or the import statement instead.