build-cli

A design and review guide for command-line tools, including help text, human and machine output, terminal detection, signals, and exit codes.

In plain words
What is it for?
Use it when building, reviewing, or releasing a CLI. It covers JSON output, standard output versus error output, color handling, prompts, CI behavior, and installation scripts.
Why use it?
It prevents command-line programs from behaving unpredictably for people, scripts, pipes, and automated environments.

Skill for Claude CodeCodex

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/urmzd/dotfiles/build-cli
Any agent
npx skills add urmzd/dotfiles --skill build-cli
Clone the repo
git clone --depth 1 https://github.com/urmzd/dotfiles

Made for: Claude Code, Codex.

Per session 111 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,304 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 3 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 $0.00111 $0.04304
Opus 5 $0.00056 $0.02152
Sonnet 5 $0.00022 $0.00861
Haiku 4.5 $0.00011 $0.00430

Measured yesterday against content hash 7bbbc58bf83f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

build-cli scanned grade B with 3 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 yesterday.

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.

Downloads and executes remote codemediumSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

- One-liner: `curl -fsSL https://raw.githubusercontent.com/<owner>/<repo>/main/install.sh | bash`

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- One-liner: `curl -fsSL https://raw.githubusercontent.com/<owner>/<repo>/main/install.sh | bash`

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

const { execSync } = await import('child_process');
dot_agents/skills/build-cli/SKILL.md · 501 lines

How it starts

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

CLI Patterns

Design Philosophy

A junior developer should understand any CLI tool's behavior from --help alone. Prefer obvious defaults. Machine output (JSON) enables composability. All human-facing output goes to stderr.

Output Modes

Decision Tree

Scenario Output Mode Flag
Data/device API (zigbee-rest) Always JSON on stdout None needed
Dual human + machine consumers (e.g. release tools, agent orchestrators) --format json|human Default: human
CLI with optional machine output (llmem) --json flag + TTY auto-detect Default: human if TTY, JSON if piped
Human-only tool (e.g. demo recorders, interactive wizards) Styled stderr only No JSON mode

TTY Auto-Detection

Standard behavior when no explicit format flag is given:

stdout.is_terminal() → human output (styled, colored)
!stdout.is_terminal() → JSON output (machine-readable)

Override flags:

  • --json force JSON regardless of TTY
  • --no-color / NO_COLOR=1 env. Strip ANSI escape codes
  • CI=true env. Treat as non-TTY (no spinners, no prompts, no color)

JSON Conventions

  • Rust: serde_json::to_string_pretty() to stdout
  • Go: json.MarshalIndent(v, "", " ") to stdout
  • Python: json.dumps(v, indent=2) to stdout
  • Errors in JSON mode: {"error": "message"} to stdout (not stderr), exit 1

Stdout vs Stderr

Stream Content
stdout Machine-readable data: JSON, generated content, completions
stderr All human-facing UI: headers, spinners, checkmarks, errors, progress

This enables piping: tool command | jq '.field' and tool command 2>/dev/null.

Interactivity

Prompts

  Prompt text? [y/N] _

Bold prompt, [y/N] suffix. Rules:

  • Return false / skip in non-TTY (CI-safe)
  • --yes / -y flag: auto-confirm all prompts
  • Never block on stdin without checking stdin.is_terminal()

Dry-Run

Prefix all hypothetical actions with [dry-run] to stderr:

Read the full file on GitHub · 501 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. yesterday First seen · 501 lines · 111 tokens per session scan B 7bbbc58bf83f

Subscribe to this mod's changes

build-cli is a skill published in the GitHub repository urmzd/dotfiles (3 stars, last pushed 19d ago), licensed Apache-2.0. It adds 111 tokens to every session and 4,304 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it B with 3 findings (downloads and executes remote code, makes network calls, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

benchling-integration

Benchling Python SDK and REST API integration for registry entities, inventory, ELN entries, workflows, Benchling Apps, and Data Warehouse queries. Use when automating lab data with benchling-sdk or the v2 API.

magic3007/dotfiles · 50 tokens

astropy

Core Python library for astronomy and astrophysics workflows that need Astropy APIs, including units/quantities, coordinates, FITS I/O, tables, time systems, WCS, and cosmology. Use when implementing or debugging astronomical data analysis code with Astropy.

magic3007/dotfiles · 56 tokens

esm

Comprehensive toolkit for EvolutionaryScale protein language models including ESM3 (generative multimodal design across sequence, structure, and function) and ESM C (efficient embeddings). Use for protein sequence/structure/function tasks, inverse folding, embeddings, variant design, and ESMFold2 structure prediction…

magic3007/dotfiles · 96 tokens

mcp-notion-usage-guide

MCP Notion工具使用指南,包含常见问题解决方案和最佳实践。使用当: (1) 访问Notion数据库view URL出现"URL type view not currently supported"错误, (2) 需要获取数据库schema和表结构信息, (3) 查询数据库中的条目内容, (4) 创建页面时MULTISELECT字段值不存在导致失败, (5) 需要更新数据库schema添加新选项, (6) 开发需要集成Notion数据的自动化工作流, (7) querydatasources/query-database-view返回Business Plan要求错误, (8) 需要在无Business…

magic3007/dotfiles · 152 tokens

scan-commit

Automatically scan the repository for unstaged/untracked changes, group them into logical commits using hunk-level analysis, stage and commit them following Conventional Commits.

magic3007/dotfiles · 35 tokens

create-pr

Rebase from the latest origin/main, squash the commits from it, and then create a PR on github with intelligent commit messages based on staged changes.

magic3007/dotfiles · 34 tokens