con un clic
knip
// 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. Use for cleaning up dead code and unused dependencies.
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction.
Use Sentry MCP to discover, triage, and fix production issues with root-cause analysis. Use when asked to fix Sentry issues, triage production errors, investigate error spikes, or clean up Sentry noise. Requires Sentry MCP server. Triggers on "fix sentry", "triage errors", "production bugs", "sentry issues".
Control the user's currently open Chrome tab through the Playwriter CLI (no new browser launch). Use when you need to inspect live UI state, run scripted browser actions, capture console output, or reproduce frontend issues directly in the user's tab.
Refactor CLAUDE.md files to follow progressive disclosure principles. Use when CLAUDE.md is too long or disorganized.
Workflow orchestration for complex coding tasks. Use for ANY non-trivial task (3+ steps or architectural decisions) to enforce planning, subagent strategy, self-improvement, verification, elegance, and autonomous bug fixing. Triggers: multi-step implementation, bug fixes, refactoring, architectural changes, or any task requiring structured execution.
Guide a user end-to-end through setting up Chrome Web Store API release automation in any repository. Use when asked to walk someone through OAuth/CWS credential setup, refresh token creation, local/CI secret setup, version-based publish automation, and submission status checks.
| 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