agentleFS
louisbrulenaudetlouisbrulenaudet/monorepo-template/.agents/skills/monorepo-agent-setup/SKILL.md

monorepo-agent-setup

Skill18 starsChanged 2 months agoApache-2.0View on GitHub

USE WHEN: editing Cursor/Claude agent config, rules, hooks, skills, MCP, subagents, slash commands, or dual-tree sync; or when asking how Claude vs Cursor instructions are laid out in this monorepo. DO NOT USE WHEN: implementing app features, Workers, or frontend UI unless the task is specifically about agent tooling.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 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.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Put instructions in the layer that matches how often agents need them.

    line 33
  2. Distinctive:

    Do not duplicate path-scoped or linter detail in root AGENTS.md.

    line 43
  3. Distinctive:

    When changing agent setup, keep both tools in sync:

    line 47
  4. Very specific:

    MCP: keep .mcp.json and .cursor/mcp.json server lists aligned (type: "http" on HTTP servers).

    line 54
  5. Very specific:

    Nested guides: update AGENTS.md; keep CLAUDE.md as @AGENTS.md + Claude-only bullets.

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Monorepo agent setup

Canonical layout and sync policy for Cursor and Claude Code in this repo.

Memory layout

LayerClaude CodeCursor
Global instructionsCLAUDE.md (@AGENTS.md)AGENTS.md
Path-scoped rules.claude/rules/ (*.md).cursor/rules/ (*.mdc)
Hooks wiring.claude/settings.json.cursor/hooks.json
Hook scriptshooks/ (shared)hooks/ (shared)
Subagents.claude/agents/.cursor/agents/
Domain reviews/review under .agents/skills/review/ (symlink) - protocol in SKILL.md, reviewer contract in reviewer.md, one file per domain in domains/<id>.mdSame
Stack reviews/review-stack under .agents/skills/review-stack/ (symlink) - protocol in SKILL.md, one companion per dependency in deps/<dep>.mdSame
Deep skillsSymlinks → .agents/skills/.agents/skills/ (source of truth)
Nested app guidesCLAUDE.md per app/packageAGENTS.md per app/package
  • Claude: nested CLAUDE.md loads on demand; debug with tail -f hooks/logs/instructions-loaded.log.
  • Cursor: nested AGENTS.md by directory; .mdc rules attach via globs / alwaysApply. Debug: Customize → Hooks.
  • Rule folders (core, frontend, backend, contracts, quality, tests, ops) organize only; scoping is frontmatter (paths vs globs/alwaysApply).

See hooks/AGENTS.md for hook authoring.

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.

LayerPut hereExamples
Root AGENTS.mdAlways-on project map for almost every taskOverview, worker prefixes, where-to-put, essential pnpm scripts, architecture decision bullets, pointers
Path-scoped rules (mirrored .cursor / .claude)Only when editing matching filesPorts / inspectorPort / strictPort, Worker secrets (bindings.secret()), contract workflow, oxlint style, TSConfig presets
Nested app/package AGENTS.mdPackage-local workflowsapps/front-app, worker-api, dtos-common
SkillsDeep / on-demand proceduresmonorepo-agent-setup, turborepo, hono, review skills
README.mdHuman-facing docsArchitecture diagram, onboarding, scaffold checklist, human-only /review and /review-stack usage

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:

  1. Rules: edit both .cursor/rules/<cat>/<name>.mdc and .claude/rules/<cat>/<name>.md (remap frontmatter: Cursor description/globs/alwaysApply ↔ Claude paths). The agent-facing contract (loading, placement, density, twin rules) is rule core/agent-instructions, which loads whenever a rule, agent, or AGENTS.md is read.
  2. Agents: edit both .cursor/agents/<name>.md and .claude/agents/<name>.md (keep product-native keys: model, tools, readonly, color).
  3. Hooks: edit scripts only under hooks/; update both .cursor/hooks.json and .claude/settings.json when wiring changes.
  4. Skills: install/update under .agents/skills/ + skills-lock.json (when present). Claude entries are symlinks into .agents/skills/ (except Cursor-only skills-update). Project-owned skills (pnpm, ui-ux-design-best-practices, monorepo-agent-setup, front-vitest, run-app, cf, changeset, review, review-stack) live once under .agents/skills/.
  5. Review skills: two skills with the same shape - a protocol in SKILL.md, one reference file per unit whose frontmatter is the registry, one parallel subagent per selected unit, verification in the main thread, one reply with C/I/O/V IDs (/review adds H for hardening) answered by fix / accept. Both run from the main thread (no context: fork, because they fan out), write no files, and set disable-model-invocation: true: only a human can run them, so they cannot be preloaded into a subagent skills: field - reviewers get file paths instead. /review checks our code and design by domain: review/domains/<id>.md (id, summary, model, optional applies_when; body Ground truth, Scope, Probe, Axes, Critical when, Overlaps, Accepted, optional Extra output), the shared contract review/reviewer.md (finding definition, evidence bar, severity, return block), run by the read-only reviewer subagent. /review-stack checks third-party tools against their current docs: review-stack/deps/<dep>.md (id, summary, families, packages, paths), with review-stack/scripts/preflight.mjs resolving selectors (including changed) and printing the version snapshot; it mandates ground-truth retrieval (documentation MCP collector → official domains → changelogs) and cites a source per finding. To cover a new domain or tool, add one file; never a new skill directory or table row. The tests and simplicity domains are the audit halves of rules quality/testing and quality/simplicity, and the security domain reads the vendored security-audit companions by path (never edits them). pnpm also sets disable-model-invocation: true; front-vitest stays model-invocable because the thin tests/front-react rule points at it.
  6. MCP: keep .mcp.json and .cursor/mcp.json server lists aligned (type: "http" on HTTP servers).
  7. Nested guides: update AGENTS.md; keep CLAUDE.md as @AGENTS.md + Claude-only bullets.

Agent guides (apps / packages)

FocusGuide
pnpm workspaces.agents/skills/pnpm/SKILL.md
React SPAapps/front-app/AGENTS.md
HTTP gatewayapps/worker-api/AGENTS.md
Zod DTOspackages/dtos-common/AGENTS.md
Shared value setspackages/enums-common/AGENTS.md
Shared Hono middlewarepackages/hono-middleware/AGENTS.md
TS presetspackages/typescript-config/AGENTS.md
Agent hookshooks/AGENTS.md

Inventory (quick)

  • Rules: mirrored basenames (core/guardrails, quality/comments, and quality/simplicity always-on); tests/ holds hono-workers + front-react (DOM/RTL depth in skill front-vitest), while the general Vitest toolchain and the test value bar live in quality/testing; ops/ holds ci, cd, previews, release, and changesets (writing them; the procedure is skill changeset). No drizzle-orm rule until a DB-owning worker lands.
  • Subagents: explorer, planner, verifier, bundle-analyzer, docs-researcher, reviewer.
  • Skills: mirrored basenames plus the /review domain review (one file per domain) and the /review-stack stack review (one companion per dependency), see Review skills above; deep skills (react-doctor, turborepo, workers-best-practices, TanStack family) and the project skill cf are consulted as context by their matching companion.
  • Cursor hooks: beforeShellExecution (git guards, failClosed), afterFileEdit (format/lint), sessionStart.
  • Claude hooks: PreToolUse Bash (same git guards), PostToolUse Edit|Write (format/lint), InstructionsLoaded.
  • MCP: documentation MCP servers registered in .mcp.json (currently context7 - a library-docs collector - and cloudflare-docs). Keep the Cursor Cloudflare plugin disabled unless you need account-scoped bindings/builds/observability MCP (those trigger OAuth login); do not double-register a documentation collector via plugin.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.