Get the FREE Ultimate OpenClaw Setup Guide →

add-error-handling

npx machina-cli add skill gologo13/agent-skills/add-error-handling --openclaw
Files (1)
SKILL.md
1.8 KB

Add Error Handling

Overview

Implement comprehensive error handling for the current code to make it robust and resilient to failures while maintaining good user experience.

Steps

  1. Error Detection
    • Identify potential failure points and edge cases
    • Find unhandled exceptions and error conditions
    • Detect missing validation and boundary checks
    • Analyze async operations and network calls
  2. Error Handling Strategy
    • Implement try-catch blocks where appropriate
    • Add input validation and sanitization
    • Create meaningful error messages and logging
    • Design graceful degradation for non-critical failures
  3. Recovery Mechanisms
    • Implement retry logic for transient failures
    • Add fallback options for service unavailability
    • Create circuit breakers for external dependencies
    • Design proper error propagation and handling
  4. User Experience
    • Provide clear error messages to users
    • Implement proper error status codes for APIs
    • Add loading states and error boundaries for UI
    • Include helpful suggestions for error resolution

Add Error Handling Checklist

  • Identified all potential failure points and edge cases
  • Implemented try-catch blocks where appropriate
  • Added input validation and sanitization
  • Created meaningful error messages and logging
  • Implemented retry logic for transient failures
  • Added fallback options and circuit breakers
  • Provided clear error messages to users
  • Implemented proper error status codes for APIs
  • Added loading states and error boundaries for UI

Source

git clone https://github.com/gologo13/agent-skills/blob/main/skills/add-error-handling/SKILL.mdView on GitHub

Overview

Implement comprehensive error handling to make code robust and resilient to failures while preserving a good user experience. It covers error detection, strategy, recovery mechanisms, and UX considerations to gracefully handle failures across APIs, services, and UI.

How This Skill Works

Begin by detecting failure points and unhandled conditions, including missing validations and async operations. Then apply an error handling strategy with input validation, try-catch blocks, meaningful logging, and graceful degradation. Finally add recovery mechanisms such as retries, fallbacks, circuit breakers, and proper error propagation to callers and the user.

When to Use It

  • When building apps that call external services or perform IO operations and need robust failure handling
  • When you must present clear error messages and appropriate status codes to users or clients
  • When integrating multiple components in microservices or distributed systems
  • When the UI requires loading states and error boundaries to manage failures gracefully
  • When designing resilient batch jobs or data pipelines that may experience transient faults

Quick Start

  1. Step 1: Identify failure points, edge cases, and unhandled conditions in your codebase
  2. Step 2: Add validation, try-catch blocks, and structured logging; establish a clear error handling strategy
  3. Step 3: Implement recovery mechanisms like retries, fallbacks, circuit breakers, and user facing error messages and status handling

Best Practices

  • Identify potential failure points and edge cases across the codebase
  • Use try-catch blocks where appropriate to catch and handle errors
  • Add input validation and sanitization to prevent invalid data from causing failures
  • Create meaningful error messages and logging that aid diagnosis
  • Implement retry logic, fallbacks, and circuit breakers for resilient recovery

Example Use Cases

  • API integration with external services using retries and graceful fallbacks
  • Front end apps showing loading states, error boundaries, and user friendly messages
  • Microservices with circuit breakers and proper error propagation
  • Batch data pipelines with retry on transient failures
  • CLI tools that surface clear actionable error information and guidance

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers