Coding & developmentCLI usabilitycode

Make command-line errors actionable and stable

Designs exit codes and messages for predictable failure handling.

Editorial illustration for Make command-line errors actionable and stable
Editorial illustration for this prompt; the prompt itself does not generate this image.

Ready to use

Prompt

Given [CLI COMMANDS], [FAILURE CASES] and [AUTOMATION USERS], define an error contract with exit code, short message, remediation hint and machine-readable output for each case. Distinguish invalid input, unavailable dependency, permission failure and internal defect without leaking credentials. Provide tests that assert exit codes and safe stderr content. Do not claim a retry is safe unless operations are idempotent. Check that success never prints an error, help text names the right flag, and scripts can distinguish temporary from permanent failure.