Agent Skills Guide: One SKILL.md for Claude Code, OpenCode and Codex

17 min read

,
Anthropic illustration of nested green, blue and pink grids on a blue background, representing layers of skill context loading

Put a checklist you keep pasting into chat in a SKILL.md file, and Claude Code, OpenCode and Codex can all use it. Agent Skills work well for jobs you repeat, such as reviewing a Docker Compose file before you deploy.

Keep the skill in .agents/skills for Codex and OpenCode. Add a symlink for each skill in .claude/skills so Claude Code can find it too. Keep the shared file to the standard fields unless you need a feature specific to one tool.

What an agent skill is

A skill is a directory that contains, at minimum, a SKILL.md file. The file starts with YAML frontmatter (a name and a description) followed by plain Markdown instructions. Anything else in the folder is optional: a scripts/ folder for code the agent can run, a references/ folder for longer documentation and an assets/ folder for templates or data files.

Anthropic diagram showing an agent configuration with equipped skills such as bigquery, docx, nda-review and pdf, and the matching skill folders with SKILL.md and reference files on the agent computer file system
Image: Anthropic

The format started at Anthropic and is now published as an open standard at agentskills.io. Claude Code says its skills follow that standard and add extra features on top. OpenAI’s Codex documentation says Codex skills build on the same open standard, and OpenCode reads the same folder layout and accepts the standard’s portability fields. That shared base is why one skill folder can serve all three tools.

A skill is not a plugin or an MCP server. It does not add new tools by itself. It gives the agent instructions and files, and the agent uses the tools it already has (reading files, running shell commands) to follow them. That makes skills cheap to write: if you can describe a procedure in Markdown, you can turn it into a skill.

How Agent Skills load: names first, instructions later

Agents first see the skill’s name and description. They read the instructions when the skill is called and open supporting files as needed.

  • Metadata (about 100 tokens per skill): the name and description of every available skill load at startup, so the agent knows what exists.
  • Instructions (under 5,000 tokens recommended): the full SKILL.md body loads only when the agent decides the skill matches the task, or when you call it by name.
  • Resources (as needed): files in scripts/, references/ or assets/ load only when the instructions point the agent at them.
Anthropic diagram of a context window where short snippets from each skill sit in the system prompt, the user asks Claude to fill out a PDF, and Claude reads pdf/SKILL.md and then forms.md with Bash tool calls
Image: Anthropic

This is why the description matters more than anything else in the file. It is the only part the agent sees before it decides whether to open the skill. A vague description such as “Helps with PDFs” rarely triggers; one that says what the skill does and when to use it, with the words people actually type, does.

Each tool also caps how much room the skill list can take. Claude Code sizes its skill listing at 1% of the model’s context window and cuts each entry’s description (plus the optional when_to_use text) at 1,536 characters. Codex keeps its initial list to at most 2% of the context window, or 8,000 characters when it does not know the window size, and shortens descriptions first when many skills are installed. OpenCode lists the ID, name and description of each permitted skill at every model step. In all three, put the key use case at the start of the description so it survives any trimming.

Where Claude Code, OpenCode and Codex look for skills

Codex and OpenCode both read .agents/skills, the closest thing to a neutral location. Claude Code reads .claude/skills, and OpenCode reads that too for compatibility. Claude Code’s skills documentation does not list .agents/skills as a location, so Claude Code needs a little help to share a folder.

ScopeClaude CodeOpenCodeCodex CLI
Project.claude/skills/<name>/SKILL.md, from the start folder up to the repository root.opencode/skills, plus .claude/skills and .agents/skills, from the current folder up to the project root.agents/skills in every folder from the current working directory up to the repository root
Personal or global~/.claude/skills/<name>/SKILL.md~/.config/opencode/skills, plus ~/.claude/skills and ~/.agents/skills$HOME/.agents/skills
Machine-wideEnterprise skills in the managed settings directoryExtra folders or HTTP catalogs listed in the skills array of opencode.json/etc/codex/skills (admin scope)
Built inBundled skills such as /code-review, /debug and /loopBuilt-in skillsskill-creator and skill-installer
Nested foldersSkills in a subfolder’s .claude/skills load once Claude reads or edits a file thereIncluded at every level between the current folder and the project rootEvery .agents/skills between the working directory and the repository root
Symlinked skill foldersSupported; a skill reached through several links loads onceNot covered in the skills docsSupported; Codex follows the symlink target
OpenAI Codex CLI terminal window showing a prompt to speed up prefix search, an edited index.py diff, a passing test run and a bench.md file open in a side pane
Image: OpenAI

When two skills share a name, the tools resolve it differently. In Claude Code, enterprise beats personal and personal beats project, so a deploy skill in ~/.claude/skills wins over the project’s deploy. OpenCode picks by ID, and the source registered later wins: project .opencode/skills beats the global OpenCode folder, which beats .agents/skills, which beats .claude/skills. Codex does not merge or override; if two skills share a name, both can show up in its skill selectors. The safe habit is simple: give every skill a unique name.

SKILL.md frontmatter: which fields each tool reads

The open standard defines six frontmatter fields. Only two are required by the spec: name (up to 64 characters, lowercase letters, numbers and single hyphens, matching the folder name) and description (up to 1,024 characters, saying what the skill does and when to use it). The other four are optional: license, compatibility (up to 500 characters of environment requirements), metadata (a map of your own keys and values) and allowed-tools, which the spec marks experimental.

FieldClaude CodeOpenCodeCodex CLI
nameOptional; sets the slash command, defaults to the folder nameDisplay label only; the skill ID comes from the file pathRequired
descriptionRecommended; falls back to the first line of the bodyNeeded for the model to discover the skillRequired; drives implicit invocation
license, compatibilityAccepted, not acted onAccepted, not interpretedNot mentioned in the skills docs
metadataFree-form map for your own toolingopencode/autoinvoke: false hides the skill from the modelNot mentioned; Codex uses agents/openai.yaml instead
allowed-toolsPre-approves listed tools for the turn that invokes the skillNot mentioned in the skills docsNot mentioned in the skills docs
disable-model-invocationOnly you can invoke the skillSame effect as opencode/autoinvoke: falseUse policy.allow_implicit_invocation: false in agents/openai.yaml
Claude-only extraswhen_to_use, argument-hint, arguments, user-invocable, model, effort, context: fork, agent, hooks, paths, shell and moreNot supportedNot supported

Claude Code ignores a field it does not recognise without an error, and if the YAML fails to parse it still loads the skill with no fields set, so /skill-name works but automatic matching does not. OpenCode does not enforce the naming pattern, the length limits or a match between name and the folder, but it recommends the same lowercase kebab-case IDs as the spec. If you want a skill that works everywhere, stick to the spec’s rules even where a tool would let you get away with less.

When a skill beats AGENTS.md, CLAUDE.md or a rule

Skills, instruction files and rules overlap, and it is easy to put things in the wrong place. Claude Code’s own guidance draws the line clearly: keep CLAUDE.md for facts the agent needs in every session, and move a multi-step procedure, or anything that only matters for one part of the codebase, into a skill or a path-scoped rule. The same thinking works for AGENTS.md in Codex and OpenCode.

  • Use AGENTS.md or CLAUDE.md for short, always-true facts: build and test commands, folder layout, naming conventions, “never commit to main”. These load in every session, so every line costs context all the time.
  • Use a skill for procedures and reference material you need sometimes: cutting a release, reviewing a Docker Compose file, writing a migration, a long API style guide. The body costs almost nothing until the task comes up.
  • Use a path-scoped rule (Claude Code’s .claude/rules/ files with a paths field) for guidance tied to certain files, such as conventions for src/api/**. Claude Code skills also accept a paths field, but that is not portable.
  • Use a hook or a permission rule for anything that must happen every time. Claude Code’s docs are blunt here: if a rule must hold on every edit, put it in a hook, because a skill is guidance the model can drift away from.

If you keep pasting the same checklist into chat, move it into a skill and give it a description that says when to use it.

Step 1: Write your first skill

The example below is a skill for reviewing Docker Compose files before you deploy, the kind of check that is easy to forget on a home server. It uses only spec fields, so all three tools can read it. Create the folder in the shared .agents/skills location at the root of your project:

mkdir -p .agents/skills/compose-review

Then save this as .agents/skills/compose-review/SKILL.md:

---
name: compose-review
description: Reviews Docker Compose files for risky settings before deploy. Use when the user asks to check, review or harden a docker-compose.yml or compose.yaml file, or before running docker compose up on a changed stack.
license: MIT
compatibility: Needs Docker with the compose plugin
---

# Compose review

1. Find the compose file the user means. If there are several, ask which one.
2. Check every service for:
   - image tags that are missing or set to latest
   - a restart policy
   - ports published on all interfaces that only need to be local
   - secrets written directly in the file instead of an env file
3. Report findings as a short list grouped by service, most serious first.
4. Suggest exact edits, but do not change the file unless the user asks.
Anthropic diagram of a simple SKILL.md file for a pdf skill, with YAML frontmatter holding the name and description at the top and Markdown instructions with an overview and quick start code below
Image: Anthropic

A few things make this skill trigger reliably. The name matches the folder and follows the spec’s lowercase-and-hyphens rule. The description opens with what the skill does, then lists the phrases a person would actually type. The body uses short imperative steps with a clear output, which OpenAI’s Codex docs recommend. Keep the main file under 500 lines, the guideline in both the spec and Claude Code’s docs.

Codex also ships a guided route: type $skill-creator in Codex CLI and it asks what the skill does, when it should trigger and whether it needs scripts, then drafts the skill for you.

Step 2: Add a script and a reference file

Instructions are good for judgement. For checks that should give the same answer every time, a script is better, and long checklists belong in a reference file the agent only opens when needed. Lay out the folder like this:

compose-review/
  SKILL.md
  scripts/
    validate.sh
  references/
    checklist.md

Save a small validator as scripts/validate.sh and make it executable with chmod +x:

#!/usr/bin/env bash
# Usage: validate.sh path/to/compose.yaml
set -euo pipefail
file="${1:-compose.yaml}"
docker compose -f "$file" config --quiet
echo "OK: $file parses"
grep -nE 'image: [^:]+$|:latest' "$file" && echo "WARN: unpinned image tags above" || true
Anthropic diagram showing pdf/SKILL.md pointing to two bundled files, reference.md with an advanced PDF processing reference and forms.md with form filling instructions, loaded only when needed
Image: Anthropic

Then tell the agent when to use each file. Add this to the end of SKILL.md:

## Bundled files

- Before reviewing, run scripts/validate.sh with the compose file path.
  If it fails, show the error and stop.
- For the full hardening checklist, read references/checklist.md.

The spec asks for paths relative to the skill folder and for references only one level deep, so avoid a reference file that points to another reference file. Each tool helps the agent find the folder: OpenCode passes the skill’s base directory and a sample of up to ten supporting file paths when it loads a skill, Codex includes each skill’s file path in its list, and Claude Code offers a ${CLAUDE_SKILL_DIR} variable (Claude Code only) that expands to the skill’s folder.

Claude Code also documents a few body features that other tools do not, such as !`command` lines that run a shell command and inline the output before Claude reads the skill, and $ARGUMENTS placeholders. They are handy in a Claude-only skill, but OpenCode and Codex do not document them, so keep them out of a skill you plan to share.

Step 3: Share one skills folder across all three tools

With the skill in .agents/skills, Codex and OpenCode already find it. Claude Code needs a pointer from .claude/skills. Its docs say a skill folder in the personal, project or enterprise location can be a symlink to a directory elsewhere on disk, and that Claude Code reads SKILL.md from the target and loads the skill only once. Link each skill from the project root:

mkdir -p .claude/skills
ln -s ../../.agents/skills/compose-review .claude/skills/compose-review
ls -l .claude/skills

The link target is relative, so the repository still works after someone clones it to another path. Commit both the .agents/skills folder and the link. Do the same for personal skills that should follow you into every project:

mkdir -p ~/.agents/skills ~/.claude/skills
mv ~/my-skills/release-notes ~/.agents/skills/
ln -s ~/.agents/skills/release-notes ~/.claude/skills/release-notes
OpenCode terminal interface in a light theme showing a code diff for SAVE10 discount support, a passing bun test run, a summary of the change and a context panel with token usage
Image: OpenCode

Codex reads .agents/skills and ~/.agents/skills directly. Claude Code reads the symlinks in .claude/skills and ~/.claude/skills. OpenCode reads both .agents/skills and .claude/skills, so it finds the same skill twice under the same ID; because .agents/skills is registered after .claude/skills, that copy wins, and since both point at the same files, nothing changes. Do not also put a copy in .opencode/skills unless you want OpenCode to use a different version, because that folder overrides both.

Other agents that follow the standard can often read the same folder. Command Code, for example, also discovers .agents/skills, as we covered in whether OpenCode skills work in Command Code. Linking whole skills directories instead of individual skill folders is not described in Claude Code’s docs, so link each skill folder on its own.

Step 4: Control when a skill runs

By default all three tools can pick a skill on their own when a request matches its description, and you can also call one by name. For anything with side effects, such as a deploy or a message to a team channel, you usually want the agent to wait for you.

  • Claude Code: type /compose-review to run it. Add disable-model-invocation: true to the frontmatter so only you can start it; the description then leaves Claude’s context entirely. user-invocable: false does the opposite and hides it from the / menu. In permission rules, Skill(deploy *) in the deny list blocks a skill, and denying Skill turns skills off altogether.
  • OpenCode: mention @compose-review in your prompt to load it yourself. The model loads skills through a skill tool using the exact ID. disable-model-invocation: true works here too, as does metadata with opencode/autoinvoke: false; either keeps the skill out of the model’s list while leaving it loadable by ID. Permission rules with the skill action can allow, ask or deny by ID pattern.
  • Codex CLI: run /skills or type $compose-review in your prompt. To stop implicit use, add agents/openai.yaml to the skill folder with policy set to allow_implicit_invocation: false. To switch a skill off without deleting it, add a [[skills.config]] entry with enabled = false in ~/.codex/config.toml.

Since disable-model-invocation is honoured by both Claude Code and OpenCode, put it in SKILL.md and add the small Codex file next to it for a manual-only skill that behaves the same in all three:

# .agents/skills/deploy/agents/openai.yaml
policy:
  allow_implicit_invocation: false

The Codex equivalent for turning a skill off looks like this. Use either a path or a name in each entry, not both; when several entries match, the last one wins:

[[skills.config]]
name = "compose-review"
enabled = false

Step 5: Check that each tool found the skill

Do not assume a skill loaded just because the file exists. Each tool has a quick check:

  • Claude Code: ask “What skills are available?” or open the / menu. Claude Code watches skill folders and picks up new or edited skills during a session; if one does not appear, run /reload-skills. claude plugin validate .claude/skills flags SKILL.md files whose frontmatter does not parse, and /doctor estimates how much context the skill listing uses.
  • OpenCode: load the skill directly with @compose-review. If it is missing, remember the ID comes from the folder path, not the name field, and is case-sensitive.
  • Codex CLI: run /skills to see the list. Codex detects skill changes automatically; if an update does not show, restart Codex.
  • Any tool: the reference validator from the Agent Skills project checks frontmatter and naming with skills-ref validate ./compose-review.

Then test the trigger. Ask something that matches the description without naming the skill, such as “check my compose file before I deploy”, and confirm the agent reaches for it. If you are new to running these agents, our guides to Claude Code with Ollama and Codex CLI and OpenCode with Ollama cover installation and local models.

Claude Code vs OpenCode vs Codex: Agent Skills compared

Claude CodeOpenCodeCodex CLI
Shared folder it reads.claude/skills (needs symlinks to share).agents/skills and .claude/skills.agents/skills
Call a skill yourself/skill-name@skill-id$skill-name or /skills
What names the skillFrontmatter name or folder nameFile path (ID); name is a labelFrontmatter name
Manual-only switchdisable-model-invocation: truedisable-model-invocation: true or opencode/autoinvoke: falseallow_implicit_invocation: false in agents/openai.yaml
Turn off without deletingskillOverrides set to "off" in settingsPermission rule with deny[[skills.config]] with enabled = false
Skill list budget1% of context window; 1,536 characters per entryNot stated2% of context window or 8,000 characters; skills.max_context_tokens up to 10,000 tokens
Picks up edits liveYes; /reload-skills as a fallbackLists skills at each model stepYes; restart if an update is missing
Extras beyond the specArguments, shell injection, subagents, hooks, paths, per-skill modelHTTP skill catalogs, extra folders via skills configagents/openai.yaml UI metadata and tool dependencies, plugins

Once invoked, a skill’s content stays in the conversation, and Claude Code does not re-read the file on later turns. After the conversation is compacted, it re-attaches only the first 5,000 tokens of each recent skill, within a combined 25,000-token budget. Put the most important instructions near the top of SKILL.md.

Troubleshooting Agent Skills

ProblemLikely causeFix
Skill never triggers on its ownDescription is vague or missing trigger wordsRewrite the description to say what it does and when, with words users type; front-load the key use case
Claude Code skill works with /name but never automaticallyFrontmatter YAML failed to parse, so the skill loaded with no fieldsCheck that --- is the first line; run claude --debug or claude plugin validate .claude/skills
Codex and OpenCode see the skill, Claude Code does notSkill lives only in .agents/skillsAdd a symlink in .claude/skills for each skill folder
OpenCode cannot find a skill by nameOpenCode uses the path-derived ID, not nameUse the folder name, exactly as cased, with @
OpenCode loads an old versionA later source defines the same ID, such as .opencode/skillsRemove the duplicate or rename one skill
Claude Code runs the wrong skillA personal skill with the same name beats the project oneRename one of them; names should be unique
Codex shows two entries with one nameCodex does not merge same-named skillsRename or disable one with [[skills.config]]
Descriptions look cut offToo many skills for the listing budgetTrim descriptions; in Claude Code raise skillListingBudgetFraction, in Codex set skills.max_context_tokens
Skill triggers too oftenDescription is too broadNarrow the description or make the skill manual-only
Claude stops following a skill midwayConversation was compacted, or the rule should be enforcedInvoke the skill again; move must-hold rules into a hook
Skill missing in Claude Code cloud sessionsCloud and Cowork sessions do not read ~/.claude/skillsCommit the skill to the repository’s .claude/skills or enable it for your claude.ai account

My take

I’d start with the checklist you use most often. A release checklist is a good fit because you can keep the steps and reference files together, then ask any of the three tools to use them.

Save the tool-specific tricks, like Claude Code’s shell injection or Codex’s agents/openai.yaml interface fields, for skills you only use in one agent. The portable core is plain Markdown and a good description, and that is what makes a skill worth sharing.

Frequently asked questions

Do I need different SKILL.md files for each tool?

No. A skill that uses only the spec fields (name, description and the optional license, compatibility, metadata and allowed-tools) loads in all three. Only tool-specific extras, such as Claude Code’s context: fork or Codex’s agents/openai.yaml, are ignored or unsupported elsewhere.

Are skills the same as Claude Code custom slash commands?

Claude Code has merged custom commands into skills. Files in .claude/commands/ still work, but a skill folder can also hold scripts and reference files. Moving .claude/commands/deploy.md to .claude/skills/deploy/SKILL.md keeps the /deploy command.

How many skills can I install?

There is no hard count in the docs, but each skill’s name and description use context on every turn. When the list overflows its budget, Claude Code drops descriptions for the skills you use least, and Codex shortens descriptions first and may leave some skills out with a warning. Keep the set focused and switch off skills you never use; Claude Code’s /skill-doctor reports which ones are never invoked.

Can a skill run scripts on my machine?

Yes, through the agent’s normal shell tool, so your usual permission prompts still apply. In Claude Code, allowed-tools can pre-approve specific commands for the turn that invokes the skill. Treat skills from other people like any script you download: read SKILL.md and everything in scripts/ before you install it.

Should skills go in Git?

Project skills, yes. Committing .agents/skills and the .claude/skills links means everyone on the repository, and each of their agents, gets the same procedures. Keep personal habits in ~/.agents/skills instead, and never put secrets or tokens in a skill file.

About the author