python-error-handling skill (wshobson): validation and exceptions that fail well
Makes your agent write Python with early input validation, clear exceptions and batch jobs that survive partial failures.
- Installs
- 14.4K
- on skills.sh
- Stars
- 42.1K
- on GitHub
- Files
- 1
- besides SKILL.md
- Updated
- Oct 2026
- last repo commit
This skill gives your agent four rules: fail fast, use meaningful exceptions, handle partial failures and keep error context. It shows validation at API boundaries, converting strings to enums and domain types early, Pydantic models for complex input, and mapping failures to Python's built-in exception types.
It triggers when you write validation logic, design exception strategies, handle batch failures or build APIs that handle bad input. A reference file adds custom exceptions with context, exception chaining, batch results with partial failures and progress reporting.
Good for
- Python developers building APIs that need clear error messages
- Teams designing exception hierarchies for a service
- Anyone writing batch jobs where one bad item should not stop the rest
Install python-error-handling
Claude Code
- 1
Copy this prompt.
Install the python-error-handling skill in Claude Code. Run this command: /plugin marketplace add wshobson/agents /plugin install python-development@claude-code-workflows Then check that it loaded and tell me how to use it.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
Plugin route: this is the README's own example. It adds the python-development plugin: the repo has 16 skills, 3 agents (django-pro, fastapi-pro, python-pro) and 1 command (python-scaffold) under it, and no hooks file or .mcp.json. Single-skill route: the README says the skills installers add a skill without the plugin's agents, commands or hooks.
From the project README. Source.
What's in the skill
When it loads
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.
Sections in SKILL.md
- 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
Key facts
- Installs on skills.sh
- 14,449 as of 2 Nov 2026
- License
- MIT
- Last commit in the repo
- 2026-10-30
- What is inside
- 2 files including SKILL.md
- skills.sh audits
- Gen Agent Trust Hub pass, Socket pass, Snyk pass
What it includes
Fail fast, meaningful exceptions, partial failures, preserve context
The four ideas the rest of the skill builds on.
Read ·
Core conceptsCheck inputs at the boundary, before expensive work
Raise ValueError with the field name and the bad value.
Try: “Add input validation to process_order so it fails fast with clear messages.”
Write ·
Pattern 1: early input validationParse strings into enums and typed objects early
Example parse_output_format that lists the valid options in its error.
Write ·
Pattern 2: convert to domain typesBaseModel with Field limits and field validators
For structured input with automatic error details.
Write ·
Pattern 3: Pydantic validationValueError, TypeError, KeyError, TimeoutError and others
A table of failure types and the built-in exception for each.
Read ·
Pattern 4: standard exceptionsCustom exceptions, chaining, batch results, progress callbacks
ApiError with context, raise from e, a BatchResult type for partial failures, and a progress callback for long jobs.
Write ·
Patterns 5 to 8 (references/details.md)Ten rules, from validate early to test error paths
Includes chaining exceptions, documenting failure modes and logging with context.
Read ·
Best practices summary
From the official docs
Questions
What does the python-error-handling skill do?
It makes your agent write Python that validates input early, raises specific exceptions with context, chains errors and handles partial failures in batch work.
How do I install it?
Use the install box on this page: it offers the python-development plugin or this skill alone, and the skill folder is SKILL.md plus one reference file.
Does it need Pydantic?
Pattern 3 uses Pydantic models for complex input validation. The chaining example in the reference file imports httpx.
Which Python version does it assume?
The SKILL.md does not state one.
Is it safe to run?
It is a set of coding patterns and bundles no scripts. It changes the code it writes in your project, so review the diff as usual.
Information
updated Nov 2, 2026
- Repository
- wshobson/agents
- Folder
plugins/python-development/skills/python-error-handling
Sources
Docs, issue trackers and discussions this page is built from.
Show all 3Hide
- wshobson/agents README · github.com
- python-error-handling SKILL.md · github.com
- details.md · github.com