- One AGENTS.md per repo. Half a page is enough — file map, conventions, "do not touch" list. That's your single biggest leverage.
- Composer for fast, Sonnet for default, Opus for hard. Pick per task, not per session.
- Skills > rules for capability-specific guidance. Rules apply every turn; skills load only when relevant.
- Cloud agents for "go away and finish." Background agents for "keep working while I keep typing."
Setup that doesn't backfire.
You don't need 12 hours of setup. You need three things in the right place: an AGENTS.md, the right model in the model picker, and a sane .cursorignore.
# Project — short name ## What this is One-paragraph description of the app and stack. Mention build tool, framework, package manager, deploy target. ## File map - `src/app/` — routes and pages - `src/components/` — shared UI - `src/lib/` — server-side utilities - `tests/e2e/` — Playwright suites ## Conventions - Components use BEM class naming. - No utility CSS frameworks; design tokens live in `src/styles/tokens.css`. - Server actions go in `*.action.ts`, not inside components. - All copy is editable via `src/copy/` JSON files. ## Do not touch - `legacy/` — being decommissioned, do not extend. - `vendor/`, `dist/`, `.next/` — generated. ## Commands - `pnpm dev` — local server - `pnpm test` — full suite - `pnpm lint --fix` — before commit
# build output and bloat dist/ build/ .next/ out/ node_modules/ .turbo/ coverage/ # lockfiles confuse more than they help package-lock.json pnpm-lock.yaml yarn.lock # sensitive .env .env.* *.pem # big binary assets public/**/*.{jpg,png,mp4,webm}
The .cursorignore matters more than it looks. If the agent thinks node_modules/ is fair game it will happily read 500MB looking for an answer.
Pick the right model per task.
Cursor's model picker isn't a "favorite." It's a per-task choice. The Sonnet rule from the cost guide applies: most coding work is happily Sonnet-sized.
| Task | Model | Why |
|---|---|---|
| Tab autocomplete | Composer 2.5 Fast | Latency > intelligence at this scale. |
| "Refactor this function" | Composer 2.5 Fast or Sonnet 4.6 | Composer if the change is local; Sonnet if it touches more than one file. |
| "Build a new component end-to-end" | Sonnet 4.6 | Sweet spot for multi-file work with tool calls. |
| "Why is this test flaking?" | Opus 4.7 or GPT-5.5 | Hard reasoning, often non-obvious; extended thinking pays off. |
| "Plan a full migration" | Opus 4.7 | Long-form planning is what Opus is for. |
| "Generate Playwright tests" | GPT-5.3 Codex | Codex is tuned for long autonomous test-writing runs. |
| "Summarize this codebase" | Gemini 3.1 Pro | 2M context wins when the answer is "read everything." |
Modes worth defining.
Custom modes are saved prompt-plus-tools-plus-model combos you can switch into. The built-in Ask, Agent, and Plan modes cover most work, but four custom modes are worth defining for web dev.
| Mode | System prompt seed | Tools enabled |
|---|---|---|
| Review | "Read-only. Identify bugs, security issues, accessibility violations. Do not edit files." | Read, search, grep. No write/shell. |
| Component Drafting | "Build one component at a time. BEM CSS. Mobile-first. No JS framework imports unless asked." | Read, write, browser MCP. |
| Bug Hunt | "Reproduce first. Write a failing test, then fix. Confirm green, then refactor." | Full stack incl. shell, Playwright MCP. |
| Doc Writer | "Markdown only. Include real code examples. Verify the code runs before claiming it works." | Read, write to docs/ only, shell. |
Tip: the trick with modes is constraining tools, not just the prompt. A read-only Review mode that physically can't write files is more reliable than one with the instruction "don't write files."
Rules vs Skills vs AGENTS.md.
They look similar. They're not. Pick the right shape for the kind of guidance you're encoding.
| Mechanism | Loaded | Use for |
|---|---|---|
| AGENTS.md | Once at session start | Repo orientation: file map, conventions, "do not touch" list. |
| .cursor/rules/*.mdc | Every turn (always-on or globbed) | Hard constraints: "never write inline styles", "always use BEM". |
| .cursor/skills/*.md | On-demand, agent decides | Specialized capabilities: SEO templates, security audit, perf review. |
The 80/20: one AGENTS.md, three or four globbed rules for must-have-every-turn conventions, then a stack of Skills for everything else. We publish a bunch of installable Skills at /skills/ built for this exact pattern.
Every always-on rule adds tokens to every turn. A 2000-token rule run 50 turns/day on Sonnet = 100k tokens/day on input. That's $0.30/day per rule, every day. Use globs to scope rules to relevant files; reserve always-on for truly universal constraints.
Hooks: automation worth automating.
Hooks run on agent events (pre-tool-call, post-edit, on-stop). Three are worth setting up for web dev:
- Format on save — run Prettier after every write so the diff stays clean.
- Lint on agent stop — run
eslint --fixon edited files when the agent finishes a turn. - Test on stop, scoped — run only the tests affected by edited files (use
vitest --related $(git diff --name-only)).
The trap is running too much in hooks. If your post-edit hook takes 12 seconds, the agent stalls 12 seconds every turn. Keep hook output under 2 seconds or move it to a CI step.
MCP servers worth the slot.
Every MCP server you add ships its tool definitions in every prompt. The slot is not free. Five MCPs that pull their weight for web devs:
- Playwright MCP — drive a real browser from the agent. Game-changer for E2E test generation.
- Browser MCP (lightweight) — inspect DOM, take screenshots, debug layout from chat. Cheaper than spinning up Playwright if you just need a snapshot.
- Postgres / SQLite MCP — query your dev database without leaving the editor. Particularly good for "what does this query return?" loops.
- Linear or GitHub MCP — only if you live in one of them. Lets the agent read tickets and update status as work lands.
- Sentry / AppSignal MCP — surface real production errors as context. Pair with the observability section of the deploy guide.
Resist installing every shiny one. Two or three well-used MCPs beat a graveyard of unused ones with their tool descriptions burning context every turn.
Background vs Cloud agents.
Three execution modes, three intents:
| Mode | Runs where | Reach for when |
|---|---|---|
| Local Agent | Your machine, foreground | Pair-programming mode. You're watching, steering turn-by-turn. |
| Background Agent | Your machine, headless | You want to keep coding in the editor while the agent works on a parallel task. |
| Cloud Agent | Cursor's infrastructure | "Spend 45 minutes refactoring this. I'm closing my laptop. Open a PR." |
Cloud agents are surprisingly cheap for what they do — Cursor amortizes the heavy lifting. Use them for: dependency upgrades, deleting dead code across a repo, scaffolding entire test suites, mechanical migrations. Don't use them for taste-heavy work (UI polish, copywriting) — you want to be in the loop for those.
Common pitfalls.
AGENTS.md as a manifestoIf your AGENTS.md is 6 pages of philosophy, the agent's attention dilutes. Aim for half a page. Concrete instructions only. Move long rationale into linked docs.
"Auto" picks a model based on the request shape, but on an unfamiliar codebase it has no signal about complexity. Manually pick Sonnet for the first dozen turns until you've shaped a project rule that helps Auto decide.
15 MCP servers installed, 3 used. Each unused one is still loading its tool definitions every turn. Audit quarterly; remove anything you haven't invoked in a month.