Cli development

From saffron-health/libretto · View interactive version

Cli development is an AI agent skill from the GitHub repository saffron-health/libretto. Design and implement command-line interfaces with subcommand-scoped help, actionable success output, and debuggable failure output. Use when creating or modifying CLI commands, argument parsing, help and usage text, exit codes, or command UX for humans and agents.

How to use this skill

Skill file

CLI Development

Build CLIs that stay actionable in both success and failure paths.

Core Principles

  1. Avoid dead ends.
  1. Make failures diagnosable.
  1. Keep output minimal and context-efficient.
  1. Scope help to subcommands.

Command Contract

  1. Keep output deterministic.
  1. Use conventional stream behavior.
  1. Return meaningful exit codes.
  1. Support automation.
  1. Support safe execution.

Help and Error Pattern

Use this pattern for each subcommand:

  1. One-line purpose.
  2. Usage line.
  3. Required arguments.
  4. Optional flags.
  5. Examples, including one failure-recovery example.

When returning an error, format output in this order:

  1. Error summary.
  2. Known state.
  3. Recovery options.
  4. Exact next command.
  5. Relevant subcommand help hint.

Output Templates

Success with next step:

Created release r123.
Next: mycli release publish r123

Success without next step:

Published release r123.
No further action required.

Failure with recovery:

Error: failed to publish release r123 (artifact missing).
Known state: release exists, build step did not produce dist/app.tar.gz.
Try: mycli release build r123
Then: mycli release publish r123
Help: mycli help release publish

Implementation Checklist

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.