Creating and Using Codex Skills
Codex does more than generate code. The skills system lets you extend its capabilities by bundling instructions, resources, and scripts into reusable packages. In this lesson, you will learn how to create skills that make Codex work exactly the way your team needs.
What You Will Learn
- What Codex skills are and how they work
- How to use built-in and community skills
- How to create your own custom skills
- How skills bundle instructions, resources, and scripts together
- Practical examples of skills for common workflows
What Are Codex Skills?
A skill is a package that teaches Codex how to perform a specific type of task. Think of it as a set of instructions, templates, and tools bundled together so you do not have to explain the same thing every time.
Without skills, you might need to write a detailed prompt every time you want Codex to follow a specific pattern:
Use the repository's ESLint config, follow the existing naming conventions,
put tests in __tests__/ directories, use the factory pattern for test data,
mock external services using jest.mock, and make sure every test file imports
from the test helpers module...
With a skill, all of that is captured once and reused. You mention the skill with $ and its name:
codex '$our-test-patterns write tests for the notification service'
Anatomy of a Skill
A skill is a folder with a SKILL.md file inside. That file is the only required part. It can sit next to optional folders:
.agents/skills/our-test-patterns/
โโโ SKILL.md # required: name, description, instructions
โโโ scripts/ # optional: code the skill can run
โโโ references/ # optional: docs the skill can read
โโโ assets/ # optional: templates and other files
Inside, a skill typically includes:
Instructions
Natural language guidance that tells Codex how to approach tasks. For example, a code review skill might include:
- Check for security vulnerabilities (SQL injection, XSS, CSRF)
- Verify error handling is present for all async operations
- Ensure all public functions have documentation comments
- Flag any hardcoded secrets or credentials
Resources
Files, templates, or reference material that the skill provides to Codex. A deployment skill might include:
- A Dockerfile template
- Kubernetes manifest templates
- Environment variable checklists
- Deployment runbook steps
Scripts
Automation scripts that the skill can execute. A database migration skill might include:
- A script to generate a migration file from schema changes
- A script to test the migration against a local database
- A rollback script for safety
Using Skills
Applying a Skill to a Task
There are two ways a skill gets used.
Explicitly. Mention it in your prompt with $ and the skill name:
codex '$code-review review the changes in the last commit'
The single quotes stop your shell from treating $code-review as a shell variable. Inside a session you can also type $ to see matching skills, or run /skills to pick one.
Implicitly. Codex reads each skill's description. When your task matches a description, Codex can pick the skill on its own. This is why a clear description matters.
Listing Available Skills
In Codex CLI or the IDE extension, type:
/skills
This lists the skills Codex can see, including the system skills that ship with Codex (such as skill-creator and skill-installer) and any skills you created or installed.
Where Skills Live
- Repo skills:
.agents/skillsin your repository. Skills at the repo root apply to the whole repository. Commit them, and your whole team gets them. - User skills:
$HOME/.agents/skills. These follow you into every project.
Creating Your Own Skills
Creating a custom skill starts with defining what you want Codex to do consistently. Here is a step-by-step process:
Step 1: Identify the Pattern
What task do you repeatedly ask Codex to do, and what instructions do you always include? Common examples:
- Writing tests with specific patterns
- Creating API endpoints with standard error handling
- Generating documentation in a specific format
- Performing code reviews with team-specific criteria
Step 2: Write the SKILL.md File
A skill is a folder with a SKILL.md file (with name and description in its frontmatter) plus optional scripts/, references/ and assets/ folders. Put repo skills in .agents/skills. Here is an example of a test-writing skill, saved as .agents/skills/team-tests/SKILL.md:
---
name: team-tests
description: Write tests that follow our team's conventions. Use when asked to add or update tests. Do not use for production code changes.
---
- Place test files in __tests__/ adjacent to the source file
- Use describe/it blocks with clear, readable names
- Follow the Arrange-Act-Assert pattern
- Use factory functions from test/factories/ for test data
- Mock external services using jest.mock at the top of the file
- Include both success and error cases for every function
- Test edge cases: empty inputs, null values, maximum lengths
Read these first:
- references/factories.md (explains available factories)
- references/helpers.md (explains test utility functions)
The description does two jobs. It tells people what the skill is for, and it tells Codex when to pick it on its own. Say when it should and should not be used.
Tip: Type $skill-creator in Codex and describe the skill you want. This built-in skill drafts the folder and SKILL.md for you.
Step 3: Test the Skill
Apply the skill to a task and verify that Codex follows the instructions correctly:
codex '$team-tests write tests for src/services/email.js'
Review the output. If Codex misses any conventions, refine the skill instructions.
Step 4: Share with Your Team
Once the skill works well, commit its folder under .agents/skills in your repository. Everyone who runs Codex in that repo now gets it.
Practical Skill Examples
Code Review Skill
---
name: security-review
description: Review code for security issues. Use when asked for a security review of changes.
---
- Check for SQL injection vulnerabilities (parameterized queries required)
- Check for XSS risks in any HTML rendering
- Verify authentication and authorization on all endpoints
- Ensure sensitive data is not logged
- Check that API keys and secrets use environment variables
- Verify CORS configuration is appropriate
- Check for rate limiting on public endpoints
API Endpoint Skill
---
name: rest-endpoint
description: Create REST API endpoints that follow team conventions. Use when adding a new API route.
---
- Use Express router with the standard middleware chain
- Add request validation using Joi schemas
- Include try-catch with standardized error responses
- Add request logging with correlation IDs
- Return consistent response shapes: { data, error, meta }
- Add JSDoc comments with request/response types
Documentation Skill
---
name: api-docs
description: Write API documentation. Use when asked to document endpoints.
---
- Use OpenAPI 3.0 format
- Include request/response examples for every endpoint
- Document all possible error codes and their meanings
- Include authentication requirements
- Add rate limit information where applicable
Skills vs Prompt Templates
You might wonder how skills differ from simply saving prompt templates. The key differences are:
- Skills include resources in their
references/andassets/folders that Codex can read when it needs them - Skills can run scripts from their
scripts/folder as part of the workflow - Skills can trigger on their own when a task matches their description
- Skills are versioned and shareable because they are plain folders you commit to git
Skills vs plugins: Skills package repeatable instructions. Plugins connect Codex to your team's tools and data. You can browse plugins from the marketplaces available to you.
Key Takeaways
- Skills extend Codex by bundling instructions, resources, and scripts into reusable packages
- Use skills to enforce consistent patterns across your team without repeating instructions
- A skill is a folder with a required SKILL.md file (name and description in the frontmatter) plus optional scripts/, references/ and assets/ folders
- Use a skill with
$skill-nameor/skills, or let Codex pick it from its description - Keep repo skills in
.agents/skillsand personal skills in$HOME/.agents/skills - Create skills for any task you repeatedly ask Codex to do with specific conventions
- Commit skills to your repository to share them with your team
- Skills are more powerful than simple prompt templates because they include resources and scripts
Quiz
Up next ยท Lesson 9 of 11
Team Workflows and Custom Configurations
6 min read
8 of 11 lessons done

Ask Byte about this lesson
A private chat about this lesson. Byte has read the whole lesson, answers in seconds, and shows the section each answer comes from. Ask follow-ups in any language.
Questions & Answers
Public questions about this lesson. The AI Tutor answers right away in your language, the FreeAcademy team checks answers, and every learner can read them.

