python-error-handling
Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.
npx skills add wshobson/agents --skill python-error-handling --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Python Error Handling Build robust Python applications with proper input validation, meaningful exceptions, and graceful failure handling. Good error handling makes debugging easier and systems more reliable. ## When to Use This Skill - Validating user input and API parameters - Designing exception hierarchies for applications - Handling partial failures in batch operations - Converting external data to domain types - Building user-friendly error messages - Implementing fail-fast validation patterns ## Core Concepts ### 1. Fail Fast Validate inputs early, before expensive operations. Report all validation errors at once when possible. ### 2. Meaningful Exceptions Use appropriate exception types with context. Messages should explain what failed, why, and how to fix it. ### 3. Partial Failures In batch operations, don't let one failure abort everything. Track successes and failures separately. ### 4. Preserve Context Chain exceptions to maintain the full error trail for debugging. ## Quick Start ```python def fetch_page(url: str, page_size: int) -> Page: if not url: raise ValueError("'url' is required") if not 1 <= page_size <= 100: raise ValueError(f"'page_size' must be 1-100, got
- When to Use This Skill
- Core Concepts
- 1. Fail Fast
- 2. Meaningful Exceptions
- 3. Partial Failures
- 4. Preserve Context
- Quick Start
- Fundamental Patterns
- Pattern 1: Early Input Validation
- Pattern 2: Convert to Domain Types Early
- Pattern 3: Pydantic for Complex Validation
- Pattern 4: Map Errors to Standard Exceptions
- Detailed worked examples and patterns
- Best Practices Summary
What does the python-error-handling skill do?
Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.
How do I install it?
Run `npx skills add wshobson/agents --skill python-error-handling --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From wshobson/agents, a repository with 38,479 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.