1# Create a CLI Codex can use | Codex use cases1---
2 2name: Create a CLI Codex can use
3Codex use cases3tagline: Give Codex a composable command for an API, log source, export, or team script.
4 4summary: Ask Codex to create a composable CLI it can run from any folder,
55 combine with repo scripts, use to download files, and remember through a
6 6 companion skill.
77skills:
8 8 - token: $cli-creator
9Codex use case9 url: https://github.com/openai/skills/tree/main/skills/.curated/cli-creator
10 10 description: Design the command surface, build the CLI, add setup and auth
11# Create a CLI Codex can use11 checks, install the command on PATH, and verify it from another folder.
12 12 - token: $skill-creator
13Give Codex a composable command for an API, log source, export, or team script.13 url: https://github.com/openai/skills/tree/main/skills/.system/skill-creator
14 14 description: Create the companion skill that teaches later Codex tasks which CLI
15Difficulty **Intermediate**15 commands to run first and which write actions require approval.
16 16bestFor:
17Time horizon **1h**17 - Repeated work where Codex needs to search, read, download from, or safely
18 18 write to the same service, export, local archive, or repo script.
19Ask Codex to create a composable CLI it can run from any folder, combine with repo scripts, use to download files, and remember through a companion skill.19 - Agent tools that need paged search, exact reads by ID, predictable JSON,
20 20 downloaded files, local indexes, or draft-before-write commands.
21## Best for21starterPrompt:
22 22 title: Build a CLI and companion skill
23- Repeated work where Codex needs to search, read, download from, or safely write to the same service, export, local archive, or repo script.23 body: >-
24- Agent tools that need paged search, exact reads by ID, predictable JSON, downloaded files, local indexes, or draft-before-write commands.24 Use $cli-creator to create a CLI you can use, and use $skill-creator to
25 25 create the companion skill in this same task.
26# Contents26
27 27
28[← All use cases](https://developers.openai.com/codex/use-cases)28 Source to learn from: [docs URL, OpenAPI spec, redacted curl command,
29 29 existing script path, log folder, CSV or JSON export, SQLite database path,
30Copy page [Export as PDF](https://developers.openai.com/codex/use-cases/agent-friendly-clis/?export=pdf)30 or pasted --help output].
31 31
32Ask Codex to create a composable CLI it can run from any folder, combine with repo scripts, use to download files, and remember through a companion skill.32
33 33 First job the CLI should support: [download failed CI logs from a build URL,
34Intermediate34 search support tickets and read one by ID, query an admin API, read a local
35 35 database, or run one step from an existing script].
361h36
37 37
38Related links38 Optional write job: [create a draft comment, upload media, retry a failed
39 39 job, or read-only for now].
40[Codex skills](https://developers.openai.com/codex/skills) [Create custom skills](https://developers.openai.com/codex/skills/create-skill)40
41 41
42## Best for42 Command name: [cli-name, or recommend one].
43 43
44- Repeated work where Codex needs to search, read, download from, or safely write to the same service, export, local archive, or repo script.44
45- Agent tools that need paged search, exact reads by ID, predictable JSON, downloaded files, local indexes, or draft-before-write commands.45 Before coding, show me the proposed command surface and ask only for missing
46 46 details that would block the build.
47## Skills & Plugins47relatedLinks:
48 48 - label: Skills
49- [Cli Creator](https://github.com/openai/skills/tree/main/skills/.curated/cli-creator)49 url: /codex/build-skills
50 50 - label: Create custom skills
51 Design the command surface, build the CLI, add setup and auth checks, install the command on PATH, and verify it from another folder.51 url: /codex/build-skills#create-a-skill
52- [Skill Creator](https://github.com/openai/skills/tree/main/skills/.system/skill-creator)52---
53
54 Create the companion skill that teaches later Codex tasks which CLI commands to run first and which write actions require approval.
55
56| Skill | Why use it |
57| --- | --- |
58| [Cli Creator](https://github.com/openai/skills/tree/main/skills/.curated/cli-creator) | Design the command surface, build the CLI, add setup and auth checks, install the command on PATH, and verify it from another folder. |
59| [Skill Creator](https://github.com/openai/skills/tree/main/skills/.system/skill-creator) | Create the companion skill that teaches later Codex tasks which CLI commands to run first and which write actions require approval. |
60
61## Starter prompt
62
63Use $cli-creator to create a CLI you can use, and use $skill-creator to create the companion skill in this same thread.
64Source to learn from: [docs URL, OpenAPI spec, redacted curl command, existing script path, log folder, CSV or JSON export, SQLite database path, or pasted --help output].
65First job the CLI should support: [download failed CI logs from a build URL, search support tickets and read one by ID, query an admin API, read a local database, or run one step from an existing script].
66Optional write job: [create a draft comment, upload media, retry a failed job, or read-only for now].
67Command name: [cli-name, or recommend one].
68Before coding, show me the proposed command surface and ask only for missing details that would block the build.
69
70Open in the Codex app
71
72Use $cli-creator to create a CLI you can use, and use $skill-creator to create the companion skill in this same thread.
73Source to learn from: [docs URL, OpenAPI spec, redacted curl command, existing script path, log folder, CSV or JSON export, SQLite database path, or pasted --help output].
74First job the CLI should support: [download failed CI logs from a build URL, search support tickets and read one by ID, query an admin API, read a local database, or run one step from an existing script].
75Optional write job: [create a draft comment, upload media, retry a failed job, or read-only for now].
76Command name: [cli-name, or recommend one].
77Before coding, show me the proposed command surface and ask only for missing details that would block the build.
78 53
79## Introduction54## Introduction
80 55
97Start with the thing you want Codex to do, not the technology you want it to write. A good CLI turns a repeated read, search, download, export, draft, upload, poll, or safe write into a command Codex can run from any repo.76Start with the thing you want Codex to do, not the technology you want it to write. A good CLI turns a repeated read, search, download, export, draft, upload, poll, or safe write into a command Codex can run from any repo.
98 77
99| Situation | What Codex can do with the CLI |78| Situation | What Codex can do with the CLI |
100| --- | --- |79| ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------- |
101| **CI logs live behind a build page.** | Take a build URL, download failed job logs to `./logs`, and return file paths plus short snippets. |80| **CI logs live behind a build page.** | Take a build URL, download failed job logs to `./logs`, and return file paths plus short snippets. |
102| **Support tickets arrive as a weekly export.** | Index the newest CSV or JSON export, search by customer or phrase, and read one ticket by stable ID. |81| **Support tickets arrive as a weekly export.** | Index the newest CSV or JSON export, search by customer or phrase, and read one ticket by stable ID. |
103| **An API response is too large for context.** | List only the fields it needs, read the full object by ID, and export the complete response to a file. |82| **An API response is too large for context.** | List only the fields it needs, read the full object by ID, and export the complete response to a file. |
104| **A Slack export has long threads.** | Search with `--limit`, read one thread, and return nearby context instead of the whole archive. |83| **A Slack export has long threads.** | Search with `--limit`, read one thread, and return nearby context instead of the whole archive. |
105| **A team script runs four different steps.** | Split setup, discovery, download, draft, upload, poll, and live write into separate commands. |84| **A team script runs four different steps.** | Split setup, discovery, download, draft, upload, poll, and live write into separate commands. |
106| **A plugin finds the record, but Codex needs a file.** | Keep the plugin in the thread; use a CLI to download the attachment, trace, report, video, or log bundle and return the path. |85| **A plugin finds the record, but Codex needs a file.** | Keep the plugin in the task; use a CLI to download the attachment, trace, report, video, or log bundle and return the path. |
107 86
108## Share the docs, files, or commands87## Share the docs, files, or commands
109 88
110Codex needs something concrete to learn from: docs or OpenAPI, a redacted curl command, an export or database path, a log folder, or an existing script. If you want the CLI to follow a familiar style, paste a short `--help` output from `gh`, `kubectl`, or your team’s own tool.89Codex needs something concrete to learn from: docs or OpenAPI, a redacted curl command, an export or database path, a log folder, or an existing script. If you want the CLI to follow a familiar style, paste a short `--help` output from `gh`, `kubectl`, or your team's own tool.
111 90
112If the command needs auth, tell Codex the environment variable name, config file path, or login flow it should support. Set the secret yourself in your shell or config file. Do not paste secrets into the thread. Ask Codex to make the CLI’s setup check fail clearly when auth is missing.91If the command needs auth, tell Codex the environment variable name, config file path, or login flow it should support. Set the secret yourself in your shell or config file. Do not paste secrets into the task. Ask Codex to make the CLI's setup check fail clearly when auth is missing.
113 92
114## Ask Codex to build the CLI and skill93## Ask Codex to build the CLI and skill
115 94
123 102
124**Test the CLI like a future agent**103**Test the CLI like a future agent**
125 104
126Test [cli-name] the way you would use it in a future task.105If Codex returns a giant JSON blob, ask it to narrow the default response and add a file export for full payloads. If it forgets the approval boundary, ask it to update the companion skill before you use it in another task.
127Please show proof that:
128- command -v [cli-name] succeeds from outside the CLI source folder
129- [cli-name] --help explains the main commands
130- the setup/auth check runs
131- one safe discovery, list, or search command works
132- one exact read command works with an ID from the discovery result
133- any large log, export, trace, or payload writes to a file and returns the path
134- live write commands are not run unless I explicitly approved them
135Then read the companion skill and tell me the shortest prompt I should use when I need this CLI again.
136
137If Codex returns a giant JSON blob, ask it to narrow the default response and add a file export for full payloads. If it forgets the approval boundary, ask it to update the companion skill before you use it in another thread.
138 106
139## Use the skill later107## Use the skill later
140 108
141When you need the CLI again, invoke the skill instead of pasting the docs again:109When you need the CLI again, invoke the skill instead of pasting the docs again:
142 110
143Use $ci-logs to download the failed logs for this build URL and tell me the first failing step.111For recurring work, test the skill once in a task, then ask Codex to [schedule that same invocation from the task](https://developers.openai.com/codex/automations#schedule-work-from-a-task).
144
145Use $support-export to search this week's refund complaints and read the three highest-value tickets.
146
147Use $admin-api to find this user's workspace, read the billing record, and draft a safe account note.
148
149For recurring work, test the skill once in a normal thread, then ask Codex to turn that same invocation into an automation.
150
151## Related use cases
152
153[
154
155### Follow a goal
156
157Use `/goal` when a task needs Codex to keep working across turns toward a verifiable...
158
159Engineering Automation](https://developers.openai.com/codex/use-cases/follow-goals)[
160
161### Remediate a vulnerability backlog
162
163Bring in approved findings from ticketing tools or vulnerability reporting systems, then use...
164
165Engineering Quality](https://developers.openai.com/codex/use-cases/remediate-vulnerability-backlog)[
166
167### Audit dependency incidents
168
169Use Codex to turn a public package or supply chain advisory into a read-only audit, then...
170
171Engineering Quality](https://developers.openai.com/codex/use-cases/dependency-incident-audits)
172