Skip to content
Back to skills

Python Error Handling

ASecurity

Design Python error paths with narrow exceptions, rollback, contextual logs, and preserved blocker truth. Use when handling retries, verifier outcomes, parser failures, or exception flow in Python services.

  • 549 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 5, 2026
developmentpython

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 5, 2026

npx -y skills add HoangNguyen0403/agent-skills-standard --skill python-error-handling --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Python Error Handling?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Python Error Handling
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hoangnguyen0403-python-error-handling-e8ad11db/badge)](https://www.skillsdirectory.com/skills/hoangnguyen0403-python-error-handling-e8ad11db)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: python-error-handling
description: Design Python error paths with narrow exceptions, rollback, contextual logs, and preserved blocker truth. Use when handling retries, verifier outcomes, parser failures, or exception flow in Python services.
metadata:
  triggers:
    files:
      - "**/*.py"
    keywords:
      - except
      - exception
      - retry
      - rollback
      - blocker
      - error handling
---

# Python Error Handling

## **Priority: P1 (HIGH)**

## Rules

- Catch the narrowest exception you can explain.
- Roll back mutable state before re-raising or returning failure status.
- Add context to logs and raised errors without discarding the root cause.
- Preserve blocker truth; do not convert real failure into vague success text.

## Recipe

1. **Handle expected failures close to the boundary**.
2. **Re-raise unexpected failures** after cleanup.
3. **Return structured blocker or verdict data** when the caller needs workflow truth.
4. **Test timeout, malformed input, and missing-env paths**.

## Anti-Patterns

- **No silent `except Exception: pass`**.
- **No broad catch that marks work complete** without evidence.
- **No duplicate logging at every stack layer**.
- **No blocker text without owner or next action** when the protocol needs both.

## References

- [Framework Map](../references/framework-map.md)

Files in this skill

  • SKILL.md1.3 KB
  • evals/evals.json1.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…