Explore skills

Blog / Basics

SKILL.md vs CLAUDE.md vs AGENTS.md: What Goes Where

CLAUDE.md and AGENTS.md hold standing project rules that load every session. SKILL.md holds a procedure that loads on demand. Where each lives, what goes in.

SKILL.md vs CLAUDE.md vs AGENTS.md logos side by side

CLAUDE.md and AGENTS.md hold standing rules that load at the start of a session. SKILL.md holds a procedure that loads only when the task calls for it.

Table of contents

The short answer

The three files answer different questions. CLAUDE.md answers "what should Claude always know about this project?" AGENTS.md answers the same question for tools that read the AGENTS.md convention, Codex among them. SKILL.md answers "how do I do this one job well?" and is read only when that job comes up.

Claude Code's memory documentation draws the line itself: if an entry "is a multi-step procedure or only matters for one part of the codebase," it should move "to a skill or a path-scoped rule instead" (Claude Code memory docs, checked 2026-11-23). That sentence is the rule I follow. Facts and conventions go in CLAUDE.md or AGENTS.md. Procedures go in skills.

I build AI agents full-time, and the mistake I see most often is a 600-line CLAUDE.md that contains three procedures, a style guide and a deployment checklist, all loaded into every session. This article is based on the official docs for Claude Code, Anthropic's Agent Skills and Codex, read on 2026-11-23. Where the docs give no number, I say so.

What CLAUDE.md is

CLAUDE.md is a markdown file of standing instructions for Claude Code. It has no required frontmatter and no special syntax beyond one feature, imports. The docs list these locations: ./CLAUDE.md, ./.claude/CLAUDE.md, ./CLAUDE.local.md and ~/.claude/CLAUDE.md. The user-level file applies to all your projects, and the project files are the ones you commit.

Loading is automatic. CLAUDE.md files load from the working directory and every directory above it at launch, and files in subdirectories load on demand, per the same page. That is a different loading model from a skill: nothing here waits for a trigger.

A CLAUDE.md file can pull in other files with the @path/to/import syntax, which lets you keep a long document split into pieces. There is also a .claude/rules/ folder for rules, which can be scoped to paths so they apply only to part of a codebase.

The docs give a size target: "target under 200 lines per CLAUDE.md file." The reasoning is practical. The file is context on every session, so each line costs tokens whether or not it is relevant.

Good contents are the things you would tell a new teammate on their first day:

# Project notes

- Package manager: pnpm. Never run npm install.
- Tests: `pnpm test` runs unit tests, `pnpm e2e` needs the dev server.
- API handlers live in `src/api/`; shared types in `src/types/`.
- Commit messages: imperative mood, no prefix.

Four lines, each true all the time and each cheap to carry.

What AGENTS.md is

AGENTS.md is a convention for repository instructions that is not tied to one vendor. Codex reads it, and Claude Code can read it under one condition.

On the Claude Code side, the memory docs state: "Claude can also read a repository's AGENTS.md files in place of CLAUDE.md." The rule is exact: "By default, Claude reads AGENTS.md only when you have no CLAUDE.md in your working directory or above it." Reading AGENTS.md directly "requires Claude Code v2.1.277 or later." So the file is a fallback. If a CLAUDE.md exists in your working directory or above, Claude Code uses that and does not read AGENTS.md by default. The docs also describe importing, so a CLAUDE.md can pull an AGENTS.md in with @AGENTS.md and let one file serve both tools. Check the memory page for the current wording before relying on the details, since the feature is recent.

On the Codex side, the Codex AGENTS.md guide describes a discovery order. At the global level, Codex checks AGENTS.override.md and then AGENTS.md in the Codex home directory (default ~/.codex), and uses "only the first non-empty file at this level." For a project, it walks from the repository root down to the working directory, taking "at most one file per directory." Then "Codex concatenates files from the root down, joining them with blank lines," and it stops at project_doc_max_bytes, which is 32 KiB by default. If you want Codex to look for other file names, the docs name a project_doc_fallback_filenames setting.

Two practical consequences follow from the 32 KiB limit and the root-down concatenation. A long AGENTS.md at the repository root can crowd out the nested files that come after it, so keep the root file short. And a nested AGENTS.override.md or AGENTS.md near the code you are editing is the right place for rules that apply only there.

What SKILL.md is

SKILL.md is the entry file of a skill, a folder that teaches the agent one job. It differs from the other two in three ways: it has required frontmatter, it loads on demand, and it can travel with scripts and reference files.

The frontmatter requires name and description. Anthropic's overview gives the limits: name is at most 64 characters of lowercase letters, numbers and hyphens, and description is non-empty and at most 1,024 characters (Agent Skills overview). The Codex docs repeat the requirement: "The SKILL.md file must include name and description" (Codex skills docs).

Loading follows what Anthropic calls levels. Metadata is always loaded at startup at "~100 tokens per Skill." The instructions load when the skill triggers and run "under 5k tokens," and bundled resources cost "none until accessed." Claude Code says the same in its own words: "In a regular session, skill descriptions are loaded into context so Claude knows what's available, but full skill content only loads when invoked."

Skills live in ~/.claude/skills/<skill-name>/SKILL.md for all your projects, in .claude/skills/<skill-name>/SKILL.md for one repository, or inside a plugin (Claude Code skills docs). Codex scans .agents/skills from the working directory up and $HOME/.agents/skills for user skills.

Here is a small one, to set against the CLAUDE.md example above:

---
name: release-checklist
description: Run the release checklist for this repo. Use when the user says "cut a release", "ship it", or asks what is left before a release.
---

# Release checklist

1. Run `pnpm test` and `pnpm e2e`; stop on any failure.
2. Bump the version in `package.json` and update `CHANGELOG.md`.
3. Tag with `git tag vX.Y.Z` and push the tag.
4. Draft release notes from merged pull requests.

This is a procedure with ordered steps that matters only on release day. It does not belong in a file that loads every morning.

A skill also differs in what it can carry. The folder can hold scripts, and Anthropic's overview says Claude "runs them through bash and receives only the output (the script code itself never enters context)." A CLAUDE.md file is text only.

Real skills show the range of what goes in this file. wcag by @aishac is an accessibility advisor for WCAG 2.0, 2.1 and 2.2. soc2 by @vera_963 covers the five Trust Services Criteria. design by @elena_async guides UI and design critique. Each is a body of procedure and reference knowledge that would be wasteful to load every session, which is the test for a skill.

Fact table

SKILL.md CLAUDE.md AGENTS.md
Purpose One job, with steps, loaded when relevant (Agent Skills overview) Standing project instructions for Claude Code (memory docs) Repository instructions read by Codex, and by Claude Code as a fallback (memory docs)
Frontmatter Required: name, description (Codex docs) None required None required
Where it lives ~/.claude/skills/<name>/, .claude/skills/<name>/, or a plugin (skills docs) ./CLAUDE.md, ./.claude/CLAUDE.md, ./CLAUDE.local.md, ~/.claude/CLAUDE.md (memory docs) Repository directories; ~/.codex for Codex global (AGENTS.md guide)
When it loads Description at startup, body when invoked (skills docs) At launch from the working directory and every directory above; subdirectories on demand (memory docs) Claude Code: only when no CLAUDE.md exists (memory docs). Codex: concatenated root down (AGENTS.md guide)
Size guidance Body under 500 lines (best practices); description up to 1,024 characters Under 200 lines per file (memory docs) Codex stops at 32 KiB by default (AGENTS.md guide)
Can import other files Reference files in the folder, read as needed Yes, with @path/to/import (memory docs) Claude Code can import it from CLAUDE.md; Not listed for AGENTS.md importing others
Can bundle scripts Yes (Agent Skills overview) No No
Works in Codex Yes, from .agents/skills (Codex docs) Not read by default; fallback file names are configurable Yes, native (AGENTS.md guide)

Limits and versions change, so check the official pages (check date 2026-11-23). Cells marked "Not listed" are things the docs do not state.

Context cost

The cost difference is the main reason to split the files.

CLAUDE.md and AGENTS.md are paid for in every session they apply to. The costs documentation advises to "move instructions from CLAUDE.md to skills" and to keep CLAUDE.md under 200 lines, because "skills load on-demand only when invoked" (Claude Code costs docs).

A skill costs its description every turn and its body when it fires. Claude Code's docs say, "Every skill in the skill listing adds to your context on every turn, whether or not Claude ever uses it." There is a budget behind that: the listing "always contains every skill name," but with many skills Claude Code "drops some descriptions to fit the listing's character budget," scaled at 1% of the model's context window, dropping the least-used first. Each entry's combined description and when_to_use text is capped at 1,536 characters. Codex has a parallel limit: its skill list uses "at most 2% of the model's context window" by default, or 8,000 characters when the window is unknown.

Once a skill is invoked, its rendered content enters the conversation as a single message and stays across later turns, and the docs say Claude Code does not re-read the file on later turns. After compaction, the most recent invocation of each skill is re-attached, keeping the first 5,000 tokens of each, within a combined 25,000-token budget. For what a long context costs per request, and when /clear beats /compact, see this breakdown of context size and cost in Claude Code.

What does this mean in practice? A rule that applies to ninety percent of tasks is cheaper in CLAUDE.md than in a skill, because a skill carries the overhead of a description and a trigger. A rule that applies to ten percent of tasks is cheaper in a skill, because the other ninety percent of sessions never load it. The exact break-even depends on your setup. /context shows what is using space in a Claude Code session, and /skill-doctor reports skill cost and usage.

Pick CLAUDE.md if, pick AGENTS.md if, pick SKILL.md if

Pick CLAUDE.md if:

  • The rule is true for nearly every task in the repository.
  • It is a fact or a convention: a command, a path, a style rule, a "never do this."
  • You use Claude Code and want one file for it that you can import from others.

Pick AGENTS.md if:

  • Your team uses Codex or another tool that reads AGENTS.md, and you want one source of truth for the repository.
  • You do not have a CLAUDE.md, so Claude Code reads AGENTS.md directly (v2.1.277 or later).
  • You prefer a vendor-neutral file name in the repository root.

Pick SKILL.md if:

  • The content is a procedure, a checklist or a body of reference knowledge for one job.
  • It is long, and most sessions will not need it.
  • You want it to work across Claude Code and Codex, since both read the same SKILL.md format.
  • It needs scripts or reference files.

If a piece of content fits two columns, ask how often it is needed. Frequent needs go in the always-loaded file, rare ones in a skill.

Using them together

The three files compose well, and most repositories end up with all of them.

A typical split: CLAUDE.md or AGENTS.md has a short list of commands and conventions, and it points to skills by name for the longer procedures. A skill's description is what lets Claude find it, so a one-line pointer in CLAUDE.md is usually unnecessary. Where one helps is when the skill's trigger is subtle. A line like "for releases, use the release-checklist skill" is a cheap hint.

If you run both Claude Code and Codex on the same repository, you have a choice. One option is a single AGENTS.md and a CLAUDE.md that imports it with @AGENTS.md, which the docs support. The other is to keep a separate CLAUDE.md for Claude-only notes. The import route keeps one source of truth, and the docs' default (AGENTS.md read only when no CLAUDE.md exists) is the reason you need the import.

Skills share more readily than memory files. Both agents read SKILL.md with name and description, though Claude Code looks in ~/.claude/skills/ and Codex in ~/.agents/skills/. Codex has an agents/openai.yaml file with an allow_implicit_invocation setting that defaults to true, and Claude Code has its own fields such as disable-model-invocation. Those extras do not transfer between the agents.

Ragspaces is an open catalog of 5,299 agent skills for Claude Code and Codex (home page count on 2026-11-23), and its pages show each skill's description and README without an account. For memory files, Ragspaces does nothing: it is a skills catalog and sync layer, and CLAUDE.md and AGENTS.md belong in your repository. For how skills get from a catalog onto your machine, see the install methods compared, and for how the pieces relate, the earlier post on skills vs MCP servers vs plugins. See how it works if you want the sync details.

A worked example

Take a web repository with 450 lines of agent instructions in a single CLAUDE.md. Here is how I would split it, as a worked exercise.

  1. Keep in CLAUDE.md: package manager, how to run tests, directory map, commit style. About 20 lines. These apply to almost every task.
  2. Move to a skill named release-checklist: the release steps, about 40 lines. They matter on release days only.
  3. Move to a skill named a11y-review: the accessibility rules the team applies to new components, about 150 lines. They matter when building or reviewing UI. A published skill such as wcag may already cover the general part, and your repository-specific rules stay in your own skill.
  4. Move to a path-scoped rule or a nested file: the rules for the payments/ directory, about 60 lines, which matter only there.
  5. Delete the rest: the stale and the duplicated.

The result is a short CLAUDE.md that loads every time and a few skills whose descriptions cost a line or two each. The description wording then decides whether each skill fires, and I cover that in the post on descriptions.

If the same repository also has Codex users, add an AGENTS.md at the root with the same 20 lines, or import it from CLAUDE.md. The skills stay as they are, because both agents read them.

Common mistakes

Putting procedures in CLAUDE.md. A procedure belongs in a skill, per the docs. It loads every session, whether or not the task needs it.

Assuming both files are read. By default, Claude Code reads AGENTS.md only when no CLAUDE.md exists in the working directory or above. If you have both and want both followed, import one from the other.

Letting a root AGENTS.md grow. For Codex, root-down concatenation and a 32 KiB default cap mean a long root file leaves less room for nested files.

Writing a skill with a vague description. Claude uses the description to choose from potentially 100 or more skills, per Anthropic's best practices, and "Helps with documents" does not say when to use it.

Confusing the folders. ~/.claude/skills/ is for Claude Code, ~/.agents/skills/ is for Codex, and .claude/commands/ is the older command format that, per the docs, has been merged into skills and still works.

Frequently asked questions

Does Claude Code read AGENTS.md?

Yes, in one case. By default, Claude Code reads AGENTS.md only when you have no CLAUDE.md in your working directory or above it, and this needs v2.1.277 or later. If you have both files, import AGENTS.md from CLAUDE.md with @AGENTS.md.

What is the difference between CLAUDE.md and SKILL.md?

CLAUDE.md holds standing instructions that load at the start of a session. SKILL.md holds one job's instructions, and only its name and description sit in context until the skill is used. Procedures and long reference material belong in a skill.

How long should a CLAUDE.md file be?

The Claude Code docs say to target under 200 lines per file. Longer files cost tokens every session. Move multi-step procedures to skills and area-specific rules to path-scoped rules.

Does Codex read CLAUDE.md?

Not by default, according to the Codex docs on AGENTS.md discovery. They do name a setting, project_doc_fallback_filenames, for other file names, so check the current docs for whether it fits your case.

Can one skill work in both Claude Code and Codex?

Often yes. Both follow the open Agent Skills standard and read a SKILL.md with name and description. They scan different folders, and each has extra frontmatter fields that the other ignores.

What is the size limit for AGENTS.md in Codex?

Codex stops reading project instructions at project_doc_max_bytes, which is 32 KiB by default. It concatenates files from the repository root down, so keep the root file short to leave room for nested ones.

Key takeaways

  • CLAUDE.md and AGENTS.md carry standing rules, and SKILL.md carries a procedure that loads on demand.
  • Claude Code reads AGENTS.md only when no CLAUDE.md exists, and a CLAUDE.md can import it with @AGENTS.md.
  • Keep CLAUDE.md under 200 lines, and move multi-step procedures into skills.
  • Codex concatenates AGENTS.md files from the root down and stops at 32 KiB by default.
  • Skills are the one format that moves between Claude Code and Codex without changes.

The bottom line

Put what is always true in CLAUDE.md or AGENTS.md, and put what you do occasionally in a skill. When a file fits both, count how often a session needs it. To read real skills before you write your own, browse the Ragspaces catalog. Pages show the description and README with no account.

Related articles

About this research

Dmitry Makarenko co-founded Zipy as VP R&D, leading 50+ engineers across five countries, and now builds AI agents full-time. (LinkedIn)

This article is based on the Claude Code documentation (memory, skills, costs), Anthropic's Agent Skills overview and best practices, OpenAI's Codex skills and AGENTS.md documentation, and the Ragspaces skill pages, all read on 2026-11-23. The worked example is an illustration built on those docs. Content reviewed and updated: 2026-11-26

Keep reading