cli-error-diagnostics

Implement structured error handling and diagnostic features in CLI tools.

6|1|Updated Feb 27, 2026
One-click install
npx skills add https://github.com/RepairYourTech/cfsa-antigravity --skill cli-error-diagnostics
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cli-error-diagnostics
Source: https://github.com/RepairYourTech/cfsa-antigravity/tree/main/.agent/skill-library/surface/cli/cli-error-diagnostics
Command: npx skills add https://github.com/RepairYourTech/cfsa-antigravity --skill cli-error-diagnostics

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

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.

Frequently Asked Questions about cli-error-diagnostics

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement structured error handling in a TypeScript CLI?

To build robust CLI error diagnostics, use patterns for structured error reporting, typo suggestions, and verbose logging in TypeScript. This ensures user-friendly feedback and maintainability by providing clear, actionable messages when failures occur.

How do I add "Did You Mean?" typo suggestions for command line errors?

Implement actionable typo suggestions by catching invalid command inputs and matching them against known commands. This CLI pattern provides context-aware fixes, helping users correct syntax mistakes without consulting external documentation.

What is the best way to generate crash reports and manage log files in a CLI tool?

Automate log file management and crash report generation to capture detailed runtime context during failures. This CLI diagnostic pattern writes structured logs to disk, preserving application state for post-mortem debugging and troubleshooting.

How do I create a diagnostic command to check CLI system health and dependencies?

Implement a dedicated diagnostic command like `doctor` to verify system health, check dependencies, and validate configurations. This CLI pattern proactively identifies environment issues, providing users with a clear health report before runtime failures occur.

Does colored CLI error output degrade gracefully in non-TTY environments?

Colored CLI output degrades gracefully in non-TTY environments by detecting display capabilities and stripping ANSI codes. This ensures error messages remain readable when piped to files or other command line tools, preventing broken formatting artifacts.

How do I define machine-readable error codes for command line applications?

Define an error code catalog mapping specific integer or string constants to each failure type in your command line application. This machine-readable format allows downstream scripts and automated systems to parse CLI output and handle specific failures programmatically.