ContextPruner

AGENTS.md examples and a copy-paste template

Real AGENTS.md examples for common stacks, plus a template you can drop into any repo and adapt in a couple of minutes.

·

Short answer

A working AGENTS.md has four sections: a short project overview, the exact build and test commands, your code conventions, and a list of files the agent should ignore. Drop it in your repository root as AGENTS.md and adapt each section to your stack — for most projects that takes a couple of minutes.

The fastest way to write a good AGENTS.mdis to start from a real one and swap in your own details. Below are working examples for a few common stacks, plus a blank template. Each keeps the same shape — overview, commands, conventions, and a “don't read these” list — because that's what a coding agent actually acts on.

Blank template

Drop this in your repo root and fill in the brackets:

# AGENTS.md

## Project
[stack in one line; where the real source lives; anything non-obvious]

## Commands
- Install: [...]
- Dev:     [...]
- Test:    [...]   # run before every commit
- Lint:    [...]

## Conventions
- [a rule the agent must follow]
- [a pattern to avoid]

## Don't read these
- [generated / vendored / binary files with no signal]

Node / Next.js / TypeScript

# AGENTS.md

## Project
Next.js 16 (App Router) + TypeScript. Stripe for payments, Supabase
for data. Source in app/, lib/, components/.

## Commands
- Install: npm install
- Dev:     npm run dev
- Test:    npm test        # Vitest — run before every commit
- Lint:    npm run lint

## Conventions
- Server Components by default; add "use client" only when needed.
- Semantic color tokens from globals.css; never hard-code hex.

## Don't read these
- package-lock.json, .next/, dist/, coverage/
- **/*.min.js, **/*.map

Python (FastAPI)

# AGENTS.md

## Project
FastAPI service + SQLAlchemy, Postgres. Source in app/, tests in tests/.

## Commands
- Install: uv sync
- Run:     uvicorn app.main:app --reload
- Test:    pytest          # run before every commit
- Lint:    ruff check .

## Conventions
- Type-hint every public function; run mypy before pushing.
- Keep business logic out of route handlers.

## Don't read these
- .venv/, __pycache__/, .pytest_cache/, .ruff_cache/
- *.pyc, dist/, build/, *.egg-info/

Go

# AGENTS.md

## Project
Go 1.23 HTTP API, standard library + chi router. Entry in cmd/,
packages in internal/.

## Commands
- Build: go build ./...
- Test:  go test ./...      # run before every commit
- Lint:  golangci-lint run

## Conventions
- Wrap errors with %w; never swallow them.
- Table-driven tests for new packages.

## Don't read these
- vendor/, bin/, *.exe
- generated *_gen.go and *.pb.go files

The part worth getting right

Notice that the sections most examples share are easy — the stack and commands you know off the top of your head. The “don't read these” list is the one that's specific to your repo and the one that actually keeps junk out of your agent's context. It's also the hardest to write by hand, because you have to know which files in your tree are noise.

One caveat on those blocks: an AGENTS.md ignore list is advisory. The agent reads it and usually honors it, but the file itself can't force the skip — nothing stops the model opening a listed path. Several tools also read a dedicated ignore file their harness treats as a best-effort block, so the skip doesn't hinge on the model's cooperation. Here's how enforcement works.

That's the part ContextPruner fills in for you: paste your file tree and it classifies every file, then writes AGENTS.md — plus CLAUDE.md, GEMINI.md, Cursor rules, Copilot instructions, and the four enforced ignore files, all nine — with the ignore list already built from your real files. It's free and runs entirely in your browser, so your file list never leaves it.

Related guides