cli-contracts

cli-contracts is a skill for Claude Code, Codex from fmind/dot. It costs 33 tokens per session (605 once invoked), scanned A, original, MIT.

A planning method for defining a command-line tool's user interface before writing its code. It covers commands, options, input rules, output streams, JSON format, help, and exit codes.

In plain words
What is it for?
Specify stable CLI commands, flags, configuration precedence, validation, machine-readable output, error handling, help text, and shell completions.
Why use it?
It prevents scripts and users from depending on unclear or changing behavior, especially when errors, automation, or non-interactive use are involved.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/fmind/dot/cli-contracts
Any agent
npx skills add fmind/dot --skill cli-contracts
Clone the repo
git clone --depth 1 https://github.com/fmind/dot

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cli-contracts

README.md
[![agentmods](https://agentmods.dev/badge/skills/fmind/dot/cli-contracts.svg)](https://agentmods.dev/skills/fmind/dot/cli-contracts)
Your own site
<a href="https://agentmods.dev/skills/fmind/dot/cli-contracts"><img src="https://agentmods.dev/badge/skills/fmind/dot/cli-contracts.svg" alt="Measured on agentmods" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 605 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00033 $0.00605
Opus 5 $0.00016 $0.00302
Sonnet 5 $0.00007 $0.00121
Haiku 4.5 $0.00003 $0.00060

Measured 2d ago against content hash 8554fb2d56c4, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

cli-contracts scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/cli-contracts/SKILL.md · 33 lines

How it starts

The opening of the file, as written. The whole thing — 33 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLI Contracts

Define a command-line interface as a stable human and machine contract before implementing it. go-stack and python-stack own the language code; systematic-debugging owns unknown failures.

Workflow

  1. Name the jobs: one purpose per command, a predictable noun-verb hierarchy, and aliases only when they cannot trigger a different class of action.
  2. Specify inputs: positional arguments, flags, environment variables, config precedence, defaults, validation, mutual exclusions, and behavior without a TTY.
  3. Separate streams: requested data to stdout, diagnostics and progress to stderr; --json stays machine-readable, schema-stable, and free of decoration.
  4. Define outcomes: map success, usage errors, authentication failures, remote failures, partial results, and cancellation to documented exit codes; never turn an error into an empty success.
  5. Make help executable: root and subcommand help, examples, deprecations, and shell completions generate from the same command definition.
  6. Protect sensitive context: errors show safe command and argument context, never collected values, tokens, provider response bodies, or unredacted stderr.
  7. Handle process behavior: respect signals, cancellation, timeouts, piping, broken pipes, and cleanup; a destructive command needs a confirmation or an explicit non-interactive opt-in such as --yes.
  8. Preserve compatibility deliberately: command names, flags, JSON fields, exit codes, and script-consumed stdout are public API; prefer deprecation and migration guidance over silent changes.
  9. Test the contract: help, parsing, validation, streams, exit codes, JSON schema, cancellation, and representative success and failure paths, then mise run check and mise run test.
  10. Exercise the installed binary: from a clean shell, piped and non-TTY; direct function tests alone do not prove the contract.

Read the full file on GitHub · 33 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 33 lines · 33 tokens per session scan A 8554fb2d56c4

Subscribe to this mod's changes

cli-contracts is a skill published in the GitHub repository fmind/dot (4 stars, last pushed yesterday), licensed MIT. It adds 33 tokens to every session and 605 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.