AI tools
AGENTS.md vs SKILL.md: What Goes Where
What belongs in AGENTS.md, what belongs in a SKILL.md, and what never goes in either. Minimal templates for Claude Code, Codex, Copilot and more.
Most teams using AI coding agents end up with two kinds of instruction files. One is AGENTS.md, a briefing about the repository that the agent reads at the start of a session. The other is SKILL.md, a packaged procedure for one specific job that the agent loads only when the task calls for it. Both are plain Markdown and both sit in the repo, so they get mixed up: a huge AGENTS.md stuffed with release checklists, or a pile of skills repeating the same build commands. This guide explains what goes where, with minimal templates for both files.
Summary: what to do
- Put facts about the project in AGENTS.md: how to install, build and test, the folder layout, code conventions and hard rules. Things that are true in every session.
- Put repeatable procedures in skills: a release, a database migration, a changelog entry, a code review checklist. Things you only need sometimes.
- Write the skill description as a trigger: what the skill does and when to use it, including the words people actually type.
- Never put secrets in either file. Reference environment variable names instead.
- Keep both short. If a section of AGENTS.md has become a step-by-step procedure, move it into a skill.
- Review them like code, and fix them when the agent gets something wrong.
Two files, two jobs
| AGENTS.md | SKILL.md | |
|---|---|---|
| Purpose | Project context and standing rules | One task, done the same way every time |
| Location | Repository root, plus optional nested files in subfolders | Its own folder, such as .agents/skills/release-notes/SKILL.md |
| When it loads | At the start of a session | Name and description at startup; the body only when the skill is used |
| Format | Plain Markdown, no required fields | YAML frontmatter (name, description) plus Markdown |
| Extras | None | Optional scripts/, references/ and assets/ folders |
Think of AGENTS.md as the onboarding note you hand every new developer, and skills as the runbooks they open when a specific job comes up.
AGENTS.md: the project briefing
The AGENTS.md format describes itself as a README for agents. It is standard Markdown with no required headings. You put it at the root of the repository, and in a monorepo you can add more files inside subprojects. The format’s guidance is that the closest AGENTS.md to the edited file wins, and that explicit instructions from the user in chat override the file.
Who reads it
Many tools read AGENTS.md, including OpenAI Codex, Cursor, Gemini CLI, GitHub Copilot’s coding agent and others listed on the format’s site. The details differ, so check the tool you actually use:
- Codex reads a global file from
~/.codex, then walks from the project root down to your current folder, using at most one file per folder. Files closer to your working folder come later in the prompt, so they take precedence. AnAGENTS.override.mdin a folder is read instead of that folder’sAGENTS.md. The combined size is capped at 32 KiB by default, according to the Codex documentation. - Claude Code has its own file,
CLAUDE.md. Its memory documentation says it reads AGENTS.md by default only when no CLAUDE.md exists in the working folder or above it. If you need both, a CLAUDE.md that contains the line@AGENTS.mdimports the shared file, and you can add Claude-specific notes below it. - GitHub Copilot accepts one or more AGENTS.md files anywhere in the repo, with the nearest one taking precedence, alongside its own
.github/copilot-instructions.md. See GitHub’s repository instructions docs.
What belongs in it
- A two- or three-sentence project overview.
- Exact commands to install, run, test and lint, in a code block.
- The folder layout, limited to what is not obvious.
- Conventions that differ from defaults: naming, error handling, the test framework, how commits are written.
- Hard rules: files never to edit, commands never to run, when to stop and ask.
- A short list of which skills exist and what they cover, if the team relies on them.
SKILL.md: a packaged procedure
A skill is a folder with a SKILL.md file in it, and optionally scripts, reference files and templates. The format started at Anthropic and is now published as an open Agent Skills specification. The key idea is progressive disclosure: at startup the agent sees only each skill’s name and description, and reads the full body when a task matches. Bundled reference files load only if the instructions point to them.
The frontmatter
The open specification requires two fields:
name: up to 64 characters, lowercase letters, numbers and hyphens, not starting or ending with a hyphen, no double hyphens, and matching the folder name.description: up to 1,024 characters, saying what the skill does and when to use it.
Optional fields include license, compatibility, metadata and an experimental allowed-tools. Individual tools add their own: Claude Code, for example, supports a field that stops the model from invoking a skill on its own, so it runs only when you type its name. Claude Code also treats name as optional and falls back to the folder name, while the open spec and Anthropic’s Agent Skills overview list it as required. We always include both fields so the skill works everywhere.
Where skills live
This is where tools differ most. Claude Code reads .claude/skills/ in the project and ~/.claude/skills/ for personal skills. Codex scans .agents/skills/ from your current folder up to the repo root, plus ~/.agents/skills/. Copilot accepts .github/skills/, .claude/skills/ or .agents/skills/ in a repository. If your team mixes tools, pick one folder that most of them read and confirm the rest in their docs before you commit to it.
What belongs in a skill
- One job with a clear start and finish.
- Numbered steps, in order.
- The expected output format, with one short example.
- Checks to run before reporting back.
- Things to avoid that are specific to this task.
- Long reference material in
references/, and deterministic steps as scripts inscripts/.
What never belongs in either file
Both files are committed, shared and read into the model’s context. Treat them as public within your organization at minimum, and fully public if the repository is.
- No API keys, tokens, passwords, connection strings or private keys. Write
$DATABASE_URL, never its value. - No customer data, internal hostnames you would not publish, or copies of production config.
- No personal details about team members.
Also remember that these files are guidance, not enforcement. Claude Code’s documentation says plainly that its instruction files are treated as context, not configuration, and points to hooks for blocking actions. Use permission settings, deny rules and pre-commit checks for anything that must never happen. Our guide on keeping API keys away from coding agents covers that side.
A minimal AGENTS.md template
# AGENTS.md
## Project
Order management API for an online store. Node.js 20, TypeScript, PostgreSQL.
## Commands
- Install: npm ci
- Dev server: npm run dev
- Tests: npm test
- Lint and types: npm run lint && npm run typecheck
## Layout
- src/routes/ HTTP handlers, one file per resource
- src/services/ business logic, no HTTP code here
- migrations/ SQL migrations, never edit an applied one
## Conventions
- Use the shared logger in src/lib/log.ts, not console.log.
- New code needs tests next to it (*.test.ts).
- Conventional Commits for commit messages.
## Rules
- Secrets come from environment variables only. Never read or print .env files.
- Do not change package versions unless asked.
- Run tests and lint before saying a task is done.
- If a requirement is unclear, stop and ask.
## Skills
- release-notes: drafts release notes from merged pull requests.
To fill in the blanks for your own stack, the free AGENTS.md generator builds a file like this from a short form, and can output a CLAUDE.md as well.
A minimal SKILL.md
release-notes/
├── SKILL.md
└── references/
└── style.md
---
name: release-notes
description: Drafts release notes from merged pull requests since the last git tag.
Use when the user asks for release notes, a changelog entry, or "what shipped"
in a version.
---
# Release notes
## Steps
1. Find the latest tag with `git describe --tags --abbrev=0`.
2. List merged pull requests since that tag.
3. Group them under Features, Fixes and Internal.
4. Write one line per change in plain language, following references/style.md.
5. Show the draft to the user. Do not create a tag or publish anything.
## Output
A Markdown list per group, with the pull request number at the end of each line.
## Avoid
- Do not invent changes that are not in the merged pull requests.
- Do not mention internal ticket links in public notes.
The SKILL.md generator produces this structure with valid frontmatter, which saves a round of fixing name rules by hand.
A quick sorting test
True in every session? AGENTS.md. A sequence of steps for one kind of task? A skill.
| Instruction | Where |
|---|---|
| “Run npm test before finishing” | AGENTS.md |
| “Never edit applied migrations” | AGENTS.md |
| The eight steps to cut a release | Skill |
| How to write a new migration and verify it | Skill |
| A 300-line API style reference | A skill’s references/ folder |
Common mistakes
- A vague description. “Helps with releases” gives the agent nothing to match against. Say what it does and when, in the user’s words.
- Procedures in AGENTS.md. Every line loads in every session, whether or not the task needs it. Long checklists belong in skills.
- Duplicated commands. If five skills each list the test command, one of them will be wrong after the next change. Keep shared facts in AGENTS.md.
- A name that does not match the folder. The open spec requires them to match. Tools vary in how strictly they enforce this, so do not rely on one being lenient.
- Two instruction files that disagree. A CLAUDE.md and an AGENTS.md maintained separately drift apart. Keep one source and import it.
- Installing skills you have not read. A skill can contain scripts. Anthropic’s documentation advises using skills only from trusted sources and auditing everything bundled in one, like installing software.
Keeping both files short and up to date
Length has a cost. Claude Code’s documentation suggests keeping each CLAUDE.md under 200 lines because longer files use more context and reduce adherence. The Agent Skills spec recommends keeping a SKILL.md body under 500 lines and moving detail into reference files one level deep. We aim lower than both: AGENTS.md under 150 lines, and most skills under 100.
- Fix the file when the agent fails. If it ran the wrong test command, correct the command. If it repeats a mistake, add one line about it.
- Delete as often as you add. Remove rules about tools and folders that no longer exist.
- Review in pull requests. A change to AGENTS.md affects every agent session.
- Give each skill an owner who checks it still works when the process behind it changes.
- Test with a real task. After editing a skill, start a fresh session and ask for the job in natural words. If the skill does not load, the description needs work.
If you want this set up and maintained across a team, with shared skills and review rules, our AI automation service can help.
FAQ
Do I need both files?
Start with AGENTS.md. Add a skill when you notice yourself explaining the same multi-step task to the agent a second time.
Can a skill replace AGENTS.md?
Not well. A skill loads only when its description matches the task, so rules that must apply to every session would be missed.
Will the same SKILL.md work in Claude Code, Codex and Copilot?
The core format, a folder with SKILL.md and name and description frontmatter, is shared. Folder locations and extra fields differ, so stick to the open spec’s fields for portability and check where each tool looks.
I already have a CLAUDE.md. Should I rename it?
Not necessarily. Many teams move shared content into AGENTS.md and keep a CLAUDE.md that imports it with @AGENTS.md, plus any Claude-specific notes.
How this article was made: this is our own guide, based on the AGENTS.md format site, the open Agent Skills specification and the official documentation from Anthropic, OpenAI and GitHub linked above. Tool behavior changes between releases, so check the current docs for the agent you use. Templates are examples to adapt to your project.
Sources
- AGENTS.md: a simple, open format for guiding coding agents
- Agent Skills: Specification
- Anthropic: Agent Skills overview
- Claude Code docs: How Claude remembers your project
- Claude Code docs: Extend Claude with skills
- OpenAI Codex: Custom instructions with AGENTS.md
- OpenAI Codex: Build skills
- GitHub Docs: Adding repository custom instructions for GitHub Copilot
- GitHub Docs: Adding agent skills for GitHub Copilot
Written by the CTRL ALT AI team with AI assistance and edited by a person.