← ClaudeAtlas

py-error-handlinglisted

Review Python code for error-handling issues including missing boundary validation, generic exceptions, swallowed failures, missing exception chaining, partial batch failure handling, and cleanup behavior. Use when reviewing validation logic, exception paths, retries, file/network operations, or batch processing.
CodeSigils/py-review-skill · ★ 0 · AI & Automation · score 62
Install: claude install-skill CodeSigils/py-review-skill
# Python Error-Handling Review Use these rules when changed code creates, catches, transforms, logs, retries, or suppresses failures. **Freshness:** stable (no external references) — review rules based on core Python conventions, not volatile APIs. ## Review Rules ### Rule: error-validate-boundary **Impact:** HIGH **Applies when:** External input enters the system through API handlers, CLI args, config, files, queues, or network payloads. **Skip when:** The caller already validated the exact invariant and the contract is local and obvious. **Python:** any **Tools:** none **Review signal:** Code trusts raw strings, dicts, or numeric ranges until deep inside business logic. **Incorrect:** ```python def fetch_page(url: str, page_size: int) -> Page: return client.get(url, params={"page_size": page_size}) ``` **Correct:** ```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 {page_size}") return client.get(url, params={"page_size": page_size}) ``` **Reason:** Boundary validation fails early with useful context instead of allowing vague downstream failures. ### Rule: error-specific-exceptions **Impact:** HIGH **Applies when:** Code raises or catches exceptions. **Skip when:** A truly unknown exception is caught only to add context and then re-raised. **Python:** any **Tools:** ruff | project-configured **Revi