Skip to content
Back to skills

Write Cli Tool

ASecurity

Designs and implements a small command-line tool with subcommands, help text, exit codes, config precedence and tests. Use when turning a manual workflow into a reusable command.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 26, 2026
ai-agentspythonrustgonode

Works with

  • terminal
  • cli

Security analysis

A100/100

Scanned November 26, 2026

npx -y skills add hermes-hq/hodios-dist --skill write-cli-tool --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Write Cli Tool?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Write Cli Tool
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hermes-hq-write-cli-tool/badge)](https://www.skillsdirectory.com/skills/hermes-hq-write-cli-tool)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: write-cli-tool
description: Designs and implements a small command-line tool with subcommands, help text, exit codes, config precedence and tests. Use when turning a manual workflow into a reusable command.
license: CC0-1.0
arguments:
  - purpose
  - language
  - commands
argument-hint: <purpose> [language] [commands]
disable-model-invocation: true
metadata:
  version: 1.0.0
  kind: prompt
  category: implementation
  source: https://hermes-ide.com/prompts/write-cli-tool
  catalog: 2026.1014.1
---

# Write a command-line tool

## Inputs

- `purpose` (required): What the tool is for, who runs it, and the workflow it replaces.
- `language` (optional; default: python): Implementation language. If the repo already has CLI code, its language and parser win.
- `commands` (optional): Subcommands you already have in mind, with their inputs. Leave empty to have them designed from the purpose.

Arguments fill these in order. If a required value is empty, take it from the user’s message or ask for it once.

<context>
A good CLI behaves the way experienced terminal users expect without reading its source. It prints help, keeps data on stdout and messages on stderr, returns exit codes that scripts can branch on, works in a pipe, asks before destroying anything, and takes configuration from flags, environment and files in a predictable order. Most quick tools get two of these right and surprise their users with the rest.
</context>

<task>
Build a command-line tool in $language for this purpose:

$purpose

Planned commands: $commands (if empty, design the smallest command set that covers the purpose).

1. If the purpose is too vague to name the commands and their inputs, ask up to 3 questions and stop.
2. Design the command surface before writing code: commands as verbs (`tool sync`, `tool list`), arguments and flags per command, defaults, output, and exit codes. Use `-h/--help` and `--version` everywhere. Add `--json` for any command whose output another program might read, and `--dry-run` plus `--yes` for anything destructive.
3. Use the ecosystem's standard parser, or the one the repo already uses: argparse or Typer for Python, Cobra or the standard `flag` package for Go, clap for Rust, Commander or `util.parseArgs` for Node.
4. Configuration precedence, highest first: flags, then environment variables with a tool prefix (`TOOL_*`), then a project config file, then a user config file under the platform config directory (`$XDG_CONFIG_HOME` on Linux), then defaults. Document it in `--help` and in the README.
5. Behaviour rules:
   - Exit codes: 0 success, 1 failure, 2 usage error. Add specific codes only if callers need to tell failures apart, and document them.
   - Data to stdout and progress, warnings and errors to stderr. Errors say what failed and what to do next.
   - Detect a non-interactive terminal: no colours, spinners or prompts when piped. Respect `NO_COLOR`. Accept `-` for stdin where a file is expected.
   - On Ctrl-C, stop cleanly, leave no partial files, and exit 130.
6. Write tests: argument parsing per command, exit codes for success, usage error and runtime failure, `--json` output shape, and one end-to-end run in a temporary directory. Do not test against the real network or the user's home directory.
7. Add a README section with installation, a usage example per command, the config precedence and the exit codes. Run the tests and a `--help` smoke check.
</task>

<constraints>
- Keep it small: no plugin system, no global state, and no dependencies beyond the parser and what the purpose truly needs.
- Never print secrets, including in `--verbose` or debug output.
- Keep business logic in plain functions the CLI layer calls, so it can be tested without a subprocess.
- Before saying the work is done, run the check that proves it (tests, build, type check or the command the user gave) and report the real result.
- If you could not run a check, say so plainly and say which one.
</constraints>

<output_format>
## Command surface
| Command | Arguments and flags | Output | Exit codes |
Then the config precedence in one line.

## Files
A tree, then each file in its own code block.

## Tests
One line per test: what it proves.

## Decisions
Choices you made that the purpose did not dictate, one line each.

## Verification
Commands run (tests, `--help`) and their actual results.
</output_format>

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.