Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Codex Agent Skills System

Codex Agent Skills System

Agent Skills is an open skill organization format that can organize task instructions, scripts, and reference materials into reusable skills, allowing AI Agents to complete work according to a specified process.

In Codex, we can extend its working capabilities through Skills. For example, have Codex review code, generate tests, write technical documentation, or process data files according to fixed specifications.

Unlike manually typing a long prompt each time, Skills can save frequently used operation flows and reuse them when needed.

A Skill is essentially a directory containing SKILL.md files. This file is responsible for describing the purpose, applicable scenarios, and specific execution steps of the skill.

For example, a simple Skill directory can be:

my-skill/

├── SKILL.md           # 必需:技能说明与执行指令

├── scripts/           # 可选:Python、Shell 等脚本

├── references/        # 可选:参考文档

└── assets/            # 可选:模板、图片等资源

Among these, only SKILL.md is required. For simple tasks, only this file is needed to create a Skill.

What are Agent Skills?

Skills can be understood as a set of reusable operation instructions provided to an AI Agent.

For example, we want Codex to always follow these requirements when checking Python code:

Without a Skill, you may need to re-enter these requirements every time.

After creating a code review Skill, you can simply tell Codex:

使用 python-code-review 技能,检查当前项目的 Python 代码。

Codex will read the relevant skill description and execute the task according to the defined rules.

Skills can be used in Codex CLI, IDE extensions, and desktop apps that support skills. Some skills can also be packaged through Plugins for use in other supported ChatGPT environments.

Note that a Skill itself mainly provides operation instructions and related resources; it does not mean it automatically gains extra permissions. What operations can actually be performed still depends on the tools and runtime environment currently available to Codex.

The Difference Between Skills, MCP, and Plugins

When using Codex, you often encounter the three concepts of Skills, MCP, and Plugins at the same time.

Concept Main purpose Typical use
Skills Provide task instructions, operation flows, and related resources Code review, documentation generation, testing specifications
MCP Connect external tools, data sources, and services Access databases, query external systems
Plugins Package and distribute skills, MCP, and other integration capabilities Team sharing, installing extended features

For example, a Skill that generates sales reports can specify how to analyze data, draw charts, and organize results; MCP can provide tools to access business databases; and a Plugin can package and distribute these capabilities.

The three can be used together, but a simple Skill does not need to configure both MCP and Plugin.

Viewing Codex Skills

In Codex clients that support Skills management, you can view installed skills and also use the built-in creation tool to write new skills.

Codex Skills Management Interface

Codex provides skill-creator, which can create or modify Skills through conversation.

Creating Skills with Codex Skill Creator

After creation, you can view the corresponding skill in the skill list.

Skills Installed in Codex

How Skills Work

Codex can install multiple Skills at the same time, but it does not read the complete content of all skills at the start of every task.

To reduce context usage, Codex uses a Progressive Disclosure mechanism.

Progressive Disclosure

Skill loading is usually divided into the following stages:

  1. **Discover skills:** Codex reads information such as the skill's name, description, and file path.
  2. **Select skill:** Decide which Skill to use based on the skill explicitly specified by the user or the match between the current task and the skill description.
  3. **Read instructions:** Load the corresponding SKILL.md files.
  4. **Read resources:** Access relevant scripts, reference documents, or templates as needed by the task.
  5. **Execute task:** Follow the skill instructions and use the tools available in the current environment to complete the work.

For example, installing 20 Skills does not mean Codex will put the complete content of all 20 skills into the model context every time.

Codex's initial skill list has a context budget limit: at most about 2% of the model context window; when the context window size cannot be determined, a budget of 8,000 characters is used.

When there are many skills, Codex may shorten descriptions and, if necessary, omit some skills from the initial list and issue a warning.

This limit mainly applies to the initial skill list and does not mean a selected Skill can only use so little content.

Skill Invocation Methods

Codex supports two main methods: explicit invocation and implicit matching.

Explicit Invocation and Implicit Matching of Codex Skills

1. Explicit invocation

Explicit invocation means the user clearly specifies which Skill to use.

In Codex CLI or IDE extensions, you can use /skills to view or select skills, or you can use $ to reference a skill.

For example:

$python-code-review 检查当前项目的代码

Here, $python-code-review is a skill reference in a Codex conversation, not an ordinary Shell command in the terminal.

2. Implicit matching

Implicit matching means the user does not explicitly specify a skill, but Codex determines whether a skill applies based on the current task and the Skill's description to decide whether a skill is applicable.

For example, the user inputs:

帮我检查这个 Python 项目有没有安全问题。

If a Skill suitable for Python code review is installed, Codex may automatically select it.

Implicit matching does not guarantee it will trigger every time, so description you should clearly describe which tasks the skill applies to and in which situations it should not be used.


Skills Directory Structure

A complete Skill can contain instruction files, execution scripts, reference materials, and other resources.

my-skill/

├── SKILL.md

├── scripts/

│   └── check.py

├── references/

│   └── coding-rules.md

├── assets/

│   └── report-template.md

└── agents/

    └── openai.yaml

Agent Skills Directory Structure

The roles of the various files and directories are as follows:

File or directory Whether required Description
SKILL.md Is Define skill metadata, applicable scenarios, and execution steps
scripts/ No Store scripts to be executed such as Python and Shell
references/ No Store technical specifications, reference documents, and other materials
assets/ No Store static resources such as templates and images
agents/openai.yaml No Configure display information, invocation policies, and tool dependencies

For beginners, it is recommended to start with a SKILL.md file. Only add other directories when you actually need to execute code or use reference materials.

Creating Your First Skill

Creating a Skill can be done through the built-in skill-creator or can be written manually.

Method 1: Using skill-creator

In a Codex conversation, type:

Example

$skill-creator

Then describe the skill you want to create, for example:

帮我创建一个 Python 代码审查 Skill。



要求:

1. 检查代码语法和潜在错误。

2. 检查常见安全问题。

3. 提出可读性和性能方面的建议。

4. 输出包含文件位置、问题和修改建议的报告。

5. 不要自动修改源文件。

The creator will generate the skill files based on the task description and can help refine the description and execution steps.

After creation, you need to check that the generated SKILL.md meets expectations, and test the invocation effect with a real task.

Method 2: Manually Creating a Skill

If you want to understand the structure of Skills more clearly, you can create them manually.

The following uses Python code review as an example.

Step 1: Create a directory

Enter the project directory where you need to use Skills and create the skill folder:

mkdir -p .agents/skills/python-code-review

The directory structure is as follows:

project/

└── .agents/

    └── skills/

        └── python-code-review/

            └── SKILL.md

Step 2: Write SKILL.md

In the skill directory, create SKILL.md file and write the following content:

Example


name: python-code-review

description: Review Python source code for bugs, security issues, and maintainability problems. Use when the user requests a Python code review. Do not use for unrelated languages or ordinary code generation.

Python Code Review

Review the Python code in the requested scope.

Steps

Identify the files that need review.

Read the source code and relevant project configuration.

Check for potential runtime errors and incorrect logic.

Check for security problems, including:

  -

Unsafe use of eval or exec

  -

SQL injection risks

  -

Hardcoded secrets

  -

Unsafe file operations

Check maintainability and readability.

Run relevant tests or static checks when available and permitted.

Report findings with file paths and line numbers.

Output

For each finding, include:

Severity: High, Medium, or Low

File and line number

Problem description

Suggested fix

If no problems are found, describe what was checked

and any limitations.

Rules

Do not modify files without user approval.

Do not report speculative findings as confirmed bugs.

Do not expose secrets found in source files.

Prioritize correctness and security over style.

Among these, the --- area at the beginning of the file is YAML metadata:

The Markdown body that follows defines the skill's execution steps, output format, and constraints.

Step 3: Invoke the skill

After starting Codex in the project directory, you can invoke it with the following prompt:

$python-code-review 检查当前项目的 Python 代码。

You can also test implicit matching with a normal task description:

请对当前 Python 项目进行代码审查,

重点检查安全漏洞和潜在运行错误。

If the skill loads correctly, Codex will reference the SKILL.md rules defined in it to perform the review.

Step 4: Test the skill

It is recommended to test the following cases separately:

Through testing, you can further adjust the description and specific instructions.

It is recommended to keep test samples in the project to facilitate regression checks when updating the Skill later.

Where Skills Are Stored

Codex can discover Skills from multiple locations, including repository-level, user-level, administrator-level, and built-in system skills.

Common paths are as follows:

Scope Path Purpose
Project-level .agents/skills/ Managed together with the current project, suitable for team sharing
User level ~/.agents/skills/ Personal skills that can be reused across different projects
Administrator level /etc/codex/skills/ Shared skills at the machine or container level
System level Built into Codex Base skills provided officially

For Git repositories, Codex can scan upward from the current working directory to the repository root, looking for levels of .agents/skills folder.

For example:

project/

├── .agents/

│   └── skills/

│       └── project-review/

└── backend/

    └── .agents/

        └── skills/

            └── api-check/

Skills in the project root directory are suitable for sharing across the entire project, while skills in subdirectories can be used for more specific modules.

If two Skills use the same name, Codex will not automatically merge them and may display both in the selector. Therefore, it is recommended to use clear and non-duplicate names for skills.

How to choose an installation location?

If a skill is only used for a certain project, it is recommended to save it in the project's .agents/skills/ , and manage it with Git version control.

If a skill applies to all projects, such as general Python code review or documentation writing standards, it can be saved to the user-level directory:

~/.agents/skills/

This way, you do not need to repeatedly create the same Skill in every project.

Skills Configuration Guide

Enabling and Disabling Skills

For local Codex, you can through the ~/.codex/config.toml The [[skills.config]] configuration disable specified skills.

Example

~/.codex/config.toml

[[skills.config]]

path = "/path/to/skill/SKILL.md"

enabled = false

Wherepath You should fill in the skill's corresponding SKILL.md the actual path of the file.

Settings enabled = false after that, you can disable the skill without deleting its files.

After modifying the configuration, you usually need to restart Codex.

Configuring Skill Display Information

Besides SKILL.md, you can also use an optional file agents/openai.yaml to configure the skill's display information and invocation policy.

For example:

Example

agents/openai.yaml

interface

:

  display_name

:

"Python Code Review"

  short_description

:

"Check for errors and security issues in Python code"

  default_prompt

:

"Use this skill to check the current project's Python code"

policy

:

  allow_implicit_invocation

:

true

Common configuration items are as follows:

Configuration Item Purpose
interface.display_name The name displayed for the skill in supported interfaces
interface.short_description A brief user-facing description
interface.default_prompt The default prompt used with the skill
interface.icon_small Path to the small icon resource
interface.icon_large Path to the large icon resource
interface.brand_color Interface brand color
policy.allow_implicit_invocation Whether to allow implicit invocation of the skill
dependencies.tools Declare external tool dependencies required by the skill

allow_implicit_invocation Implicit invocation is allowed by default. Set it to false after which Codex will not automatically select the skill based solely on the task description, but it can still be referenced explicitly.

For example, if a Skill involves sensitive operations, you can choose to allow explicit invocation only.

**Note:** Disabling implicit invocation does not equate to restricting tool permissions. For operations involving deleting files or modifying databases, separate permission and approval mechanisms are still required.

Declaring MCP Tool Dependencies

If a Skill needs to use an external MCP service, you can also in the agents/openai.yaml declare tool dependencies.

For example:

Example

span style="color: #007F45;">

dependencies:

  tools

:

    - type

:

"mcp"

      value

:

"openaiDeveloperDocs"

      description

:

"OpenAI Docs MCP server"

      transport

:

"streamable_http"

      url

:

"https://developers.openai.com/mcp"

This configuration is used to declare a skill's dependency on MCP tools and should not be understood as automatically completing the installation, authorization, and connection of all MCP servers.

In actual use, you still need to confirm that the corresponding MCP service is available in the runtime environment and has the required access permissions.

Installing and Distributing Skills

Installing Curated Skills

Codex provides skill-installer, used to install curated skills or obtain skills from other repositories.

For example, enter in a Codex conversation:

Example

$skill-installer linear

This example means invoking the skill installer, requesting installation of a skill named linear the skill.

Also note that this is a way of invoking Codex skills, not an ordinary terminal command.

After the skill is installed, if it does not appear in the skill list, you can try restarting Codex.

Installing Skills from GitHub

In addition to installing curated skills, you can also obtain Skills from other code repositories.

For example, you can use skill-installer Follow the prompts to install skills from a specified repository, or manually copy the skill directory to the local .agents/skills/ or ~/.agents/skills/ directory.

Before installing a third-party Skill, it is recommended to first check:

Instructions in a Skill can affect the Agent's behavior, so untrusted third-party skills should not be used directly in high-privilege environments.

Distributing with Plugins

For local use or sharing within a project, simply saving the Skill directory is usually sufficient.

If you need to distribute skills to more users, or package multiple skills, MCP services, and other resources together, you can use Plugins.

For example, a plugin can contain:

my-plugin/

├── plugin.json

├── skills/

│   ├── code-review/

│   │   └── SKILL.md

│   └── test-generator/

│       └── SKILL.md

└── mcp.json            # 可选:MCP 配置

Shown here is the basic directory structure of portable Agent Plugins. In the root directory, the plugin.json is used to describe plugin information.

Plugins also support optional display resources and other extended configurations; the specific format is subject to the official documentation of the corresponding version.

Therefore, a Skill can be understood as the definition of a task capability, while a Plugin focuses more on the packaging, installation, and distribution of these capabilities.


Best Practices for Writing Skills

A good Skill is not about writing a lot of content, but about clear task boundaries, well-defined operation steps, and stable reusability.

The following points are recommended when writing:

  1. **Define the scope clearly:** Explain which tasks the Skill should be used for and which it should not.
  2. **Keep responsibilities clear:** Try to keep one Skill focused on one category of related tasks, without mixing in a large number of unrelated features.
  3. **Be specific about steps:** Explain what information needs to be read, what operations to perform, and how to check the results.
  4. **Use scripts as needed:** Deterministic calculations, batch processing, and similar operations can use scripts; for simple flows, prefer textual instructions.
  5. **Control context usage:** Put longer reference materials into references/, and read them only when needed.
  6. **Specify the output format:** Define what the result must contain, such as a list of issues, file paths, and modification suggestions.
  7. **Perform actual testing:** Test explicit invocation, implicit matching, and cases where the skill should not be triggered.

How to write a description?

description is a very important field in a Skill, directly affecting Codex's ability to judge the skill's scope of application.

For example, the following description is rather vague:

description: Helps with Python.

It does not specify which tasks the skill handles.

A clearer way to write it is:

description: Review Python code for bugs,

security issues, and maintainability.

Use when the user requests a Python code review.

Do not use for unrelated programming tasks.

When actually writing YAML, if you need to use multi-line text, it is recommended to use YAML's folded text syntax:

description: >-

  Review Python code for bugs, security issues,

  and maintainability. Use when the user requests

  a Python code review. Do not use for unrelated

  programming tasks.

A good description should include three aspects: what the skill is responsible for, when to use it, and when not to use it.

Common questions

1. The skill does not appear after creation?

First check whether the skill is in a directory that Codex can discover, and whether it contains a correctly named SKILL.md。

Then check whether the YAML metadata contains name and description。

If the file structure is fine, you can try restarting Codex.

2. Why doesn't the Skill trigger automatically?

Implicit matching is usually judged based on the skill description and the current task, and is not guaranteed to trigger every time.

You can optimize the descriptionto clarify the skill's purpose, trigger conditions, and inapplicable scenarios.

If you want to ensure a specified skill is used, you can through $技能名称 reference it explicitly.

3. What if two Skills have the same name?

Codex does not automatically merge skills with the same name, and both may appear in the selector at the same time.

It is recommended to use clear, unique names for different skills to avoid confusion during selection.

4. Can a Skill execute Python scripts?

Yes. A Skill can place Python, Shell, and other scripts in the scripts/ directory, and in the SKILL.md explain how to use them.

However, whether a script can actually execute still depends on Codex's runtime environment, file permissions, and security restrictions.

5. What is the difference between a Skill and AGENTS.md?

AGENTS.md is usually used to provide persistent working conventions at the project or directory scope, such as coding standards, test commands, and project descriptions.

SKILL.md is used to define specific task flows that can be invoked on demand, such as code review, test generation, or release checks.

Simply put,AGENTS.md leans more toward general project rules, while a Skill leans more toward reusable specialized workflows. Both can be used together.

6. Can one Skill contain multiple files?

Yes. In addition to the required SKILL.md, you can also add resources such as scripts, reference documents, and templates.

It is recommended to keep the core execution requirements in the SKILL.md , and store detailed materials separately to avoid a single file becoming too long.

7. When to use a Skill and when to use a Plugin?

If you only want to reuse a workflow in the current project, using a Skill is sufficient.

If you need to install, publish, or distribute a software package containing multiple skills and other integrated capabilities, you can consider using a Plugin.

Summary

Codex Skills provide a way to organize task instructions, scripts, and resources into reusable capabilities.

To create a simple Skill, you only need to prepare a name、description with execution instructions in a SKILL.md files.

For beginners, it is recommended to start with a specific small task, such as Python code review, test generation, or technical documentation organization. First ensure the Skill can be invoked correctly, then gradually add scripts, reference materials, and external tools.

Through Skills, repeatedly used prompts and operational standards can be organized into long-term maintained workflows, allowing Codex to perform operations in a relatively consistent manner across different tasks.

More resources:

  • Official documentation for Codex and ChatGPT Skills
  • Agent Skills development documentation
  • Plugins packaging and distribution documentation
  • OpenAI Skills GitHub repository