Coding Agents
CLAUDE.md and AGENTS.md generator
Write the instruction files that tell Claude Code, Codex, Cursor and other coding agents how to work on your project. Start from a template, edit, and download. It runs in your browser.
Languages, frameworks and tools, one per line.
Coding rules, one per line. Be concrete: “2-space indentation”, not “format code properly”.
How and when to test.
Things the agent must always do.
Things the agent must never do.
Commit and PR rules.
Instructions only Claude Code should see, e.g. “Use plan mode for changes under `src/billing/`”.
# My Next.js app
A Next.js web application using the App Router and TypeScript.
## Stack
- Next.js (App Router), React, TypeScript
- Tailwind CSS for styling
- npm for packages
## Commands
- Install: `npm install`
- Dev server: `npm run dev`
- Build: `npm run build`
- Lint: `npm run lint`
- Type check: `npx tsc --noEmit`
- Test: `npm test`
## Project layout
- `app/`: Routes, layouts and pages (App Router)
- `components/`: Shared React components
- `lib/`: Utilities, data access and business logic
- `public/`: Static files served as-is
## Conventions
- TypeScript strict mode; no `any` without a comment explaining why.
- Components are Server Components by default; add `"use client"` only when a component needs state, effects or browser APIs.
- Fetch data in Server Components or Route Handlers, not in client components.
- Name components in PascalCase and files after the component they export.
## Testing
- Put tests next to the code as `*.test.ts(x)`.
- Run `npm run lint` and `npx tsc --noEmit` before finishing a task.
## Always
- Run the build after changing configuration or dependencies.
## Never
- Commit secrets, API keys or `.env` files.
- Disable or skip failing tests to make a build pass.
- Import server-only modules into client components.
## Git and pull requests
- Use Conventional Commits (`feat:`, `fix:`, `docs:`, `refactor:`, `test:`).
- Keep pull requests focused on one change and describe how you tested it.
@AGENTS.md
No problems found: no secrets, no accidental imports, within 200 lines.
Everything stays in your browser. Your draft is saved on this device so you can come back to it.
Steps
How to use the CLAUDE.md and AGENTS.md generator
- Pick the template closest to your stack.
- Edit the project name, commands and directories, and the rules in each section, one per line.
- Choose which files you want: both (recommended), AGENTS.md only, or CLAUDE.md only.
- Fix anything the checks flag, then copy or download the files into your repository root and commit them.
Method
How it works
Coding agents start every session without memory of your project. An instruction file fixes that: the agent reads it first and learns how to build, test and lay out code the way your team does. Claude Code reads CLAUDE.md; most other agents read AGENTS.md, an open format supported by tools including Codex, Cursor, GitHub Copilot’s coding agent, Gemini CLI, Windsurf and Zed.
One file for every agent
Keeping two copies of the same rules means they drift apart. Anthropic’s documented approach is to keep the instructions in AGENTS.md and make CLAUDE.md a short file that starts with @AGENTS.md. Claude Code expands that import, then reads anything Claude-specific below it, such as when to use plan mode. Other agents read AGENTS.md directly. Recent versions of Claude Code can also read AGENTS.md on its own, but only when the project has no CLAUDE.md, so the import is the setup that works everywhere.
What makes instructions work
- Be concrete. “Run
npm testbefore committing” is followed; “test your changes” is not. Name exact commands, paths and limits. - Stay short. Anthropic suggests under 200 lines per file. Every line is loaded into every session, and long files are followed less reliably.
- Use headings and bullets. Grouped, scannable rules are easier for the model to apply than paragraphs.
- Remove contradictions. If two rules conflict, the agent may follow either one.
What the checks look for
The generator scans the output as you type. It flags anything that looks like an API key, token, password or private key, because these files are committed and sent to the model. It warns about @ text outside code, which Claude Code would try to import as a file, and about files longer than 200 lines. It also points out rules that are too vague to act on.
Everything happens in your browser: nothing you type is sent anywhere, and your draft is kept on this device so you can come back to it.
Examples
Worked examples
# Orders API
HTTP service that takes and tracks customer orders.
## Stack
- Go (see `go.mod` for the version)
- Standard library first; third-party modules only when justified
## Commands
- Build: `go build ./...`
- Test: `go test ./...`
- Single test: `go test ./internal/... -run TestName`
- Vet: `go vet ./...`
- Format: `gofmt -w .`
- Tidy modules: `go mod tidy`
## Project layout
- `cmd/`: Entry points, one directory per binary
- `internal/`: Application code not importable by other modules
- `pkg/`: Packages intended for use by other modules
## Conventions
- Wrap errors with context: `fmt.Errorf("doing X: %w", err)`.
- Pass `context.Context` as the first parameter of functions that do I/O.
- No `panic` in library code; return errors.
- Run `gofmt` on every changed file.
## Testing
- Use table-driven tests.
- Run `go test ./...` and `go vet ./...` before finishing a task.
## Always
- Keep interfaces small and define them where they're used.
## Never
- Commit secrets, API keys or `.env` files.
- Disable or skip failing tests to make a build pass.
- Add global mutable state.
## Git and pull requests
- Use Conventional Commits (`feat:`, `fix:`, `docs:`, `refactor:`, `test:`).
- Keep pull requests focused on one change and describe how you tested it.
@AGENTS.md
## Claude Code
- Use plan mode before changing anything under `internal/billing/`.
Claude Code reads the CLAUDE.md, expands @AGENTS.md in its place, then adds the Claude-only note. Codex, Cursor and other agents read AGENTS.md directly.
FAQ
Frequently asked questions
What is a CLAUDE.md file?
A Markdown file of instructions that Claude Code reads at the start of every session: how to build and test the project, where things live, and the rules to follow. Put it in your repository root and commit it so the whole team shares it. Claude treats it as context rather than enforced configuration, so concrete instructions work best.
What is AGENTS.md?
An open format for the same kind of instructions, read by many coding agents, including OpenAI Codex, Cursor, GitHub Copilot’s coding agent, Gemini CLI, Windsurf, Zed, Aider and Jules. It’s plain Markdown with no required fields. In a monorepo you can add one per package; agents read the nearest one to the file they’re working on.
Does Claude Code read AGENTS.md?
Yes, from version 2.1.277, but only when there’s no CLAUDE.md in the working directory or above it. If you have both, Claude reads CLAUDE.md only. That’s why the recommended setup is an AGENTS.md with all the instructions and a CLAUDE.md that starts with @AGENTS.md, which imports it, so every tool reads the same file. See Anthropic’s documentation.
How long should a CLAUDE.md be?
Anthropic recommends under 200 lines per file: longer files use more context and are followed less reliably. Keep facts the agent needs in every session, such as commands, layout and “always do X” rules. Move instructions for one part of the codebase into .claude/rules/ files scoped to those paths, and multi-step procedures into skills.
Where can CLAUDE.md files go?
The project file goes at the repository root (./CLAUDE.md or ./.claude/CLAUDE.md). Personal preferences for every project go in ~/.claude/CLAUDE.md, and personal notes for one project in ./CLAUDE.local.md, which you should add to .gitignore. Files in subdirectories load when Claude works in them.
Why does the generator warn about @ signs?
In a CLAUDE.md, @path/to/file outside backticks imports that file into the context. A line such as “ask @alice before deploying” would make Claude Code look for a file called alice. The generator writes commands and paths in code spans, where imports aren’t parsed, and warns about any other @ it finds.
What shouldn’t go in these files?
Secrets: the files are committed and sent to the model with every session, so the generator flags anything that looks like a key, token or password. Also leave out what the agent can read from the code itself, long tutorials, and rules that contradict each other, because Claude may follow either one.
How is this different from running /init?
/init asks Claude to scan your codebase and draft a CLAUDE.md, which is a good start when the code already exists. This generator works before you have code, writes both files in the shared-file setup, uses templates for common stacks, and checks the result for secrets, stray imports and length. You can also generate here and refine with /init later.
Related
Related tools
- AI Token CounterCount tokens for GPT, Claude, Gemini, DeepSeek, Qwen and more.
- LLM API Cost CalculatorEstimate per-request, daily and monthly API costs.
- AI Model ComparisonCompare prices, context windows and features across models.
- AI Model Pricing PagesSpecs, real costs and cheaper alternatives for popular models.
- Context Window CheckerSee whether your text fits each model's context window.
- Subscription vs API CalculatorFind out whether a chat plan or the API is cheaper for you.