Free guide · Papa Tech Solutions
AI Coding Project Starter: AGENTS.md, Rules, Ignore Files
Context
You are about to let Cursor or Claude Code write a new app. The agent only knows the files you put in front of it, plus whatever else it decides to open.
The problem
With no instructions it guesses how privacy, analytics, and forms should work. It also searches lockfiles and build output, and it does that again on every chat and on every machine that clones the repo.
What you do
You add the few files those tools already know how to load. Short rules stay in every chat. Longer notes open only when a task needs them. Ignore files keep generated folders and secrets out of search.
What this achieves
The agent builds under the same constraints you would have checked in a review, and a copy of the repo on another computer does not spend its first chat relearning the project.
This guide is not the Vibe Coding Security Checklist. That checklist is an audit you run later, on code that already exists. Before launch, run the Vibe Coding Security Checklist. These files do not replace that audit.
Which file, and who reads it
Create them in this order. Each page has a sample you can copy.
01
AGENTS.md example
A short AGENTS.md sample: stack, commands, standing privacy rules, and links so the agent opens a doc only when the task needs it.
02
CLAUDE.md example
A CLAUDE.md sample that imports AGENTS.md with @AGENTS.md, so Claude Code and Cursor follow one set of rules instead of two.
03
Cursor rules example
Two .cursor/rules samples: one always-on guardrail under 50 lines, and one rule that loads only when form or privacy files are open.
04
.cursorignore example
Samples for .cursorignore, .cursorindexingignore, and .gitignore so build output, secrets, and lockfiles stay out of an agent's context.
05
Linked docs example
Short samples for docs/architecture.md, docs/data-and-privacy.md, and docs/decisions.md, opened only when AGENTS.md says the task needs them.
06 · Optional
Code graph example
When a code-graph MCP server helps a large repo, when it is overhead, and a sample .cursor/mcp.json and .mcp.json entry.
How this saves tokens
A new chat already spends context on the rules you load every time. The rest should load only when the task needs it. None of these steps has a fixed percentage. What they avoid depends on the repo.
- Rules files load in every chat, so keep them short. Detail lives in linked docs that load only when a task needs them.
- Ignore files keep build output, lockfiles, and images out of search results the agent would otherwise read.
- Point at a file with @file instead of pasting it. One task per chat. Ask for a plan before a large change.
- On a large repo, a code graph answers “where is this” and “who calls this” without opening whole files. On a small repo it is overhead.
- A stale doc costs more than no doc. The rules say to update the matching doc in the same change.
One prompt to create the files
Paste this once, in Agent mode, on the new repo. It creates the instruction files and the ignore files. It does not build the app, and it does not install a code graph. If a file is already there, it shows what it would add and stops.
Setup prompt
MODE: SETUP. Use Agent mode. Create instruction files only.
Create these files if they are missing. Fill names, stack, and folders from this repo. If a rule does not apply, write "Not applicable" and why. Do not invent a feature to satisfy a rule.
- AGENTS.md
- CLAUDE.md with a single @AGENTS.md import, and no second copy of the rules
- .cursor/rules/project-guardrails.mdc with alwaysApply: true, under about 50 lines
- .cursorignore
- .cursorindexingignore
- docs/architecture.md
- docs/data-and-privacy.md
- docs/decisions.md
- Add missing lines to .gitignore for secrets and build output. Do not replace an existing .gitignore.
Standing rules to include, in the project's own words:
- Do not put secrets, customer data, or live keys in prompts, client code, or logs.
- Do not load analytics, session replay, ad tags, or remote fonts until there is a real opt-in. Reject leaves them unloaded.
- A form that collects personal data needs an explicit consent checkbox, checked again on the server. No pre-ticked box.
- Do not build for children, and do not add tracking aimed at children, unless a parent-consent path is an explicit requirement.
- Do not sell personal data. Do not add a marketing-email sender without an unsubscribe path.
- Privacy and legal pages are drafts for a lawyer. Do not invent fines, ages, or a Significant Data Fiduciary claim.
- Before launch, run the Vibe Coding Security Checklist. These files do not replace that audit. https://papatechsolutions.com/resources/vibe-coding-security-checklist/
AGENTS.md must link the three docs and say when to open each one. It must say not to open node_modules, lockfiles, or build output unless asked, and not to start a task by summarizing the whole repo.
.cursorignore must exclude .env and .env.* (keep .env.example), node_modules, .next, out, dist, build, coverage, logs, zip files, and video. Add Pods, DerivedData, and .gradle only if those folders exist.
.cursorindexingignore must list lockfiles, images, PDFs, and source maps. Un-ignore a small logo path if the project has one.
If any of these files already exist, show what you would add and stop. Do not overwrite them.
Do not create the app, install packages, edit product code, or install a code-graph tool.