monorepo-template / quality
Cursor rule18 starsChanged 59 days agoApache-2.0View on GitHub
Vitest toolchain and testing discipline - two runtimes, no watch for agents, authoring gate, junk patterns.
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,533 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/knip.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/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 testing.mdc into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 14
Run through turbo: pnpm turbo run test --filter=<pkg>.
- Very specific: line 16
No root Vitest config with test.projects or the deprecated workspace: Turbo owns the graph.
- Very specific: line 17
Leave reporters unset so agent / GitHub Actions auto-detection picks the reporter.
- Very specific: line 18
Prefer real pool bindings on Workers.
- Distinctive: line 25
Never weaken source to make a test pass.
- Distinctive: line 30
Before adding or changing a test, answer all four.
≈ “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: "Vitest toolchain and testing discipline - two runtimes, no watch for agents, authoring gate, junk patterns." alwaysApply: false globs: **/*.test.ts,**/tests/**,**/vitest.config.ts,**/vitest.config.mts --- # Testing Runtime specifics: [hono-workers.mdc](../tests/hono-workers.mdc) (Workers pool), [front-react.mdc](../tests/front-react.mdc) (`front-*`). Auditing an existing suite: `/review tests` (human-invoked). ## Toolchain - Tests live in the package's `tests/` directory mirroring the source area, as kebab-case `*.test.ts` (`.tsx` in `front-*`). Import from `"vitest"` (no globals), never `jest.*`; in-app imports use `#/*`, never an invented `@/` alias. - Run through turbo: `pnpm turbo run test --filter=<pkg>`; one file: `pnpm --filter=<pkg> exec vitest run tests/<path>.test.ts`. Package `test` scripts are `vitest run`; agents never leave watch mode or `--ui` running. Turbo caches `test` with no outputs: a hit replays the stored log, `--force` re-executes. Smoke-running the dev servers: skill `run-app`. - Each app owns a `vitest.config.ts` / `.mts` built from `@repo/vitest-config`, pinning `root` / `test.dir` with `resolvePackageRoot(import.meta.dirname)` (Vitest VS Code explorer). Two runtimes: `worker-*` / `queue-*` / `webhook-*` / `mcp-*` → `@repo/vitest-config/workers`; `front-*` → `@repo/vitest-config` (Node). Never the Workers pool or a `/workers` import on `front-*`, never Node pool knobs on Workers, never `isolate: false` / `--no-isolate` on Workers (it shares binding storage). - No root Vitest config with `test.projects` or the deprecated workspace: Turbo owns the graph. Never merge a `front-*` app's full `vite.config` into its Vitest config. - Leave `reporters` unset so agent / GitHub Actions auto-detection picks the reporter; a custom list must still include `agent`. - Prefer real pool bindings on Workers. On Node, mock only true I/O, through `vi.fn` / `vi.stubGlobal` or an injected fake - never module mocking (`vi.mock` & co. are lint errors via `vitest/no-restricted-vi-methods`). - `any` is allowed only in test files (`typescript/no-explicit-any` is relaxed there), never in source to make a test pass. Every other Oxc rule still applies (block statements, no floating promises - `await` or `void`). - Tests are deterministic and never depend on test order. ## What to test - Test at the trust boundaries the app actually enforces today (shared Zod Mini schemas, constrained value sets, CORS / fail-closed responses, route status codes), asserting observable behavior (status, body, headers, binding effects, rendered output) over internals. Never invent auth or idempotency tests for surfaces that do not exist yet. - Never weaken source to make a test pass. - A change to a wire shape or constrained value set updates the tests asserting it in the same change. ## Authoring gate Before adding or changing a test, answer all four; if one has no answer, do not write the test yet. 1. **Contract** - which observable behavior does it protect: a status, body, header, binding effect, rendered output, or a shared `@repo/*` schema or value set? 2. **Regression** - name the smallest source change that is a real bug and makes it fail. If only behavior-preserving changes break it (renaming a class, reordering a map, editing a literal nothing else reads), it asserts implementation: rewrite it against the public entry. 3. **Owner** - why does existing coverage miss that bug? Each contract has one owning test at the strongest boundary that reaches it: the Worker `fetch` entry, the service function, the rendered component, or the `@repo/*` package that defines it. Add a second layer only for a risk the owner cannot reach. Extend an `it.each` table or an existing fixture before writing a near-duplicate. 4. **Seam** - does it need an export, re-export, flag, or reset hook no production code uses? Test through the real entry instead. An `@internal` export ([knip.mdc](knip.mdc)) is the last resort, for behavior the entry cannot reach cheaply (resetting module-level state, say). A regression test must fail on the unfixed code for the reason its name gives: write it before the fix and run it, or revert the fix temporarily to prove the failure. One test at the owning boundary covers the bug; do not replay it at every layer it crosses. ## Junk patterns Reject a test matching one of these unless it names the contract only it guards: - The expected value is copied from the module under test (a label map, class names, a query key, a config literal) or computed by the helper under test. - A stub returns the value the test then asserts, with none of our logic in between. - It would still pass if our code were replaced by the bare library call - it tests React, Hono, Zod, or TanStack, not us. - A consumer re-tests a shared `@repo/*` helper its own package already tests. - The same contract is asserted at two layers with no distinct risk. - A negative assertion passes for an unrelated reason: `not.toBe(403)` also passes on a 500, `not.toBe(evilOrigin)` also passes on `*`. Assert the exact expected value. - The name promises more than the input exercises. - Its only job is keeping a test-only export alive. Assertion-free tests, `.skip` / `.only`, conditional `expect`, truthiness-only matchers, and duplicate titles are already lint errors (`vitest/*` in `.oxlintrc.json`); this section covers what lint cannot see.
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.

