Monorepo agent setup
Canonical layout and sync policy for Cursor and Claude Code in this repo.
Memory layout
| Layer | Claude Code | Cursor |
|---|---|---|
| Global instructions | CLAUDE.md (@AGENTS.md) |
AGENTS.md |
| Path-scoped rules | .claude/rules/ (*.md) |
.cursor/rules/ (*.mdc) |
| Hooks wiring | .claude/settings.json |
.cursor/hooks.json |
| Hook scripts | hooks/ (shared) |
hooks/ (shared) |
| Subagents | .claude/agents/ |
.cursor/agents/ |
| Review workflows | Skills under .agents/skills/review* (symlink) |
Same skills under .agents/skills/review* |
| Dependency-scoped reviews | /review-<dep> skills under .agents/skills/review-<dep>/ (symlink) - one per dev dependency (claude-code, cursor, vite, oxc, typescript, turborepo, pnpm, wrangler, hono, tailwind, vitest, tanstack-router, tanstack-query, react, zod, knip, syncpack) |
Same |
| Deep skills | Symlinks → .agents/skills/ |
.agents/skills/ (source of truth) |
| Nested app guides | CLAUDE.md per app/package |
AGENTS.md per app/package |
- Claude: nested
CLAUDE.mdloads on demand; debug withtail -f hooks/logs/instructions-loaded.log. - Cursor: nested
AGENTS.mdby directory;.mdcrules attach viaglobs/alwaysApply. Debug: Customize → Hooks. - Rule folders (
core,frontend,backend,contracts,quality,tests,ops) organize only; scoping is frontmatter (pathsvsglobs/alwaysApply). - Vite config rule:
.claude/rules/frontend/vite-config.md↔.cursor/rules/frontend/vite-config.mdc-apps/front-*/vite.config.tsonly. - Tailwind rule:
.claude/rules/frontend/tailwind.md↔.cursor/rules/frontend/tailwind.mdc-apps/front-*/src/**/*.{ts,tsx,css},apps/front-*/index.html. - Ports rule:
.claude/rules/backend/ports.md↔.cursor/rules/backend/ports.mdc-wrangler.jsonc, apppackage.json,front-*/vite.config.ts. - TSConfig rule:
.claude/rules/quality/typescript-config.md↔.cursor/rules/quality/typescript-config.mdc-packages/typescript-config/**,**/tsconfig*.json. - Vitest shared-config rule:
.claude/rules/quality/vitest-config.md↔.cursor/rules/quality/vitest-config.mdc-packages/vitest-config/**. - Turbo rule:
.claude/rules/core/turborepo.md↔.cursor/rules/core/turborepo.mdc-**/turbo.json,.github/workflows/**.
See hooks/AGENTS.md for hook authoring. Full layout and sync policy: this skill.
Content taxonomy (what belongs where)
Put instructions in the layer that matches how often agents need them. Path-scoped rules save context; alwaysApply / rules without paths cost the same as root AGENTS.md.
| Layer | Put here | Examples |
|---|---|---|
Root AGENTS.md |
Always-on project map for almost every task | Overview, architecture diagram, worker prefixes, where-to-put, essential pnpm scripts, architecture decision bullets, pointers |
Path-scoped rules (mirrored .cursor / .claude) |
Only when editing matching files | Ports / inspector_port / strictPort, wrangler secrets, contract workflow, oxlint style, TSConfig presets |
Nested app/package AGENTS.md |
Package-local workflows | apps/front-app, worker-api, dtos-common |
| Skills | Deep / on-demand procedures | monorepo-agent-setup, turborepo, hono, review skills |
README.md |
Human-facing docs | Full port registry, copy-from-existing scaffold checklist |
Do not duplicate path-scoped or linter detail in root AGENTS.md. Prefer a one-line pointer to the owning rule, skill, or README.
Sync policy
When changing agent setup, keep both tools in sync:
- Rules: edit both
.cursor/rules/<cat>/<name>.mdcand.claude/rules/<cat>/<name>.md(remap frontmatter: Cursordescription/globs/alwaysApply↔ Claudepaths). - Agents: edit both
.cursor/agents/<name>.mdand.claude/agents/<name>.md(keep product-native keys:model,tools,readonly,color). - Hooks: edit scripts only under
hooks/; update both.cursor/hooks.jsonand.claude/settings.jsonwhen wiring changes. - Skills: install/update under
.agents/skills/+skills-lock.json(when present). Claude entries are symlinks into.agents/skills/(except Cursor-onlyskills-update). Project-owned skills (pnpm,ui-ux-design-best-practices,monorepo-agent-setup,privileged-legal-data,front-vitest,review-*) live once under.agents/skills/. - Review skills: edit
.agents/skills/review*/SKILL.md(self-contained; Claude via symlink). Two families: dimension reviews (review,review-architecture,review-ci,review-code-quality,review-configuration,review-performance,review-security,review-seo,review-ui) and dependency-scoped stack reviews (review-claude-code,review-cursor,review-vite,review-oxc,review-typescript,review-turborepo,review-pnpm,review-wrangler,review-hono,review-tailwind,review-vitest,review-tanstack-router,review-tanstack-query,review-react,review-zod,review-knip,review-syncpack). Both share the same output contract (Critical / Improvements / Optional plan) anddisable-model-invocation: true- human-only. Dependency-scoped skills mandate ground-truth retrieval (Context7 MCP → Firecrawl restricted to official domains → official changelogs) before suggestions; no hard-coded doc URLs, cite sources per finding.review-*andpnpmsetdisable-model-invocation: true, so only a human can run them - they cannot be preloaded into a subagent'sskills:field or invoked through the Skill tool. Keep it that way for the whole-repo review deep dives; do not add it to a skill an agent needs.privileged-legal-datais deliberately model-invocable for exactly that reason: it is the preloadable checklist behindguardrails.md→ "Privileged client data". When adding a security review agent later, preload that skill rather than copying its contents into the agent description.front-vitestis also model-invocable: the thintests/front-reactrule points at it for DOM/RTL/Router harness depth. - MCP: keep
.mcp.jsonand.cursor/mcp.jsonserver lists aligned (type: "http"on HTTP servers). - Nested guides: update
AGENTS.md; keepCLAUDE.mdas@AGENTS.md+ Claude-only bullets.
Agent guides (apps / packages)
| Focus | Guide |
|---|---|
| pnpm workspaces | .agents/skills/pnpm/SKILL.md |
| React SPA | apps/front-app/AGENTS.md |
| HTTP gateway | apps/worker-api/AGENTS.md |
| Zod DTOs | packages/dtos-common/AGENTS.md |
| Shared value sets | packages/enums-common/AGENTS.md |
| TS presets | packages/typescript-config/AGENTS.md |
| Agent hooks | hooks/AGENTS.md |
Inventory (quick)
- Rules: 25 mirrored basenames (only
core/guardrailsalways-on);tests/holds vitest + hono-workers + front-react (DOM/RTL depth in skillfront-vitest);ops/holdsci+cd. Nodrizzle-ormrule until a DB-owning worker lands. - Subagents:
verifier,bundle-analyzer,docs-researcher. - Skills: 25 mirrored basenames plus 17 dependency-scoped
/review-<dep>stack reviews (see Review skills above); deep skills (turborepo,wrangler, TanStack family) consulted as context by their matching review skill. - Cursor hooks:
beforeShellExecution(git guards,failClosed),afterFileEdit(format/lint),sessionStart. - Claude hooks: PreToolUse Bash (same git guards), PostToolUse Edit|Write (format/lint), InstructionsLoaded.
- MCP:
cloudflare-docs,context7(project). Keep the Cursor Cloudflare plugin disabled unless you need account-scoped bindings/builds/observability MCP (those trigger OAuth login); do not double-register Context7 via plugin.