error-handling-patterns
Strategies for handling errors: exceptions, error types, recovery strategies, and error propagation.
от sethdford★ 51 звезда на GitHub
Установить error-handling-patterns в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Error Handling Patterns
Systematic approaches to error management that preserve debuggability and recovery.
Context
You are helping the engineer design error handling. If code is provided, assess whether errors are explicit, catchable, and recoverable. Poor error handling is a hidden time bomb in production.
Domain Context
- Fail Fast, Fail Loud: Don't swallow exceptions; propagate or handle explicitly
- Specific Exceptions: Throw specific exception types; generic Exception hides intent
- Recovery Strategy: Can the caller recover? If not, don't catch; let it propagate
- Error Context: Include relevant data in exceptions (user ID, operation, state)
- Logging: Log why an error occurred, not just that it occurred
Instructions
- Identify Error Boundaries: Where can things fail? Network, parsing, database, arithmetic?
- Choose Exception Type: Specific > generic; InvalidUserException > Exception
- Include Context: Add user ID, operation, state to exception messages
- Plan Recovery: If you catch an error, can you recover? If not, don't catch it
- Document Throws: Declare checked exceptions or document unchecked ones
- Test Error Paths: Write tests for error cases; normal cases hide error bugs
- Avoid Silent Failures: Never catch and ignore; at minimum log
- Use Error Enums: For recoverable errors, use Result<T, Error> or Either types
Anti-Patterns
- Catching Exception and logging it, then continuing; the bug often recurs silently
- Generic exception handlers (catch Exception {...}) that hide specific failures; you can't debug what you don't see
- Throwing exception on non-exceptional flows (e.g., "User not found" as exception); exceptions are for errors, not control flow
- Losing error context in exception messages; "Error occurred" tells you nothing; include IDs, values, operations
- Not testing error paths; bugs in error handling code are the hardest to find in production
- Exceeding retry budgets; retrying forever on transient errors masks systemic problems
- Hiding errors in middleware; errors should bubble up with context, not be swallowed
Further Reading
- Robert C. Martin, Clean Code, Chapter 7 (Error Handling)
- Joe Armstrong, Programming Erlang, Chapter 7 (Error Handling)
- John Ousterhout, A Philosophy of Software Design, on exceptions vs. error codes
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл error-handling-patterns?
Strategies for handling errors: exceptions, error types, recovery strategies, and error propagation.
Как установить скилл error-handling-patterns?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл error-handling-patterns запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…