Vibemast rules: 12 rules for AI coding agents

12 AI coding agent rules for Cursor, Claude Code and more

AI coding agents such as Cursor, Claude Code, Copilot and Windsurf all read a rules file before they work on your code. The tools differ, but the rules that help are mostly the same. These 12 AI coding agent rules target the most expensive failure modes: edits to files the agent has not read, invented APIs, huge diffs, fake "done" reports and leaked secrets. Copy them into whichever file your tool reads.

Checked on 28 Oct 2026 against Cursor's rules docs and Claude Code's memory docs.

The 12 rules

# Agent rules

## Before you write code
1. Read the files you are about to change, and the files that import them.
   Do not edit from memory or guesses.
2. For anything bigger than a one-file fix, write a short plan: goal,
   files, order, how you will check it. Wait for "go".
3. If the request is ambiguous, ask one specific question. If you must
   assume, say the assumption.
4. Check the installed version (package.json, lockfile) before you use a
   framework API. The installed version and its docs win over memory.

## Never invent things
5. Do not invent package names, functions, config keys, CLI flags, env
   variables or endpoints. If unsure, look it up and say what you checked.
6. Do not add a dependency when an existing one does the job.

## Keep changes small
7. One task, one focused diff. No unrelated refactors, renames or
   reformatting. Mention cleanups at the end instead.
8. Never delete or rewrite a large block to make an error go away.
   Find the cause.

## Prove it works
9. You are done only when typecheck, lint, tests and build pass. Report
   what you ran, what passed and what you could not check.
10. Never make a test pass by weakening, skipping or deleting it.
11. If the same fix fails twice, stop. Summarise what you tried and ask.

## Security
12. Never print, log or commit secrets or .env files. Anything in a
    browser-exposed variable (NEXT_PUBLIC_, VITE_) is public. Check auth
    on the server for every route that touches user data.

## Project commands
- Typecheck: `npm run typecheck`
- Lint: `npm run lint`
- Test: `npm test`
- Build: `npm run build`

Why each group matters

Read first, plan first (rules 1 to 4)

Most broken edits come from an agent changing a file it has not opened, or using an API from an older release in its training data. Asking it to read the file, check the installed version and show a plan first costs a few seconds and saves the "it rewrote my auth" afternoon.

No invented names (rules 5 and 6)

Agents will confidently use a config key or package that does not exist. A made-up package name is also a security risk, because someone can publish a package under that name. Rule 5 makes the agent check, and say what it checked.

Small diffs (rules 7 and 8)

A focused diff is one you can review and undo. A 600-line "tidy-up" that also fixes your bug is one you cannot trust.

Proof, not "should work" (rules 9 to 11)

If the agent knows your commands, it can check its own work. Rule 10 blocks the most common shortcut: making a failing test pass by changing the test. Rule 11 stops fix loops before they burn an hour. If you are already in one, use the prompts in When your AI agent keeps breaking your code.

Security basics (rule 12)

Agent-built apps often ship with secrets in browser-exposed variables or routes that never check who is asking. For a deeper pass before launch, use the pre-launch security checklist and, if you use Supabase, the Supabase RLS checklist.

Which file to put them in

Tool File Notes
Cursor .cursor/rules/00-core.mdc or AGENTS.md In an .mdc file, add frontmatter with alwaysApply: true. A plain .md file in .cursor/rules/ is ignored.
Claude Code CLAUDE.md Reads AGENTS.md directly from v2.1.277 when there is no CLAUDE.md. Otherwise import it with @AGENTS.md.
Several tools AGENTS.md One shared file, then a small tool-specific file only where needed.

Copy-ready versions: the Cursor rules template, the CLAUDE.md example and the AGENTS.md example. Other tools, such as Copilot (.github/copilot-instructions.md), have their own file names, so check your tool's current docs.

How to keep rules working

  • Keep them short. Claude Code's docs suggest under 200 lines per CLAUDE.md, and Cursor suggests under 500 lines per rule. The 12 rules above fit in about 45 lines.
  • Make every line checkable. "Run npm test before you say you are done" works. "Write good tests" does not.
  • Add a line when the agent repeats a mistake. That is what the rules file is for. Delete lines that no longer apply.
  • Keep one source. If you keep several files, generate them from one source or import one into another, so they never contradict each other.
  • Enforce what must not happen. Rules are guidance. For a hard block, use your tool's permission settings or hooks.

FAQ

Do these rules work with any AI coding agent?

The wording is tool-neutral. Only the file name and frontmatter change between tools, as in the table above.

Should I add style rules?

Only the ones the agent gets wrong. Use a linter and formatter for style. Cursor's docs specifically advise against copying entire style guides into rules.

What should I add for my stack?

The things the agent cannot work out from the code: which router or auth library you use, where database access lives, and folders it must never edit. Put stack rules in a separate file scoped to those files.

Will the agent always follow them?

No. Rules make good behaviour much more likely, but they are context, not enforcement. Short, specific rules are followed more consistently.

Back to blog

Skip the setup: get the Ship-It Kit

Agent rules for 4 stacks, a generator for AGENTS.md, CLAUDE.md and Cursor rules, 25 build prompts, 8 rescue prompts and 20 security audit prompts.

Launch price US$17 Regular price US$22

Get the Ship-It Kit

Prices in US dollars. Your bank converts at checkout.Made in New Zealand by Vibemast.

Launch price for early buyers. Instant download. One-time payment. Not working? Fixed or refunded within 14 days.

For business owners

Run a business, not just code?

Our free Business Brain setup prompt makes ChatGPT, Claude or Gemini know your business, so replies, quotes and posts sound like you. It takes about 10 minutes and needs no technical skills. Handy for your own business, or for clients who keep asking how to use AI.