📖 Independent Guide · 60k+ Repos on GitHub

Write Better AGENTS.md Files for Your AI Coding Agents

Explore the complete reference for AGENTS.md — the open-source Markdown format adopted by thousands of projects to give AI agents the context they need to ship quality code. Start building your AGENTS.md today.

Why Your Projects Need AGENTS.md

README files speak to humans. AGENTS.md speaks to the AI agents working on your codebase — giving them tribal knowledge that senior engineers carry in their heads.

AGENTS.md Gives One Predictable Location

Agents know exactly where to find build commands, test instructions, and code conventions inside your AGENTS.md. No more guessing or scanning through scattered docs.

AGENTS.md Keeps Your README Clean

Keep your README focused on human contributors. Agent-specific context like linting configs, gotchas, and test quirks live in your AGENTS.md instead.

AGENTS.md Works Across All Agents

Write your AGENTS.md once, use it everywhere. A single file works with Codex, Cursor, Copilot, Claude Code, Jules, Windsurf, and dozens more.

What Is AGENTS.md and Where Did It Come From?

Understanding the origins of the AGENTS.md standard and the ecosystem behind it.

AGENTS.md is a simple, open Markdown format that acts as a briefing packet for AI coding agents. While README.md serves human developers with project introductions and contribution guides, AGENTS.md provides the precise, actionable context that coding agents need — build commands, test workflows, code style rules, and architecture notes.

The AGENTS.md format emerged from collaborative efforts across the AI software development ecosystem. Major contributors include OpenAI (Codex), Google (Jules), Sourcegraph (Amp), Anysphere (Cursor), and Factory. Rather than creating yet another proprietary configuration file, these teams chose a vendor-neutral Markdown standard that works everywhere.

AGENTS.md has been adopted by over 60,000 open-source repositories on GitHub and is now formally stewarded by the Agentic AI Foundation under the Linux Foundation, ensuring it remains an open community resource rather than a proprietary tool.

ThoughtWorks featured AGENTS.md in their Technology Radar (November 2025) at the "Trial" level, recommending enterprises try it on projects that can handle the risk. The format's simplicity — plain Markdown, no schema, no required fields — is what makes it so widely adoptable.

Create Your First AGENTS.md File in 4 Steps

Follow this step-by-step guide to write an effective AGENTS.md that improves AI code generation quality from your very first commit.

1

Drop Your AGENTS.md at the Project Root

Create a file named AGENTS.md in the root of your repository. Every major AI coding agent automatically discovers and reads this file before starting work.

touch AGENTS.md
2

Add Key Sections to Your AGENTS.md

Focus on the knowledge an agent would need to make its first successful contribution. The most impactful sections to include are:

Build and test commands
Code style and conventions
Project architecture overview
PR and commit guidelines
Security considerations
Known gotchas and workarounds
3

Keep Your AGENTS.md Under 150 Lines

Brevity beats encyclopedias. Long files slow agents down and bury the important signals. Write actionable instructions, wrap commands in backticks, and skip anything the agent can infer from the code itself. Think of it as a quick briefing for a new senior teammate — not a wiki.

4

Use Nested AGENTS.md Files for Monorepos

Working in a monorepo? Place an additional AGENTS.md inside each package or subproject. Agents read the nearest AGENTS.md file to the code being edited — just like .gitignore resolution. This lets each sub-package carry tailored AGENTS.md instructions while the root file provides global defaults.

Copy Real-World AGENTS.md Templates

Use these proven AGENTS.md examples as a starting point. Each template targets a different stack and shows best practices for structuring your AGENTS.md file.

Custom CRM System Django + Postgres
# CRM Application

## Build & Test
- Install: `pip install -r requirements.txt`
- Migrate: `python manage.py migrate`
- Run: `python manage.py runserver`
- Test: `pytest -x --tb=short`

## Database & ORM Rules
CRITICAL: Django ORM exclusively. No raw SQL ever.
- `select_related()` on every ForeignKey access
- `prefetch_related()` for M2M & reverse FK
- Chain `only()` or `defer()` on large models
- Target: <5 queries per view. N+1 = rejected PR
- Monetary fields: `DecimalField(max_digits=12, decimal_places=2)`
- Run `django-debug-toolbar` to verify query count

## Views & Code Style
- Class-based views only — no function views
- Every feature gets a dedicated method in the view
- Mixins for shared auth/permission logic
- Each method does ONE thing — no god-methods

## Naming (Strictly Enforced)
Kebab-case for everything:
- Files: `deal-stage-view.py` not `DealStageView.py`
- Templates: `contact-detail.html`
- URLs: `/deal-stages/` not `/dealStages/`
- Names must be self-explanatory without opening file

## Architecture
- `apps/contacts/` — Lead & customer models
- `apps/deals/` — Pipeline stages & tracking
- `apps/emails/` — IMAP sync via Celery
- `apps/reports/` — Dashboard aggregations

## Gotchas
- Deal stages are ordered — never skip a stage
- Contact merge = soft-delete; old record preserved
- Ask before guessing any business logic
E-Commerce Storefront Tailwind + Accessibility
# Online Store

## Build & Test
- Install: `pnpm install`
- Dev: `pnpm dev`
- Test: `pnpm vitest run`
- Lint: `pnpm eslint . --fix`

## Frontend Rules
- Tailwind CSS v4+ (latest) — via CDN or Vite plugin
- No React. Plain HTML templates only.
- Semantic HTML is mandatory:
  Use `<header>`, `<main>`, `<nav>`, `<section>`, `<article>`, `<footer>`
- Favicon: 96x96 PNG per Google guidelines

## Accessibility (MANDATORY on every page)
- Every `<label>` must have `for=` matching its input `id=`
- Every `<section>` needs `aria-labelledby` → heading `id`
- All images: descriptive `alt` text, never empty
- Keyboard nav must work on all interactive elements
- Colour contrast minimum: 4.5:1 ratio
- Skip-to-content link on every page

## SEO Requirements
- Action-oriented H1 per page:
  ✔ "Shop Handmade Leather Bags Online""Products" or "Home"
- Intro paragraph must ask the user to take action
- `itemscope`/`itemprop` Product schema on every product
- Unique `id` attrs namespaced by slug:
  `id="product-{{ slug }}-title"`
- No two pages share identical element identifiers

## Architecture
- `src/cart/` — Cart logic, pricing, discount calc
- `src/catalog/` — Product & category templates
- `src/checkout/` — Stripe payment flow
- Prices stored in cents (integer). Display = cents / 100
- Stripe webhook signature verified on every callback
Project Management Tool Naming & Agent Rules
# Task & Project Tracker

## Build & Test
- Install: `npm install`
- Dev: `npm run dev`
- Test: `npm run test`
- DB seed: `npm run db:seed`

## Naming Rules (Strictly Enforced)
Kebab-case for EVERYTHING. No exceptions.
- Files: `board-kanban-view.ts``BoardKanbanView.ts` ✘
- URLs: `/task-assignments/``/taskAssignments/` ✘
- DB tables: `task-comments``task_comments` ✘
- CSS classes: shared across pages
- IDs: namespaced per page slug
- File names must be descriptive enough that
  any developer understands without opening:
  ✔ `board-column-drag-handler.ts``handler.ts` or `utils.ts`

## Code Style
- Class-based architecture — dedicated method per feature
- Each method does ONE thing. No 200-line methods.
- `src/boards/` — Kanban rendering & drag/drop
- `src/tasks/` — CRUD, assignments, status flow
- `src/teams/` — Workspace, roles, invitations
- `src/timeline/` — Gantt chart & activity feed

## Agent Behaviour Rules
IMPORTANT — read before writing any code:
- If business logic is unclear — ASK, don't assume
- Do NOT rename existing classes/methods/functions
- Do NOT change file names without approval
- Always specify exact file path when sharing code
- No summary docs, implementation guides, or READMEs
- No comparison docs showing before/after changes
Invoice & Billing SaaS Performance & Queries
# Invoicing Platform

## Build & Test
- Install: `pip install -r requirements.txt`
- Run: `python manage.py runserver`
- Test: `pytest --cov=apps`
- Lint: `ruff check . --fix`

## Performance Rules (NON-NEGOTIABLE)
Optimize every view for minimal SQL queries.
- `select_related()` on every FK access
- `prefetch_related()` for reverse/M2M relations
- Aggregate in queryset, NOT in Python loops:
  ✔ `.annotate(total=Sum('line_items__amount'))``sum([i.amount for i in inv.items.all()])`
- Use `Subquery` + `OuterRef` for correlated lookups
- Pagination mandatory: 25 items per page
- `db_index=True` on fields used in filter/order_by
- requirements.txt: package names only, no versions

## HTML & JavaScript Rules
- Every interactive element: `data-*` attributes
  Example: `data-invoice-id="{{ inv.id }}"`
- JS selectors match namespaced IDs:
  `document.querySelector('[data-invoice-id]')`
- No inline `onclick` — use event delegation
- `for=` on every `<label>`, matching input `id=`

## Architecture
- `apps/invoices/` — Create, send, track, PDF
- `apps/clients/` — Profiles & address book
- `apps/payments/` — Stripe webhooks & bank
- `apps/recurring/` — Celery beat scheduling

## Gotchas
- Sent invoices: immutable — credit notes only
- Invoice numbers: sequential, never reuse/skip
- All amounts: `DecimalField`, never `FloatField`
- Tax rules by country — see `tax-config.py`
Blog & CMS Platform SEO & Schema Markup
# Content Management System

## Build & Test
- Install: `pnpm install`
- Dev: `pnpm dev`
- Build: `pnpm build`
- Test: `pnpm vitest run`

## SEO Rules (EVERY page, NO exceptions)
Google must see every generated page as
structurally unique — no two pages share
identical element identifiers or schema.

Page-specific requirements:
- Unique `id` attributes namespaced by slug:
  `id="post-{{ slug }}-title"`
  `id="post-{{ slug }}-content"`
  `id="post-{{ slug }}-comments"`
- `for=` on every `<label>` matching input `id=`
- `aria-labelledby` on sections → heading `id`
- `itemscope`/`itemprop` schema: Article, BlogPosting
- `data-*` attributes for all JS hooks

## H1 & Content Rules
- Action-oriented H1 per page:
  ✔ "Read Our Guide to Container Security""Blog Post" or "Article"
- Intro paragraph: ask the user to do something
- No two pages share identical H1 or meta desc

## Dynamic Pages
- Tag archives, author pages: ALL ids, aria refs,
  and schema built from slug at render time
- Sitemap auto-generated on each publish
- Canonical URL on every page
- OG image auto-generated from post title

## Architecture
- `src/editor/` — Rich text editor (TipTap)
- `src/posts/` — CRUD, drafts, scheduling
- `src/media/` — Upload, CDN resize to WebP
- `src/seo/` — Meta tags, structured data

## Gotchas
- Slug changes auto-create 301 redirect records
- Workflow: Draft → Review → Published only
- Never delete media — flag as unused instead
HR & Employee Portal Security & Full-Stack
# HR Management System

## Build & Test
- Install: `pip install -r requirements.txt`
- Migrate: `python manage.py migrate`
- Run: `python manage.py runserver`
- Test: `pytest apps/ -x`

## Full-Stack Conventions
Backend:
- Django class-based views, dedicated methods each
- Django ORM exclusively — zero raw SQL
- `select_related`/`prefetch_related` on every queryset
- requirements.txt: package names only, no versions
- Kebab-case file names: `employee-detail-view.py`

Frontend:
- Tailwind CSS latest version via CDN
- Semantic HTML: `<main>`, `<section>`, `<nav>`, `<footer>`
- Favicon: 96x96 PNG per Google guidelines
- No React — server-rendered Django templates only
- `for=`/`id=` on every label/input pair
- `aria-labelledby` on sections → heading `id`

## Security (STRICT)
- PII encrypted at rest (django-encrypted-model-fields)
- RBAC: Admin > HR Manager > Employee
- Payroll: HR Manager+ only, row-level permission
- SSO via SAML — no password-based auth
- Audit log on every `save()` and `delete()`
- Data exports require approval workflow
- Session timeout: 30 min inactivity

## Architecture
- `apps/employees/` — Profiles, org chart, search
- `apps/leave/` — PTO requests, balance calc
- `apps/payroll/` — Salary processing, payslip PDF
- `apps/onboarding/` — Checklists & docs

## Agent Behaviour Rules
READ THIS BEFORE WRITING ANY CODE:
- Do NOT change existing class/method/function names
- Do NOT rename files without explicit approval
- Do NOT guess business logic — ask first
- Do NOT create summary docs or READMEs
- Always specify exact file path in responses
- Performance first: every query counts
- When in doubt about anything — ASK

Pro Tips: What Power Users Put in Their AGENTS.md

These are the most impactful instruction patterns we've seen across production AGENTS.md files. Each one prevents a category of agent mistakes.

Prevent N+1 Query Disasters

## Database Rules
Use ORM only. No raw SQL. Ever.
- `select_related()` on every ForeignKey
- `prefetch_related()` for M2M/reverse
- Annotate in queryset, NOT in Python:
  ✔ `.annotate(total=Sum('items__price'))``sum(i.price for i in obj.items.all())`
- Target: <5 queries per view

Stops agents from writing loops that fire hundreds of individual queries.

📝

Enforce Consistent Naming

## Naming (Strictly Enforced)
Kebab-case for everything:
- Files: `user-profile-view.py``UserProfileView.py` ✘
- URLs: `/user-profiles/` ✔
- DB tables: `user-profiles` ✔
- Names must be self-explanatory:
  ✔ `invoice-line-item-calculator.py``utils.py`

Agents default to camelCase or PascalCase — this override makes your codebase consistent.

Bake in Accessibility from Day One

## Accessibility (MANDATORY)
- `for=` on every `<label>` → input `id=`
- `aria-labelledby` on sections → heading
- Descriptive `alt` on all images
- Keyboard nav on all interactive elements
- Contrast ratio: minimum 4.5:1
- Semantic HTML: `<main>`, `<nav>`, `<section>`

Without this, agents produce div-soup. This makes every page screen-reader friendly by default.

🛑

Set Agent Behaviour Guardrails

## Agent Rules
READ BEFORE WRITING ANY CODE:
- Do NOT rename existing classes/methods
- Do NOT change file names without approval
- Do NOT guess business logic — ASK first
- Do NOT create READMEs or summary docs
- Always provide exact file path with code
- When in doubt about anything — ASK
- No before/after comparison documents

The single most impactful section. Prevents agents from "helpfully" refactoring your entire codebase.

AGENTS.md Frequently Asked Questions

Quick answers to common questions about writing and using AGENTS.md in your repositories.

About AGENTS.md Online — An Independent Developer Guide

Disclaimer: agentsmd.online is an independent community resource and is not affiliated with, endorsed by, or connected to the official agents.md project, the Agentic AI Foundation, or the Linux Foundation. This site is a personal initiative to help developers learn and adopt the AGENTS.md format through guides, examples, and best practices.

S

Subash Geetha Krishnan

Developer & Tech Lead · Singapore

I'm Subash — I build and maintain multiple web applications using AI coding agents as part of my daily workflow. After working across dozens of repositories and noticing the same agent mistakes repeated project after project, I created this independent guide to help fellow developers understand and adopt the AGENTS.md format effectively.

This site is not an official resource — it's a developer-to-developer reference built from hands-on experience. Every project I ship today starts with an AGENTS.md file, and I wanted to share what I've learned about writing effective ones.