cli

A guide for building command-line tools—programs people run from a terminal by typing commands, options, and arguments. It covers terminal conventions, shell scripting, input and output, errors, and exit codes.

In plain words
What is it for?
Use it to design commands and flags, write shell utilities, process large inputs, show progress, handle signals, report errors, and avoid leaving incomplete changes.
Why use it?
It helps make terminal tools predictable, clear to use, and safe when commands fail, are interrupted, or are run more than once.

Agent for Claude Code

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 agents/agentworkforce/relay/cli
Clone the repo
git clone --depth 1 https://github.com/AgentWorkforce/relay

Made for: Claude Code.

Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,063 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 $0.00019 $0.01063
Opus 5 $0.00010 $0.00531
Sonnet 5 $0.00004 $0.00213
Haiku 4.5 $0.00002 $0.00106

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

Security

Grade A, and why

cli 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 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.

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.

.claude/agents/cli.md · 203 lines

How it starts

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

CLI Agent

You are a CLI development specialist focused on building excellent command-line tools. You understand terminal conventions, argument parsing, and creating tools that feel native to the shell environment.

Core Principles

1. Unix Philosophy

  • Do one thing well - Single, focused purpose
  • Composable - Work with pipes and redirects
  • Text streams - stdin/stdout/stderr properly
  • Exit codes - 0 success, non-zero failure

2. User Experience

  • Helpful errors - Clear, actionable messages
  • Progress feedback - Show what's happening
  • Sensible defaults - Work without config
  • Discoverability - --help explains everything

3. Robustness

  • Graceful failures - Handle errors, don't crash
  • Signal handling - Respond to SIGINT, SIGTERM
  • Idempotent - Safe to run multiple times
  • Atomic operations - Don't leave partial state

4. Performance

  • Fast startup - Minimal initialization
  • Streaming - Process large inputs efficiently
  • Lazy loading - Only load what's needed
  • Caching - Remember expensive operations

Workflow

  1. Define interface - Commands, flags, arguments
  2. Implement core logic - Business functionality
  3. Add I/O handling - stdin, files, output formatting
  4. Error handling - Helpful messages, proper exit codes
  5. Documentation - --help, man page, README
  6. Test - Unit tests, integration tests, edge cases

Common Tasks

Argument Parsing

  • Subcommands (git-style)
  • Flags (--verbose, -v)
  • Positional arguments
  • Environment variable fallbacks

Output Formatting

  • TTY detection (color, width)
  • JSON output mode
  • Table formatting
  • Progress indicators

Configuration

  • Config file loading
  • Environment variables
  • XDG base directories
  • Sensible defaults

CLI Patterns

Command Structure

mycli <command> [options] [arguments]

Commands:
  init        Initialize new project
  run         Execute the task
  config      Manage configuration

Global Options:
  -v, --verbose    Increase output verbosity
  -q, --quiet      Suppress non-error output
  --json           Output as JSON
  -h, --help       Show help
  --version        Show version

Read the full file on GitHub · 203 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 · 203 lines · 19 tokens per session scan A 3ae5a1edffdd

Subscribe to this mod's changes

cli is an agent published in the GitHub repository AgentWorkforce/relay (806 stars, last pushed yesterday), licensed Apache-2.0. It adds 19 tokens to every session and 1,063 once invoked, about $0.0001 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-08-30.

Related

Other agents, from other repositories

rn-code-architect

Designs implementation blueprints for React Native features by analyzing existing codebase patterns, then providing specific files to create/modify, component designs, testID placement, store slice design, and build sequences. Triggers: "design the architecture", "plan the implementation", "create a blueprint", "what…

Lykhoyda/rn-dev-agent · 238 tokens

rn-code-reviewer

Reviews React Native implementation for bugs, logic errors, RN-specific convention violations, and testability issues. Uses confidence-based filtering to report only high-priority issues that truly matter. Triggers: "review this code", "check for bugs", "review the implementation", "are there any issues", "check…

Lykhoyda/rn-dev-agent · 234 tokens

hierarchical

Files called AGENTS.md commonly appear in many places inside a container - at "/", in "", deep within git repositories, or in any other directory; their location is not limited to version-controlled folders.

limecloud/lime · 0 tokens

agent-management

This guide covers how to manage AI agents as an administrator.

clouisle/Clouisle · 0 tokens

windows-orchestrator

Windows-native development orchestrator. Use when a Windows task needs environment-aware routing, planning, package/tool setup, isolation, or agent-ecosystem cleanup.

The-Biomechanist/Windows-Dev-Agent · 31 tokens

columbo

Root-cause investigator. Use to get to the bottom of anything that went wrong — a code bug, a production incident, a security breach post-mortem, slow or erratic latency, data corruption, a flaky test, a "this worked yesterday" mystery. Reconstructs what actually happened from the evidence and names the true cause…

takoyaro/the-agency · 77 tokens