Error Handling Patterns

Makes Claude generated code handle errors consistently instead of failing silently.

Development / Best Practicesdevelopmentbest-practices
by AgentVoltv1.0.0Published 1y ago1 install
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

PromptGenerate a user signup flow but make sure errors don't get swallowed silently
Beforegeneric AI agent
I'll create a signup flow for you. I can add basic error handling to make sure things don't break silently. That's definitely important — errors can be confusing for users if they're not handled properly. I can include try-catch blocks and some logging so that if something goes wrong, you'll be able to see what happened. Would you like me to include any specific error messages for the user? And do you have a particular logging tool you use? Once I know that, I can generate the code with the appropriate error handling patterns baked in.
Afterwith Error Handling Patterns
SIGNUP FLOW WITH CONSISTENT ERROR HANDLING:

ERROR HANDLING PATTERN (applied throughout):
function validateEmail(email) {
  try {
    const result = emailValidator.check(email);
    if (!result.valid) {
      logger.warn('signup:validation_failed', { field: 'email', reason: result.error });
      return { success: false, userMessage: 'Enter a valid email address' };
    }
    return { success: true };
  } catch (error) {
    logger.error('signup:email_validation_error', { error: error.message, stack: error.stack });
    return { success: false, userMessage: 'Email validation service down. Try again in 30 seconds.' };
  }
}

SIGNUP FLOW SECTIONS:
→ Email validation: Logs failed attempts + invalid formats, retries up to 3 times with exponential backoff
→ Password strength check: Errors logged but not exposed to user (prevents brute-force leaking)
→ Account creation API call: Catches rate limits (429), service outages (500), and missing fields, returns user-facing message + auto-retry after 5 seconds
→ Email confirmation: Timeout after 60 seconds logged as 'email_send_timeout', user sees retry option

LOGGING OUTPUT: Every error tagged by component and failure type. Silent failures = zero. Users see appropriate next steps; ops team gets full trace.

About this skill


name: error-handling-patterns description: Use when Makes Claude generated code handle errors consistently instead of failing silently.

Error Handling Patterns

Error Handling Patterns, from encodes consistent error handling conventions, covering logging, user-facing messages, and retry logic, so Claude generated code fails loudly and predictably instead of swallowing errors silently.

What you get

  • Consistent error handling and logging patterns applied across generated code.

Customize your output

  • Adjust the error handling conventions to match your own stack or logging tool.

Example output

Code with consistent, debuggable error handling instead of silent failures.

Best for

Developers who want AI generated code to fail safely and visibly.

SKILL.md preview

SKILL.md
---
name: error-handling-patterns
description: Use when generating or reviewing code that needs consistent error handling instead of failing silently or swallowing exceptions.
version: 1.0.0
category: Development / Best Practices
author: AgentVolt
license: proprietary
tags:
  - development
  - best-practices
  - standard
---

# Error Handling Patterns

Encodes consistent error-handling conventions — logging, user-facing messages, and retry logic — so generated code fails loudly and predictably instead of swallowing errors silently.

## When to use

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More development skills

View all Development skills →