ac-cli-and-tool-design
Designing command-line tools that compose: exit codes and their meaning, stdout as data and stderr as progress, argument and flag conventions, idempotency and safe re-runs, interactive versus non-interactive modes, signal handling and interruption, help output that answers the question, and the written interface record. Use when asking "CLI design", "exit code", "stderr or stdout", "flag conventions", "make it scriptable", "idempotent command", "Ctrl-C handling", "--json flag", "CLI help text", "tool takes a pipe". Not for shell scripting and process supervision (ac-code-construction), not for public HTTP API contracts (ac-api-design), not for terminal UI layout and accessibility (ac-frontend-ui).
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- ac-cli-and-tool-design
- status
- seedling
- license
- MIT
- metadata
- { "domain": "software-engineering" }
- description
- Designing command-line tools that compose: exit codes and their meaning, stdout as data and stderr as progress, argument and flag conventions, idempotency and safe re-runs, interactive versus non-interactive modes, signal handling and interruption, help output that answers the question, and the written interface record. Use when asking "CLI design", "exit code", "stderr or stdout", "flag conventions", "make it scriptable", "idempotent command", "Ctrl-C handling", "--json flag", "CLI help text", "tool takes a pipe". Not for shell scripting and process supervision (ac-code-construction), not for public HTTP API contracts (ac-api-design), not for terminal UI layout and accessibility (ac-frontend-ui).
02 资源文件 10
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md378 B
- 参考文档subskills/cli-record.md2.8 KB
- 参考文档subskills/exit-codes.md2.9 KB
- 参考文档subskills/flag-conventions.md3.0 KB
- 参考文档subskills/idempotency-and-reruns.md3.0 KB
- 参考文档subskills/interactive-and-noninteractive.md3.0 KB
- 参考文档subskills/signals-and-interruption.md3.2 KB
- 参考文档subskills/stdout-and-stderr.md2.7 KB
- 参考文档TRUST.auto.yaml2.1 KB
03 SKILL.md 正文
CLI and tool design
Overview
A command-line tool is an interface with unusually strict conventions, and the conventions exist because tools are composed by shell scripts rather than read by humans. Exit codes tell a script whether to continue; stdout carries data and stderr carries everything else; flags are parsed by a library that has already decided what a short option means. Violating those conventions produces a tool that works when typed and fails when scripted.
This skill covers the design decisions that make a tool composable: what each exit code means, how to separate data from diagnostics, how to design flags that are unsurprising, how to make a re-run safe, how to behave when there is no terminal, and how to handle interruption without leaving half-written state. Shell scripting technique and API design belong to other skills.
Primary sources: https://pubs.opengroup.org/ and https://www.gnu.org/software/bash/.
When to use
- When designing a new command-line tool or a major flag change.
- When a tool must work in a pipeline or in CI.
- When a command's re-run safety matters.
- When interruption could leave inconsistent state.
When NOT to use
- For shell scripting idiom and process supervision (use ac-code-construction).
- For external API contract design (use ac-api-design).
- For interactive terminal layout (use ac-frontend-ui).
Subskill Index
| Leaf | Domain segment | Scope (one line) |
|---|---|---|
subskills/exit-codes.md |
software-engineering/exit-codes |
What each code means, and the script that consumes it. |
subskills/stdout-and-stderr.md |
software-engineering/stdout-and-stderr |
Data on one stream, everything else on the other. |
subskills/flag-conventions.md |
software-engineering/flag-conventions |
Long and short options, defaults, and the least surprising parse. |
subskills/idempotency-and-reruns.md |
software-engineering/idempotency-and-reruns |
Making a command safe to run twice. |
subskills/interactive-and-noninteractive.md |
software-engineering/interactive-and-noninteractive |
Detecting a terminal, and behaving without one. |
subskills/signals-and-interruption.md |
software-engineering/signals-and-interruption |
Ctrl-C, cleanup, and not leaving half a write. |
subskills/cli-record.md |
software-engineering/cli-record |
The written record: the interface contract a tool promises. |
Status and honest limits
The conventions described here are widespread rather than universal, and platform differences are real: a tool that behaves correctly on one operating system can violate a convention on another. Nothing here overrides the specific expectations of the environment a tool ships into. A tool's interface is also a compatibility obligation, and every flag added is one that will need to keep working.
04 同仓库更多 Skills
troves
Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.
trade
Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".
staking
Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.
send
Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".
portfolio
View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".
multi-swap
Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.