AGENTS.md Team Guide: Unifying AI Coding Tool Configuration
π Why Do You Need AI Configuration Files?
In Agentic Engineering, AI is your executor. But just like a new hire needs onboarding to learn team conventions, AI agents need their own βonboarding docs.β
An AI without configuration files is like a project without a README β it works, but itβs unpredictable.
Core problems AI config files solve:
- π― Consistency: Every team memberβs AI behaves the same way
- π Quality: Enforces coding standards automatically
- π§ Context: Gives AI knowledge of your architecture and conventions
- π Safety: Limits what the AI can do
ποΈ The Three Configuration Files
There are currently three mainstream AI configuration files:
| File | Tool | Scope | Standardization |
|---|---|---|---|
| AGENTS.md | Universal (OpenAI Codex, etc.) | All AI tools | π’ Emerging standard |
| CLAUDE.md | Claude Code | Anthropic ecosystem | π‘ Proprietary format |
| .cursorrules | Cursor | Cursor IDE | π‘ Proprietary format |
AGENTS.md β Universal AI Behavior Standard
AGENTS.md emerged in late 2025 as a universal standard. Itβs not tied to any specific tool β it provides project context and behavioral guidelines for all AI coding assistants.
project-root/
βββ AGENTS.md β Top-level: global rules
βββ src/
β βββ AGENTS.md β Subdirectory: module-specific rules
β βββ frontend/
β β βββ AGENTS.md β More specific frontend rules
β βββ backend/
β βββ AGENTS.md β More specific backend rules
βββ tests/
βββ AGENTS.md β Testing-related rules
Characteristics:
- π Supports hierarchical, directory-level configuration
- π Tool-agnostic β any AI assistant can read it
- π Markdown format, easy for humans to read too
CLAUDE.md β Claude Code Specific
CLAUDE.md is the configuration file that Anthropicβs Claude Code reads. Similar to AGENTS.md but with some Claude-specific features.
project-root/
βββ CLAUDE.md β Project-level config
βββ ~/.claude/CLAUDE.md β User-level global config
βββ src/
βββ CLAUDE.md β Subdirectory-level config
Characteristics:
- π§ Automatically read by Claude Code
- π§ Supports global (user-level) + project-level + directory-level
- π Can include bash commands (build, test commands)
.cursorrules β Cursor IDE Specific
.cursorrules is Cursorβs project-level configuration file, placed in the project root.
project-root/
βββ .cursorrules β Cursor config
Characteristics:
- π₯οΈ Only read by Cursor IDE
- π Single file, no hierarchical support
- π¨ Best for defining coding style and project conventions
π Template Examples
AGENTS.md Universal Template
# AGENTS.md
## Project Overview
This is a Next.js 15 + TypeScript web application for [project description].
## Tech Stack
- **Framework**: Next.js 15 (App Router)
- **Language**: TypeScript (strict mode)
- **Styling**: Tailwind CSS v4
- **Database**: PostgreSQL + Drizzle ORM
- **Testing**: Vitest + Playwright
## Coding Standards
### TypeScript
- Use `interface` over `type` for object shapes
- Always use explicit return types on exported functions
- Prefer `const` assertions where applicable
- No `any` β use `unknown` + type guards instead
### File Organization
- Components: `src/components/[feature]/[ComponentName].tsx`
- Hooks: `src/hooks/use[HookName].ts`
- Utils: `src/lib/[domain].ts`
### Naming Conventions
- Components: PascalCase
- Files: kebab-case (except components)
- Constants: UPPER_SNAKE_CASE
- Database tables: snake_case
## Build & Test Commands
- `pnpm dev` β Start development server
- `pnpm build` β Production build
- `pnpm test` β Run unit tests
- `pnpm test:e2e` β Run E2E tests
- `pnpm lint` β Lint check
## Important Rules
1. Never modify migration files directly
2. Always run `pnpm test` before committing
3. All API routes must have input validation (zod)
4. No secrets in code β use environment variables
5. All public functions must have JSDoc comments
CLAUDE.md Template
# CLAUDE.md
## Project Context
[Similar project description as AGENTS.md]
## Claude-Specific Instructions
### Thinking Style
- Think step-by-step before making changes
- Always explain WHY before making a change
- When unsure, ask rather than guess
### File Operations
- Read the full file before editing
- Make minimal, focused changes
- Always verify changes compile: `pnpm tsc --noEmit`
### Git Workflow
- Commit messages follow Conventional Commits
- One logical change per commit
- Run tests before suggesting commit
### Off Limits
- Do NOT modify: `.env`, `*.lock`, `migrations/`
- Do NOT run: `rm -rf`, `DROP TABLE`, `git push --force`
## Common Tasks
- "Add a new API endpoint": Create route in `src/app/api/`, add zod schema, add tests
- "Fix a bug": Read error, find root cause, write test first, then fix
- "Refactor": Ensure tests pass before AND after
.cursorrules Template
You are a senior TypeScript developer working on a Next.js 15 project.
## Style
- Use functional components with hooks
- Prefer server components by default, add "use client" only when needed
- Use Tailwind CSS for styling, no CSS modules
- Write concise, readable code
## Patterns
- Error handling: use Result pattern (ok/err) instead of try/catch for business logic
- API responses: always return typed responses using the ApiResponse<T> type
- Database queries: always use prepared statements via Drizzle
## Testing
- Write tests for all new functions
- Use describe/it blocks with clear test names
- Mock external services, don't mock internal modules
## Don't
- Don't use default exports (except pages and layouts)
- Don't add console.log (use the logger utility)
- Don't use string concatenation for SQL
- Don't skip TypeScript types
π Team Sharing Strategies
Strategy 1: Commit Everything to Git (Recommended)
# Make sure these files are NOT in .gitignore
# The following files should be version-controlled:
AGENTS.md
CLAUDE.md
.cursorrules
Pros: Everyone auto-syncs, version history is tracked Cons: Personal preferences need to go in global config
Strategy 2: Layered Configuration
# Team-shared (committed to Git)
AGENTS.md β Team standards
.cursorrules β Team standards
# Personal config (not committed)
~/.claude/CLAUDE.md β Personal Claude global config
In .gitignore:
# Don't ignore team config files
!AGENTS.md
!CLAUDE.md
!.cursorrules
Strategy 3: Monorepo Multi-Project
monorepo/
βββ AGENTS.md β Global rules
βββ .cursorrules β Global Cursor rules
βββ packages/
β βββ web/
β β βββ AGENTS.md β Web frontend-specific rules
β β βββ CLAUDE.md
β βββ api/
β β βββ AGENTS.md β API backend-specific rules
β β βββ CLAUDE.md
β βββ shared/
β βββ AGENTS.md β Shared library rules
β Best Practices
1. Start Small, Grow Organically π
Donβt write a 500-line config file on day one. Start with:
- Project tech stack description
- 3-5 most important coding rules
- Build and test commands
Then add rules based on issues you encounter in practice.
2. Use Concrete Examples, Not Abstract Descriptions π―
# β Bad
Write clean code.
# β
Good
## Error Handling
Use the Result pattern:
β```typescript
type Result<T> = { ok: true; data: T } | { ok: false; error: string };
// Good
function getUser(id: string): Result<User> { ... }
// Bad β don't throw for business logic errors
function getUser(id: string): User { throw new Error(...) }
β```
3. Keep It Up to Date π
Config files arenβt write-once-forget:
- π Review monthly β remove outdated content
- π When AI repeatedly makes a mistake β add a rule
- π Tech stack changes β update immediately
4. Unify Core Content Across All Three Files π€
If your team uses both Cursor and Claude Code:
# AGENTS.md β Contains full project standards (source of truth)
# CLAUDE.md β References AGENTS.md + Claude-specific additions
See AGENTS.md for project standards.
[Claude-specific additions here]
# .cursorrules β Condensed version in Cursor-friendly format
[Condensed version of AGENTS.md rules]
5. Add a βForbiddenβ List π«
Explicitly tell AI what NOT to do:
## Forbidden Actions
- Never delete or modify migration files
- Never commit .env files
- Never use `rm -rf` without explicit confirmation
- Never bypass TypeScript strict mode
- Never add dependencies without checking bundle size
6. Include Standard Workflow Recipes π
## Standard Workflows
### Adding a New Feature
1. Create feature branch from `main`
2. Write failing tests first (TDD)
3. Implement the feature
4. Ensure all tests pass: `pnpm test`
5. Run linting: `pnpm lint`
6. Create PR with description template
### Database Changes
1. Create migration: `pnpm drizzle-kit generate`
2. Review generated SQL
3. Test migration: `pnpm drizzle-kit push`
4. Never modify existing migrations
π Quick Start Checklist
- Create
AGENTS.mdin your project root - Add project overview and tech stack
- Add 3-5 core coding rules
- Add build/test commands
- Add a βForbiddenβ list
- If using Cursor: create
.cursorrules - If using Claude Code: create
CLAUDE.md - Commit to Git for team sync
- Schedule monthly reviews and updates
Configuration files are the βinfrastructureβ of agentic engineering. Spend 30 minutes setting them up, save your team hundreds of hours of rework. ποΈ
Want to learn how to roll out agentic engineering across your team? Read our Team Adoption Guide.