Agent skill

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.

Seth Hobson38,331★ · +219/wk · 1 repos on radarProfile →
claude-codecodexcopilotcursorMIT
Install
npx skills add wshobson/agents --skill python-error-handling --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 6 KB
Bundled scripts: none
Path: plugins/python-development/skills/python-error-handling/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 38,479 · +148 this week
Language: Python
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# 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

What's inside
Steps it walks through
  1. When to Use This Skill
  2. Core Concepts
  3. 1. Fail Fast
  4. 2. Meaningful Exceptions
  5. 3. Partial Failures
  6. 4. Preserve Context
  7. Quick Start
  8. Fundamental Patterns
  9. Pattern 1: Early Input Validation
  10. Pattern 2: Convert to Domain Types Early
  11. Pattern 3: Pydantic for Complex Validation
  12. Pattern 4: Map Errors to Standard Exceptions
  13. Detailed worked examples and patterns
  14. Best Practices Summary
Ships with 1 file
  • references/details.md
More from agents
All skills →
About this skill
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.

Keep going