/meta-planning-cli-planning:meta-planning-cli-planningfrom meta-planning-cli-planning
Provides patterns for specifying CLI contracts: flags, exit codes, output streams, config precedence, prompts, error messages, signal handling, and cross-platform behavior. Use when adding or changing a command surface, interactive flow, config key, exit path, or printed output.
Ships in meta-planning-cli-planning. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Quick Guide: A command's flags, exit codes, output streams and config keys are contracts that humans, scripts and CI all branch on, so the spec states each one the feature touches — user-facing text verbatim — and leaves out the sections it does not touch. Four facts change the answer more often than taste does: a secret never takes a flag value; Ctrl+C at a key-reading prompt is a keypress, not a signal; exiting 130 is not the same as dying by SIGINT; and prompts render on stdout unless the spec moves them.
Detailed Resources:
Each section governs one kind of contract. Include it only when the spec touches that contract — a section filled with placeholders reads as a decision nobody made.
When none of these holds, the feature has no CLI contract and the spec carries no CLI section.
<critical_requirements>
Read the closest existing command first, and reuse its flag names, prompt helpers, config resolver, exit-code constants and output helpers. They are the vocabulary the spec has to speak; a spec that invents its own ships a CLI with two conventions, and leaves the developer to pick which one is wrong.
Give every prompted value a non-interactive twin, and state what happens with no TTY and no twin. A value only a prompt can supply makes the command unusable in CI, and nobody finds out until a pipeline hangs.
Give every terminating path an exit code, named by its constant, with cancellation kept apart from failure. Scripts branch on the code, so a path the spec leaves open exits with a number the developer chose and nobody documented.
Specify output for every context — TTY, piped, --json, quiet, verbose — and which stream carries the payload. stdout is what a pipe captures, so anything else written there corrupts the consumer's input.
State config precedence per key as a table, with the merge rule for arrays and objects. "Merged" without a rule gets implemented as replace in one place and concatenate in another.
</critical_requirements>
Auto-detection: CLI spec, command surface, subcommand design, flag contract, --json output, --dry-run, --yes, --no-input, non-interactive mode, prompt flow, wizard step, exit codes, exit status 130, SIGINT, SIGTERM, NO_COLOR, FORCE_COLOR, config precedence, help text, flag deprecation
Applies to:
Handled elsewhere:
A CLI's public API is bigger than its code. Flags, exit codes, output streams and config keys are what humans, scripts and CI branch on, and a contract the spec leaves implicit is one the developer invents and nobody documents.
So the spec answers three callers at once: a human at a TTY, a script piping the output, and CI with no TTY at all. User-facing text is written verbatim, because approximate wording produces a CLI that words one failure five ways. Cancellation and cleanup are stated as invariants a tester can assert, not as intentions.
The spec's size follows the surface it changes. A flag-only change needs no prompt-flow table, a new exit code is proposed only when no existing class fits, and a new subcommand only when a flag on an existing command cannot do the job. Handler bodies and parser wiring stay out — the spec fixes contracts, not code.
<decision_framework>
Decided by the value's role, not by preference:
Is the value the thing the command acts on, and supplied in almost every call?
├─ YES → positional argument (app deploy <environment>)
└─ NO → Does it change how the command behaves?
├─ YES → flag (--dry-run, --force, --concurrency=4)
└─ NO → Does it select a different operation altogether?
├─ YES → subcommand (app config get | app config set)
└─ NO → Can only the human at the terminal supply it?
├─ YES → prompt, with a twin that supplies the same value
└─ NO → derive it from config or the filesystem; do not ask
Can the value come from a flag, config or the filesystem?
├─ YES → derive it; do not prompt
└─ NO → Is stdin a TTY, with prompting not switched off?
├─ NO → usage error naming the twin that supplies the value
└─ YES → Is the action destructive or expensive?
├─ YES → confirm, skippable with --yes
└─ NO → prompt, pre-filled with the best default
</decision_framework>
Each flag is a row carrying what its parser declaration needs: long and short name, type and unit, default, env var, and conflicts — the combinations that are a usage error rather than a silent winner. Whether it is required, which flags it implies and whether help hides it go with it where they apply.
| Long | Short | Type | Default | Env Var | Conflicts | Description |
| ----------- | ----- | ------- | ------- | ------------- | --------- | ------------------------------ |
| `--dry-run` | -n | boolean | false | — | — | Print the plan, change nothing |
| `--timeout` | — | seconds | 300 | `APP_TIMEOUT` | — | Per-phase timeout |
The spec also states:
--no-<flag> exists only where the default is true.--tag a --tag b accumulates or the last one wins.Template: examples/core.md
Prompt only for what cannot be derived, and give each step a table that ends in its non-interactive twin.
| Element | Specification |
| ------------ | ------------------------------------------------- |
| Reached when | No environment from the argument or config |
| Prompt type | select |
| Message | `Deploy to which environment?` |
| On cancel | stderr `Cancelled.`, exit 130, nothing written |
| Twin | positional `environment`, or `defaultEnvironment` |
The spec also states:
--password-file), never a flag value. Whether an environment variable is accepted as well is a decision to write down: CI tooling expects one, and every child process can read it.--no-input, or the codebase's existing equivalent.Template: examples/core.md
Config is a table per key, because the resolution order is the contract and prose leaves it to be inferred.
| Precedence | Source | Identifier |
| ----------- | -------------------- | --------------------------------------- |
| 1 (highest) | Flag | `--region` |
| 2 | Environment variable | `APP_REGION` |
| 3 | Project config | `region` in `./app.config.ts` |
| 4 | User config | `region` in `~/.config/app/config.json` |
| 5 (lowest) | Built-in default | `us-east-1` |
The spec also states, per key:
--tag "" or tags: [] overrides a lower layer or counts as unset.Template: examples/core.md
Every terminating path gets a code and every code a documented meaning; scripts branch on them as they do on flags.
| Code | Meaning |
| -------- | -------------------------------------------------------------------- |
| 0 | Success |
| 1 | Generic runtime failure |
| 2 | Usage error — bad flag, missing argument |
| 3–125 | Domain classes the codebase defines |
| 126, 127 | Set by the shell: found but not executable, not found |
| 128+N | Set by the shell: killed by signal N — 130 is SIGINT, 143 is SIGTERM |
Domain codes stay inside 3–125: a status is truncated to its low 8 bits, and the shell already gives 126 and above a meaning of its own.
The spec also states:
--dry-run exits 0 on a valid plan and with the real run's failure code otherwise, or CI cannot trust a passing dry run.Template: examples/core.md
stdout carries the data the caller asked for; stderr carries everything else — progress, warnings, diagnostics and prompts — so progress survives piping without corrupting the pipe.
| Context | Progress | Colour | Payload |
| --------------- | ------------------- | ------- | -------------------------------- |
| TTY, default | Spinner or progress | Yes | Human-readable summary, stdout |
| Piped (non-TTY) | Plain lines, stderr | No ANSI | Same payload, no decoration |
| `--json` | None | None | One JSON document, stdout |
| `--quiet` | None | None | Payload only; errors still shown |
| `--verbose` | Per-step detail | On TTY | Payload plus diagnostics |
The spec also states:
--json shape, the error shape included — valid JSON on failure too, and nothing else on stdout.TERM is dumb, --no-color is passed, or NO_COLOR is set to a non-empty value; a flag or user config overrides NO_COLOR. FORCE_COLOR is a convention rather than a standard — Node, for one, lets it override NO_COLOR — so the spec says which wins when both are set.--json, and which wins when they do not.Already up to date. is usually the better default, because silence leaves the user unsure whether anything ran.app list | head -1), and with which code.Template: examples/core.md
Each error has four parts, written verbatim: what failed, named as the user named it; why, in the user's vocabulary; how to fix it, as a concrete command or edit; and where to look, when a file, config key or doc page is involved.
BAD: Error: ENOENT
GOOD: Error: config file not found at ./app.config.ts.
Run 'app init' to create one, or pass --config <path>.
The spec also states:
--help, -h and help <command>.Template: examples/core.md
For a command that runs longer than an instant or writes anything, cleanup is an invariant a tester can assert:
After SIGINT during upload, no `.staging/` prefix remains under the target,
and the caller sees the process killed by SIGINT (status 130).
The spec settles each of:
Template: examples/core.md
Include the ones that apply, and name the ones deliberately out of scope.
USERPROFILE on Windows and HOME elsewhere; the config location per platform where they differ.Template: examples/core.md
<red_flags>
Breaks at runtime:
ps output and shell history. Read it from stdin or a file.app init > plan.txt writes the questions into the file and leaves the user at a blank wait. Name stderr in the spec.app list | head prints a stack trace. State the quiet exit.--json mode with no error shape — the consumer's parser fails on exactly the run it most needs to read.Surprising behaviour:
NO_COLOR set to an empty string leaves colour on; only a non-empty value disables it.--verb resolves to --verbose until --verbatim ships, and then it is an ambiguity error in every script that used it.</red_flags>
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub agents-inc/skills --plugin meta-planning-cli-planningOther plugins' skills for the same job