本文へ移動
cccskills
無料GitHub で公開

add-error-handling

Implement comprehensive error handling for Python code paths to keep services resilient and user-friendly. Use when failures are currently silent or exceptions leak through.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md2.2 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Add Error Handling

Strengthen resilience by catching and recovering from predictable failures.

Steps

  1. Error detection

    • Identify failure points (network calls, file I/O, external APIs)
    • Find unhandled exceptions, missing validations, and async errors
    • Ensure coroutine boundaries (async def) wrap awaited calls with exception handling
  2. Handling strategy

    • Use specific exception types (ValueError, RuntimeError, custom errors) instead of bare except
    • Raise from lower-level exceptions (raise MyError(...) from exc) to preserve context
    • Validate inputs early (pydantic models, schema checks, assert statements for invariants)
    • Log structured errors with correlation IDs or context-specific metadata
  3. Recovery mechanisms

    • Retry transient failures with exponential backoff (tenacity, async_retry)
    • Provide fallbacks (cached data, defaults) when external services fail
    • Use context managers (with statements) to guarantee cleanup
    • Propagate user-friendly errors to callers while logging detailed internals
  4. User experience

    • Return clear API responses (HTTP 4xx/5xx) with actionable messages
    • Add loading states or retries for UI/integration components when backend requests fail
    • Suggest remediation steps in logs/docs if manual intervention is required

Checklist

  • Identified every potential failure point in the changed code
  • Added validation and sanitization for external inputs
  • Logged meaningful error details without leaking secrets
  • Wrapped async calls with appropriate try/except or asyncio.wait_for
  • Added retries or fallbacks for transient dependencies
  • Raised custom exceptions with from chains for traceability
  • Provided clear user-facing messages or HTTP status codes

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Tabular and numerical data analysis with descriptive statistics and insights. Use when the user provides data, tables, CSVs, or numbers and wants analysis.

日本語の概要は準備中です。原文の説明を表示しています。

Unique-AG/ai52026年10月11日 更新

Financial factsheet analysis with key metrics extraction and investment rationale

日本語の概要は準備中です。原文の説明を表示しています。

Unique-AG/ai52026年10月11日 更新

ci-fix

無料

Diagnose and fix CI failures without leaving your editor.

日本語の概要は準備中です。原文の説明を表示しています。

Unique-AG/ai52026年10月11日 更新

Reproduce ai-repo PR checks locally with Poe and CI scripts, including per-package typecheck and coverage behavior. Use when validating changes before push or when user asks which local commands match CI.

日本語の概要は準備中です。原文の説明を表示しています。

Unique-AG/ai52026年10月11日 更新

Ask clarifying questions before implementing to ensure Python requirements are understood. Use when a task lacks detail, dependencies are unclear, or multiple interpretations are possible.

日本語の概要は準備中です。原文の説明を表示しています。

Unique-AG/ai52026年10月11日 更新

Delete local git branches whose remotes are gone, after verifying via gh CLI that each was actually merged.

日本語の概要は準備中です。原文の説明を表示しています。

Unique-AG/ai52026年10月11日 更新

Unique-AG のスキルをすべて見る

このスキルの問題を報告する