monorepo-template / quality
Cursor rule18 starsChanged 2 months agoApache-2.0View on GitHub
Knip dead-code policy: why each override in root knip.jsonc exists, and how the default and production passes feed the PR code-quality report.
- Reads credentials
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,531 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository60 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .agents/skills/vercel-react-best-practices/AGENTS.mdAGENTS.md
- hooks/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- hooks/CLAUDE.mdCLAUDE.md
- .cursor/rules/backend/hono-gateway.mdcCursor rule
- .cursor/rules/backend/ports.mdcCursor rule
- .cursor/rules/backend/service-bindings.mdcCursor rule
- .cursor/rules/backend/workers-cache.mdcCursor rule
- .cursor/rules/backend/workers-config.mdcCursor rule
- .cursor/rules/contracts/contracts.mdcCursor rule
- .cursor/rules/core/agent-instructions.mdcCursor rule
- .cursor/rules/core/boundaries.mdcCursor rule
- .cursor/rules/core/guardrails.mdcCursor rule
- .cursor/rules/core/turborepo.mdcCursor rule
- .cursor/rules/core/worktrees.mdcCursor rule
- .cursor/rules/frontend/react.mdcCursor rule
- .cursor/rules/frontend/tailwind.mdcCursor rule
- .cursor/rules/frontend/tanstack-query.mdcCursor rule
- .cursor/rules/frontend/tanstack-router.mdcCursor rule
- .cursor/rules/frontend/vite-config.mdcCursor rule
- .cursor/rules/ops/cd.mdcCursor rule
- .cursor/rules/ops/changesets.mdcCursor rule
- .cursor/rules/ops/ci.mdcCursor rule
- .cursor/rules/ops/previews.mdcCursor rule
- .cursor/rules/ops/quality-report.mdcCursor rule
- .cursor/rules/ops/release.mdcCursor rule
- .cursor/rules/quality/code-style.mdcCursor rule
- .cursor/rules/quality/comments.mdcCursor rule
- .cursor/rules/quality/lint-config.mdcCursor rule
- .cursor/rules/quality/markdown-style.mdcCursor rule
- .cursor/rules/quality/naming.mdcCursor rule
- .cursor/rules/quality/simplicity.mdcCursor rule
- .cursor/rules/quality/testing.mdcCursor rule
- .cursor/rules/quality/typescript-config.mdcCursor rule
- .cursor/rules/tests/front-react.mdcCursor rule
- .cursor/rules/tests/hono-workers.mdcCursor rule
- cfSkill
- changesetSkill
- front-vitestSkill
- git-commitSkill
- honoSkill
- monorepo-agent-setupSkill
- playwright-cliSkill
- pnpmSkill
- react-doctorSkill
- reviewSkill
- review-stackSkill
- run-appSkill
- security-auditSkill
- skills-updateSkill
- tanstack-configSkill
- tanstack-devtoolsSkill
- tanstack-querySkill
- tanstack-routerSkill
- turborepoSkill
- ui-ux-design-best-practicesSkill
- vercel-react-best-practicesSkill
- workers-best-practicesSkill
- skills-updateSkill
The file
We split this knip.mdc into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Never blanket-ignore. Prefer scoped patterns: ignoreIssues, ignoreFiles, production-only suffixes ("dep!", "!pattern!").
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
--- description: "Knip dead-code policy: why each override in root knip.jsonc exists, and how the default and production passes feed the PR code-quality report." alwaysApply: false globs: knip.jsonc --- # 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](../ops/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](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`). - 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 delete`, `preview secret put`) run through `pnpm exec wrangler` from scripts and by hand, which Knip does not read; `@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](../frontend/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).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

