Skip to main content
skill CX Codex

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

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Factory-AI/factory-plugins --skill fix-knip-unused-exports -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/fix-knip-unused-exports/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/fix-knip-unused-exports/

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.

Similar skills

All skills for Code review and refactoring →

From the same set17

The whole set →
security-review security-review scans code changes for security flaws using STRIDE threat modeling, validates exploitability, and outputs structured reports for downstream patching. CX Codex +1 168installs visual-design visual-design is a Claude Code skill that uses nanobanana CLI to create or edit project visuals and Slidev to build presentations. It covers asset, diagram, photo-editing, and slide-deck requests. CX Codex +1 167installs threat-model-generation threat-model-generation — a skill for Claude Code, Codex, Cursor, and other agents that builds a STRIDE threat model from a repository's codebase. CX Codex +1 151installs ban-type-assertions ban-type-assertions is a Claude Code skill that blocks TypeScript as assertions and guides their replacement with compiler-checked code. It runs when a package adopts the ban or needs existing lint violations fixed. CX Codex +1 151installs skill-creation skill-creation converts past session breakthroughs into reusable agent skills inside SKILL.md files. Helps extract repeatable patterns and refine existing instructions. CX Codex +1 142installs autoresearch The autoresearch skill runs repeated code experiments against a measurable target. Use it for tuning tests, builds, bundle size, or ML training results. CX Codex +1 137installs vulnerability-validation vulnerability-validation is a Claude Code skill that tests whether security scan findings can be exploited and filters false alarms. It runs after commit-security-scan, before findings become issues or block a PR. CX Codex +1 135installs commit-security-scan The commit-security-scan skill reviews Git changes for security flaws using threat-model context. Use it for pull requests, staged files, or branch diffs. CX Codex +1 126installs

Project sponsors

Companies that keep this analytics open