use-cases/agent-friendly-clis.md +111 −0 added
1---
2name: Create a CLI Codex can use
3tagline: Give Codex a composable command for an API, log source, export, or team script.
4summary: Ask Codex to create a composable CLI it can run from any folder,
5 combine with repo scripts, use to download files, and remember through a
6 companion skill.
7skills:
8 - token: $cli-creator
9 url: https://github.com/openai/skills/tree/main/skills/.curated/cli-creator
10 description: Design the command surface, build the CLI, add setup and auth
11 checks, install the command on PATH, and verify it from another folder.
12 - token: $skill-creator
13 url: https://github.com/openai/skills/tree/main/skills/.system/skill-creator
14 description: Create the companion skill that teaches later Codex tasks which CLI
15 commands to run first and which write actions require approval.
16bestFor:
17 - Repeated work where Codex needs to search, read, download from, or safely
18 write to the same service, export, local archive, or repo script.
19 - Agent tools that need paged search, exact reads by ID, predictable JSON,
20 downloaded files, local indexes, or draft-before-write commands.
21starterPrompt:
22 title: Build a CLI and companion skill
23 body: >-
24 Use $cli-creator to create a CLI you can use, and use $skill-creator to
25 create the companion skill in this same thread.
26
27
28 Source to learn from: [docs URL, OpenAPI spec, redacted curl command,
29 existing script path, log folder, CSV or JSON export, SQLite database path,
30 or pasted --help output].
31
32
33 First job the CLI should support: [download failed CI logs from a build URL,
34 search support tickets and read one by ID, query an admin API, read a local
35 database, or run one step from an existing script].
36
37
38 Optional write job: [create a draft comment, upload media, retry a failed
39 job, or read-only for now].
40
41
42 Command name: [cli-name, or recommend one].
43
44
45 Before coding, show me the proposed command surface and ask only for missing
46 details that would block the build.
47relatedLinks:
48 - label: Codex skills
49 url: /codex/skills
50 - label: Create custom skills
51 url: /codex/skills/create-skill
52---
53
54## Introduction
55
56When Codex keeps using the same API, log source, exported inbox, local database, or team script, give that work a composable interface: a command it can run from any folder, inspect, narrow, and combine with `git`, `gh`, `rg`, tests, and repo scripts.
57
58Add a companion skill that records when Codex should use the CLI, what to run first, how to keep output small, where downloaded files land, and which write commands need approval.
59
60In this workflow, `$cli-creator` helps Codex build the command. `$skill-creator` helps Codex save a reusable skill such as `$ci-logs`, which future tasks can invoke by name.
61
62## How to use
63
64
65
661. [Decide whether the job needs a CLI](#choose-what-the-cli-should-do)
672. [Share the source Codex should learn from](#share-the-docs-files-or-commands)
683. [Run `$cli-creator`](#ask-codex-to-build-the-cli-and-skill)
694. [Test the installed command](#verify-the-command-works-from-any-folder)
705. [Invoke the saved skill later](#use-the-skill-later)
71
72
73
74## Choose what the CLI should do
75
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.
77
78| Situation | What Codex can do with the CLI |
79| ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
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. |
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. |
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. |
83| **A Slack export has long threads.** | Search with `--limit`, read one thread, and return nearby context instead of the whole archive. |
84| **A team script runs four different steps.** | Split setup, discovery, download, draft, upload, poll, and live write into separate commands. |
85| **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. |
86
87## Share the docs, files, or commands
88
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.
90
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 thread. Ask Codex to make the CLI's setup check fail clearly when auth is missing.
92
93## Ask Codex to build the CLI and skill
94
95Use the starter prompt on this page. Fill in the source Codex should learn from and the first job the CLI should support.
96
97Before Codex writes code, it should show the proposed command surface and ask only for missing details that would block the build.
98
99## Verify the command works from any folder
100
101Codex should not stop after `cargo run`, `python path/to/script.py`, or an uninstalled package command. Ask it to test the installed command from another repo or a temporary folder, the way a later task will use it.
102
103**Test the CLI like a future agent**
104
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 thread.
106
107## Use the skill later
108
109When you need the CLI again, invoke the skill instead of pasting the docs again:
110
111For recurring work, test the skill once in a normal thread, then ask Codex to turn that same invocation into an automation.