|
| 1 | +Prompt: How do I include skills in a repo (as opposed to a directory under my home directory)? |
| 2 | + |
| 3 | +Put them in a **checked-in `.agents/skills/` directory inside the repo**. |
| 4 | + |
| 5 | +A repo-local skill looks like this: |
| 6 | + |
| 7 | +```text |
| 8 | +my-repo/ |
| 9 | + AGENTS.md |
| 10 | + .agents/ |
| 11 | + skills/ |
| 12 | + code-change-verification/ |
| 13 | + SKILL.md |
| 14 | + scripts/ |
| 15 | + references/ |
| 16 | + assets/ |
| 17 | + agents/ |
| 18 | + openai.yaml |
| 19 | +``` |
| 20 | + |
| 21 | +`SKILL.md` is required; `scripts/`, `references/`, `assets/`, and `agents/openai.yaml` are optional. Codex supports skills in the CLI, IDE extension, and Codex app. ([OpenAI Developers][1]) |
| 22 | + |
| 23 | +The key rule is **location**: for repository-scoped skills, Codex scans `.agents/skills` in every directory from your **current working directory up to the repository root**. So you can put skills at the repo root for everyone, or deeper in the tree for module- or service-specific workflows. For example, these are all valid patterns: ([OpenAI Developers][1]) |
| 24 | + |
| 25 | +```text |
| 26 | +repo/.agents/skills/... |
| 27 | +repo/services/payments/.agents/skills/... |
| 28 | +repo/apps/web/.agents/skills/... |
| 29 | +``` |
| 30 | + |
| 31 | +That means: |
| 32 | + |
| 33 | +- use `repo/.agents/skills` for skills that apply to the whole codebase |
| 34 | +- use `some/subdir/.agents/skills` for skills that should only be relevant when working in that area of the repo. ([OpenAI Developers][1]) |
| 35 | + |
| 36 | +The contrast with home-directory skills is: |
| 37 | + |
| 38 | +- **repo-local/shared:** `.agents/skills` inside the repository |
| 39 | +- **user-global/personal:** `$HOME/.agents/skills` |
| 40 | + Use the repo path when you want the skill versioned in Git and shared with teammates. ([OpenAI Developers][1]) |
| 41 | + |
| 42 | +A minimal repo skill can be just: |
| 43 | + |
| 44 | +```md |
| 45 | +--- |
| 46 | +name: code-change-verification |
| 47 | +description: Run lint, typecheck, and the smallest relevant tests when runtime code, tests, or dependencies change. Do not use for docs-only edits. |
| 48 | +--- |
| 49 | + |
| 50 | +1. Identify the affected packages and test scope. |
| 51 | +2. Run the smallest required validation stack. |
| 52 | +3. Report commands run, results, and any blockers. |
| 53 | +``` |
| 54 | + |
| 55 | +Codex can invoke a skill explicitly with `$skill-name` or `/skills`, and it can also choose it implicitly based on the `description`, so the description should be very specific about when it should and should not trigger. ([OpenAI Developers][1]) |
| 56 | + |
| 57 | +Two practical gotchas: |
| 58 | + |
| 59 | +- if two skills have the same `name`, Codex does **not** merge them; both may appear |
| 60 | +- if a new or edited skill does not show up right away, restart Codex. ([OpenAI Developers][1]) |
| 61 | + |
| 62 | +One more distinction that often trips people up: **custom prompts** in `~/.codex/prompts` are local-only and not shared through the repository; OpenAI now recommends using skills instead when you want something reusable and shareable in a repo. ([OpenAI Developers][2]) |
| 63 | + |
| 64 | +A solid default for most teams is: |
| 65 | + |
| 66 | +```text |
| 67 | +repo/ |
| 68 | + AGENTS.md |
| 69 | + .agents/ |
| 70 | + skills/ |
| 71 | + implementation-strategy/ |
| 72 | + code-change-verification/ |
| 73 | + pr-draft-summary/ |
| 74 | +``` |
| 75 | + |
| 76 | +That is also the pattern OpenAI describes in its OSS-maintenance writeup: `AGENTS.md` at repo level plus repo-local skills in `.agents/skills/`. ([OpenAI Developers][3]) |
| 77 | + |
| 78 | +If you want, I can draft a concrete `.agents/skills/` layout for a monorepo or a single-service GitHub repo. |
| 79 | + |
| 80 | +[1]: https://developers.openai.com/codex/skills 'Agent Skills – Codex | OpenAI Developers' |
| 81 | +[2]: https://developers.openai.com/codex/custom-prompts 'Custom Prompts – Codex | OpenAI Developers' |
| 82 | +[3]: https://developers.openai.com/blog/skills-agents-sdk 'Using skills to accelerate OSS maintenance | OpenAI Developers' |
0 commit comments