원클릭으로
knip
Run knip to find and remove unused files, dependencies, and exports. Use for cleaning up dead code and unused dependencies.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Run knip to find and remove unused files, dependencies, and exports. Use for cleaning up dead code and unused dependencies.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Build Chrome extensions using WXT framework with TypeScript, React, Vue, or Svelte. Use when creating browser extensions, developing cross-browser add-ons, or working with Chrome Web Store projects. Triggers on phrases like "chrome extension", "browser extension", "WXT framework", "manifest v3", or file patterns like wxt.config.ts.
WXT browser extension performance optimization guidelines. This skill should be used when writing, reviewing, or refactoring WXT browser extension code to ensure optimal performance patterns. Triggers on tasks involving WXT, browser extensions, content scripts, service workers, messaging, and extension APIs.
| name | knip |
| description | Run knip to find and remove unused files, dependencies, and exports. Use for cleaning up dead code and unused dependencies. |
Run knip to find and remove unused files, dependencies, and exports from this codebase.
Check if knip is available:
npx knip --version to testknip is in package.json devDependenciesnpm install -D knip (or pnpm/yarn/bun equivalent based on lockfile present)Knip does NOT remove unused imports/variables inside files — that's a linter's job. Knip finds unused files, dependencies, and exports across the project.
Always follow this configuration-first workflow. Even for simple "run knip" or "clean up codebase" prompts, configure knip properly before acting on reported issues.
knip.json, knip.jsonc, or knip key in package.json)npx knip
Focus on configuration hints before anything else. These appear at the top of the output and suggest config adjustments to reduce false positives.
Fix configuration hints before addressing reported issues. Common adjustments:
Re-run knip after each config change. Repeat until configuration hints are resolved and false positives are minimized.
Once the configuration is settled, work through reported issues. Prioritize in this order:
ignoreExportsUsedInFile (see below)Re-run knip after each batch of fixes. Removing unused files often exposes newly-unused exports and dependencies.
When reviewing or creating a knip config, follow these rules:
ignore patterns — ignore hides real issues and should almost never be used. Always prefer specific solutions. Other ignore* options (like ignoreDependencies, ignoreExportsUsedInFile) are fine because they target specific issue types.ignoreExportsUsedInFile: { interface: true, type: true } — this handles the common case of types only used in the same file. Prefer this over broader ignore options..gitignore, so ignoring node_modules, dist, build, .git is redundant.vite.config.ts) — Enable or disable the corresponding plugin explicitly rather than ignoring the file.buffer, process) — Add to ignoreDependencies.paths to knip config (uses tsconfig.json semantics).Use --production to focus on production code only:
npx knip --production
This excludes test files, config files, and other non-production entry points. Do NOT use project or ignore patterns to exclude test files — use --production instead.
src/index, lib/, or files with "public" or "api" in the nameUse the AskUserQuestion tool to clarify before deleting these.
Once configuration is settled and you're confident in the results:
# Auto-fix safe changes (removes unused exports and dependencies)
npx knip --fix
# Auto-fix including file deletion
npx knip --fix --allow-remove-files
Only use --fix after the configuration-first workflow is complete.
If knip exits with code 2 (unexpected error like "error loading file"):
knip.json in the project root# Basic run
npx knip
# Production only (excludes test/config entry points)
npx knip --production
# Auto-fix what's safe
npx knip --fix
# Auto-fix including file deletion
npx knip --fix --allow-remove-files
# JSON output for parsing
npx knip --reporter json
--workspace flag