What problem does it solve?
This Skill provides patterns and code examples for creating command-line interfaces (CLIs) that offer clear, actionable error messages and diagnostic capabilities, making them user-friendly and easier to troubleshoot.
Core Features & Use Cases
- Structured Error Messages: Define errors with clear messages, causes, and suggested fixes.
- Actionable Suggestions: Implement "Did You Mean?" for typos and context-aware fixes.
- Verbose/Debug Modes: Control the level of detail in output for troubleshooting.
- Diagnostic Commands: Include commands like
mycli doctor to check system health and dependencies.
- Log Files & Crash Reports: Automate logging and generate detailed crash reports for debugging.
- Error Codes: Define a catalog of machine-readable error codes.
- Colored Output: Ensure errors are displayed clearly and gracefully degrade in non-TTY environments.
- Use Case: When developing a new CLI tool, use these patterns to ensure that when an error occurs (e.g., a configuration file is missing), the user receives a helpful message like "Error: Configuration file not found. Fix: Run
mycli init to create one."
Quick Start
Implement structured error messages in your CLI tool by defining an error interface and a formatting function.