knip

knip is a cursor rule for Cursor from louisbrulenaudet/monorepo-template. It costs 0 tokens per session (1,389 once invoked), scanned A, original, Apache-2.0.

A policy for Knip, a tool that finds unused files, exports, and dependencies in JavaScript and TypeScript projects. It explains why the repository has specific exceptions and how both normal and production checks must pass.

In plain words
What is it for?
Use it when changing Knip configuration, adding dependencies or exports, or investigating unused-code failures in workspace packages.
Why use it?
It catches dead code and stale configuration without incorrectly flagging development-only tools or test support files.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when changing Knip configuration, adding dependencies or exports, or investigating unused-code failures in workspace packages.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/louisbrulenaudet/monorepo-template/knip
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/louisbrulenaudet/monorepo-template

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for knip

README.md
[![agentmods](https://agentmods.dev/badge/rules/louisbrulenaudet/monorepo-template/knip/github.svg)](https://agentmods.dev/rules/louisbrulenaudet/monorepo-template/knip)
Your own site
<a href="https://agentmods.dev/rules/louisbrulenaudet/monorepo-template/knip"><img src="https://agentmods.dev/badge/rules/louisbrulenaudet/monorepo-template/knip/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for knip

Your own site · 80×15
<a href="https://agentmods.dev/rules/louisbrulenaudet/monorepo-template/knip"><img src="https://agentmods.dev/badge/rules/louisbrulenaudet/monorepo-template/knip.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,389 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01389
Opus 5.5 $0.00000 $0.00556
Sonnet 5.5 $0.00000 $0.00278
Haiku 4.5 $0.00000 $0.00139

Measured 1mo ago against content hash a7f72fc7d951, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

knip scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/quality/knip.mdc · 33 lines

How it starts

The opening of the file, as written. The whole thing — 33 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Knip Configuration & Policy

Root knip.jsonc is intentionally comment-free; every override's rationale lives here.

Policy

  • Diagnostic, never a gate: neither CI nor pnpm run ci runs Knip. The PR Code quality comment diffs both passes against the base - pnpm knip (default) and pnpm knip:production (--production --strict: shipped code only, workspace isolation) - so a change sees only what it adds or resolves (quality-report.mdc); run them locally for the whole repo.
  • Never blanket-ignore. Prefer scoped patterns: ignoreIssues, ignoreFiles, production-only suffixes ("dep!", "!pattern!").
  • An export kept solely for unit tests carries a bare JSDoc @internal tag (production mode ignores tagged exports, so tests never mask dead shipped API); the tag is the whole reason, no prose restating "exported for tests". It is the last resort: the authoring gate in testing.mdc tests through the real entry first.
  • Auto-fix unused dependencies and catalog entries with knip --fix --fix-type dependencies,catalog; agent-readable output: pnpm knip:agent (--reporter symbols). After --fix, review the diff, run pnpm install (the fix edits manifests, not the lockfile, so --frozen-lockfile would fail), then pnpm run check.
  • Generated files resolve cleanly today (routeTree.gen.ts; .cloudflare/** is gitignored, and Knip skips gitignored files). If one ever false-positives, use a scoped ignoreIssues, never a blanket ignore.

Root options

  • includeEntryExports: true: every workspace is private, so entry and barrel files (packages/*/src/index.ts) get full unused-export auditing.
  • treatConfigHintsAsErrors: true: a stale or redundant override (e.g. an entry a plugin now provides) makes pnpm knip exit 1 instead of rotting silently.

Workspace overrides

  • Both app keys (apps/front-*, apps/!(front-*)): entry: ["cloudflare.config.ts"] - cf, the Vite plugin, and the Vitest plugin load it by convention and nothing imports it, so no Knip plugin knows it. includeEntryExports: false - an app's entry exports are consumed where Knip cannot see (the config's default export by cf and the Vite plugin, the Worker entrypoint's by the runtime); the Wrangler plugin's exemption for main exports went away with the Wrangler config.
  • apps/front-*: ignoreDependencies entries suffixed ! apply in production mode only - @tanstack/*-devtools (imported by AppDevtools.tsx, lazy-loaded behind import.meta.env.DEV, a conditional Knip's static graph cannot evaluate) and tailwindcss (consumed through @tailwindcss/vite and @import "tailwindcss"). project replicates the default glob plus production-only negations ("!tests/helpers/**!", "!vitest.setup.ts!"), so test infrastructure is never flagged as unused shipped code; not ignore or ignoreFiles, which rejects the ! suffix here.
  • apps/!(front-*): every non-SPA app (worker-* today; queue-* / webhook-* / mcp-* later). A negation, not a prefix list, because treatConfigHintsAsErrors makes a key that matches nothing a hard error, so future prefixes cannot be declared ahead of time. ignoreDependencies: ["cloudflare"]: cloudflare:workers in pool tests is a runtime protocol specifier, not an npm package.
  • Root ".": project excludes .agents/** (vendored skills from skills-lock.json; the Vitest plugin's default glob would make their *.test.cjs entries), in both forms - "!.agents/**" for the default pass and "!.agents/**!" for production mode, which reads only !-suffixed patterns. The restated default glob must keep css (the Tailwind plugin compiles it) or treatConfigHintsAsErrors fails on a compiled-extension hint. Not ignore / ignoreFiles: both still analyze the files. Same boundary as ignorePatterns in .oxlintrc.json.
  • Root ignoreDependencies (both passes): wrangler - kept only for the Wrangler-only commands (tail, secret put, preview secret put) run through pnpm exec wrangler from scripts and by hand, which Knip does not read; skills - the pinned skills CLI, run only as pnpm exec skills inside .agents/skills/skills-update/scripts/*.sh, which Knip does not parse; @vitest/ui - launched as a CLI by the DevTools Vitest dock, never imported, and the root has no Vitest config for Knip's plugin to bind to. It is a root devDependency on purpose: an app-local install fails the DevTools Vitest dock with VTDT0001, so never move it into an app (vite-config.mdc).
  • Root ignoreBinaries: ["changeset!"] (production mode only): .github/actions/**/*.mjs are production entries, and changesets/lib.mjs spawns the changeset CLI of the root devDependency @changesets/cli. Production mode counts only dependencies, but those scripts run in CI after a full install, so the finding is a false positive there; the default pass still resolves the binary.
  • packages/vitest-config: ignoreFiles: ["src/package-root.d.ts"] (sidecar declarations for package-root.js; unlike ignore, the file stays analyzed for exports, types, and unresolved imports); root ignoreWorkspaces: ["packages/vitest-config!"] (production mode only - build/test-time helper, never shipped).

Read the full file on GitHub · 33 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed a7f72fc7d951
  2. 1mo ago Changed d8fd5b9cd472
  3. 1mo ago Changed bbcf975315f8
  4. 2mo ago Changed · +1 lines 1a4004eaceb3
  5. 2mo ago Changed · -17 lines 7d3364065bc2
  6. 2mo ago Changed 1dca688c3466
  7. 2mo ago Changed · +1 lines da9d18ba73b8
  8. 2mo ago First seen · 48 lines · 0 tokens per session scan A 6399377429f2

Subscribe to this mod's changes

knip is a cursor rule published in the GitHub repository louisbrulenaudet/monorepo-template (19 stars, last pushed 8d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,389 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

knip compared with cursor rules from other repositories

knip next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
kniplouisbrulenaudet/monorepo-templateCursor rule198d agoApache-2.0A0Cursor
reviewJkudjo/oh-my-cursorCursor rule117d agoMITA16Cursor
analyzeJkudjo/oh-my-cursorCursor rule117d agoMITA14Cursor
pr-reviewsteipete/agent-rulesCursor rule5.7k7mo agoMITA518Cursor
code-analysissteipete/agent-rulesCursor rule5.7k7mo agoMITA245Cursor
general_clean_code_principlesnphausg/ai-agent-skillsCursor rule24mo agoApache-2.0A6Cursor
optimize-dry-solid-principles-cursorrules-prompt-fPatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A150Cursor