Review Knip
Review the Knip setup for alignment with current official best practices - unused file/export/dependency detection accuracy across workspaces, false-positive suppression discipline, and the agent-facing symbols reporter. Your reply must be a plan of suggested changes: concise, actionable, structured - not only prose.
Invocation
Text after the slash command is additional scope/focus (e.g. "production pass only", "workspace overrides") - narrow the review accordingly.
Ground truth (mandatory)
Your pre-trained knowledge of Knip may be outdated (frequent releases; plugin and issue-type surface evolves). Do not draft suggestions from memory alone.
- Resolve "Knip" via the Context7 MCP (
resolve-library-id → query-docs) at the installed major: config schema (workspaces, ignoreIssues, includeEntryExports), issue types, plugin detection (Vite/Vitest/Turbo/Cloudflare), reporters, --fix/--fix-type behavior.
- For anything Context7 lacks, use Firecrawl search/scrape restricted to the official domain (
knip.dev) - configuration reference, issue-type docs, release notes for breaking changes.
- Version currency: catalog
knip in pnpm-workspace.yaml vs latest stable; flag deprecated config keys or removed issue types still present.
- Cite the retrieved source next to every finding; label anything unverifiable as Unverified.
Scope artifacts
- knip.jsonc - workspace entries,
treatConfigHintsAsErrors, includeEntryExports, per-workspace overrides
- Root scripts in package.json:
knip, knip:production (--production --strict), knip:agent (--reporter symbols)
- Gate position inside
pnpm run ci; JSDoc @internal tagging convention for test-only exports
- Knip policy docs:
.claude/rules/quality/knip.md ↔ .cursor/rules/quality/knip.mdc
Analysis axes
- Coverage: both the default and production passes stay green; entry points/plugins detected correctly for Vite/Vitest/Turbo/Wrangler surfaces; no whole-workspace
ignoreWorkspaces masking real debt (current packages/vitest-config! entry should carry a justification).
- Suppression discipline: no blanket
ignore; scoped patterns only (ignoreIssues, suffixed patterns like "dep!"/"!tests/**!"); every override traceable to a reason; treatConfigHintsAsErrors keeps config honest.
- Production pass:
--production --strict reflects shipped-code reality (dev-only deps like devtools excluded deliberately); workspace isolation verified.
- Fix workflow:
knip --fix --fix-type dependencies,catalog safe for agents to run; results verified by reinstall + gates.
- Version currency: new issue types/plugins worth adopting; renamed options migrated.
DX & AI-agentic workflow
Verify agent-friendliness: pnpm knip:agent emits one machine-readable line per unused symbol - confirm output shape matches current reporter contract and that agent docs reference it; findings actionable without human interpretation.
Steps
- Collect ground truth before reading config.
- Read knip.jsonc; run all three passes once (
pnpm knip, pnpm knip:production, sample pnpm knip:agent) to confirm green and capture real output shapes.
- Walk each analysis axis; note findings or explicit one-line "no issues".
- Compose the plan grouped Critical / Improvements / Optional with what, where, why, and source citations.
Output format
- Critical - gates failing, masked dead code shipping in production builds.
- Improvements - suppression/config alignment with current guidance.
- Optional - nice-to-haves; prefix pure polish with Nit:.
Read-only review: produce the plan only; implement nothing unless explicitly asked afterwards.
1---2name: review-knip3description: Knip review (knip.jsonc passes, issue coverage, production pass, auto-fix workflow) against current official Knip best practices. USE WHEN: user runs /review-knip or explicitly asks for this review. DO NOT USE WHEN: reviewing app code, other dev dependencies, or implementing features.4---56# Review Knip78Review the Knip setup for alignment with current official best practices - unused file/export/dependency detection accuracy across workspaces, false-positive suppression discipline, and the agent-facing symbols reporter. Your reply must be a **plan of suggested changes**: concise, actionable, structured - not only prose.910## Invocation1112Text after the slash command is additional scope/focus (e.g. "production pass only", "workspace overrides") - narrow the review accordingly.1314## Ground truth (mandatory)1516Your pre-trained knowledge of Knip may be outdated (frequent releases; plugin and issue-type surface evolves). **Do not draft suggestions from memory alone.**17181. Resolve "Knip" via the **Context7 MCP** (`resolve-library-id` → `query-docs`) at the installed major: config schema (`workspaces`, `ignoreIssues`, `includeEntryExports`), issue types, plugin detection (Vite/Vitest/Turbo/Cloudflare), reporters, `--fix`/`--fix-type` behavior.192. For anything Context7 lacks, use **Firecrawl search/scrape restricted to the official domain** (`knip.dev`) - configuration reference, issue-type docs, release notes for breaking changes.203. Version currency: catalog `knip` in [pnpm-workspace.yaml](../../../pnpm-workspace.yaml) vs latest stable; flag deprecated config keys or removed issue types still present.214. Cite the retrieved source next to every finding; label anything unverifiable as **Unverified**.2223## Scope artifacts2425- [knip.jsonc](../../../knip.jsonc) - workspace entries, `treatConfigHintsAsErrors`, `includeEntryExports`, per-workspace overrides26- Root scripts in [package.json](../../../package.json): `knip`, `knip:production` (`--production --strict`), `knip:agent` (`--reporter symbols`)27- Gate position inside `pnpm run ci`; JSDoc `@internal` tagging convention for test-only exports28- Knip policy docs: `.claude/rules/quality/knip.md` ↔ `.cursor/rules/quality/knip.mdc`2930## Analysis axes3132- **Coverage**: both the default and production passes stay green; entry points/plugins detected correctly for Vite/Vitest/Turbo/Wrangler surfaces; no whole-workspace `ignoreWorkspaces` masking real debt (current `packages/vitest-config!` entry should carry a justification).33- **Suppression discipline**: no blanket `ignore`; scoped patterns only (`ignoreIssues`, suffixed patterns like `"dep!"`/`"!tests/**!"`); every override traceable to a reason; `treatConfigHintsAsErrors` keeps config honest.34- **Production pass**: `--production --strict` reflects shipped-code reality (dev-only deps like devtools excluded deliberately); workspace isolation verified.35- **Fix workflow**: `knip --fix --fix-type dependencies,catalog` safe for agents to run; results verified by reinstall + gates.36- **Version currency**: new issue types/plugins worth adopting; renamed options migrated.3738## DX & AI-agentic workflow3940Verify agent-friendliness: `pnpm knip:agent` emits one machine-readable line per unused symbol - confirm output shape matches current reporter contract and that agent docs reference it; findings actionable without human interpretation.4142## Steps43441. Collect ground truth before reading config.452. Read knip.jsonc; run all three passes once (`pnpm knip`, `pnpm knip:production`, sample `pnpm knip:agent`) to confirm green and capture real output shapes.463. Walk each analysis axis; note findings or explicit one-line "no issues".474. Compose the plan grouped Critical / Improvements / Optional with **what**, **where**, **why**, and source citations.4849## Output format50511. **Critical** - gates failing, masked dead code shipping in production builds.522. **Improvements** - suppression/config alignment with current guidance.533. **Optional** - nice-to-haves; prefix pure polish with **Nit:**.5455Read-only review: produce the plan only; implement nothing unless explicitly asked afterwards.