jpskill.com
🛠️ 開発・MCP コミュニティ

python-errors-reliability

Pythonでエラー処理、リトライ戦略、タイムアウト設定、失敗分類などを設計する際に活用し、例外を握りつぶしたり、エラーコンテキストを失ったり、無限リトライが発生したりする問題を解決するSkill。

📜 元の英語説明(参考)

Use when designing error handling, retry policies, timeout behavior, or failure classification in Python. Also use when code swallows exceptions, loses error context across boundaries, has unbounded retries, silent failures, or lacks idempotency guarantees on retried writes.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Pythonでエラー処理、リトライ戦略、タイムアウト設定、失敗分類などを設計する際に活用し、例外を握りつぶしたり、エラーコンテキストを失ったり、無限リトライが発生したりする問題を解決するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o python-errors-reliability.zip https://jpskill.com/download/10636.zip && unzip -o python-errors-reliability.zip && rm python-errors-reliability.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/10636.zip -OutFile "$d\python-errors-reliability.zip"; Expand-Archive "$d\python-errors-reliability.zip" -DestinationPath $d -Force; ri "$d\python-errors-reliability.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して python-errors-reliability.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → python-errors-reliability フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Python のエラーと信頼性

概要

呼び出し元が対応でき、運用者が迅速に診断できるようにエラーを設計します。 これらの推奨事項は、推奨されるデフォルトとして扱ってください。デフォルトがプロジェクトの制約と矛盾する場合は、より適切な代替案を提案し、トレードオフと補完的な制御を明示してください。

どのような時に使うか

  • タイムアウト、デッドライン、またはリトライロジックを実装またはレビューするとき。
  • レイヤー境界を越えて例外を変換するとき(例:infra → domain)。
  • 失敗をリトライ可能か永続的かを分類するとき。
  • リトライされる書き込みにべき等性の保証を追加するとき。
  • 既存のコードで握りつぶされた例外またはサイレントな失敗を診断するとき。

使用しない場合:

  • I/O または失敗モードのない純粋なデータ変換コード。
  • 変換の必要なくすぐに例外を発生させる単純なバリデーション。
  • 失敗処理とは関係のないパフォーマンスチューニング(python-concurrency-performanceを参照)。

クイックリファレンス

  • 変換境界で原因チェーンを保持します。
  • 処理できるものだけをキャッチします。
  • タイムアウト/デッドラインポリシーを明示的にします。
  • リトライポリシーを明示的かつ制限付きにします。
  • リトライ可能か永続的な失敗を、明示的なポリシーデータで分類します。
  • リトライされる書き込みに対して、べき等性の期待値を明示的にします。

よくある間違い

  • 例外の握りつぶし — 単純な except: pass またはロギングなしの except Exception は、診断コンテキストを失います。
  • 無制限のリトライ — 最大回数または合計デッドラインなしでリトライすると、連鎖的な失敗とリソースの枯渇につながります。
  • 原因チェーンの削除from original なしで新しい例外を発生させると、運用者が診断に必要な根本原因が破棄されます。
  • すべてのエラーをリトライ可能として扱う — 400 Bad Request またはバリデーションエラーをリトライすると、リソースを浪費し、実際の修正を遅らせます。
  • 暗黙的なタイムアウト — ライブラリのデフォルト(またはタイムアウトなし)に依存すると、失敗条件下で予測不可能なレイテンシが発生します。

スコープに関する注意

  • これらの推奨事項は、一般的なケースに対する推奨されるデフォルトとして扱い、普遍的なルールとして扱わないでください。
  • デフォルトがプロジェクトの制約と矛盾する場合、または結果を悪化させる場合は、より適切な代替案を提案し、このケースでなぜそれが優れているのかを説明してください。
  • 逸脱する場合は、トレードオフと補完的な制御(テスト、可観測性、移行、ロールバック)を明示してください。

呼び出しに関する注意

  • このスキルが名前で呼び出されている場合は、ユーザーに通知します:python-design-modularity

参考文献

  • references/error-strategy.md
  • references/retryability-classification.md
  • references/retries-timeouts.md
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Python Errors and Reliability

Overview

Design errors so callers can act and operators can diagnose quickly. Treat these recommendations as preferred defaults — when a default conflicts with project constraints, suggest a better-fit alternative and call out tradeoffs and compensating controls.

When to Use

  • Implementing or reviewing timeout, deadline, or retry logic.
  • Translating exceptions across layer boundaries (e.g., infra → domain).
  • Classifying failures as retryable vs. permanent.
  • Adding idempotency guarantees to retried writes.
  • Diagnosing swallowed exceptions or silent failures in existing code.

When NOT to use:

  • Pure data-transformation code with no I/O or failure modes.
  • Simple validation that raises immediately with no translation needed.
  • Performance tuning unrelated to failure handling (see python-concurrency-performance).

Quick Reference

  • Preserve cause chains at translation boundaries.
  • Catch only what can be handled.
  • Keep timeout/deadline policy explicit.
  • Keep retry policy explicit and bounded.
  • Classify retryable vs. permanent failures with explicit policy data.
  • Keep idempotency expectations explicit for retried writes.

Common Mistakes

  • Swallowing exceptions — bare except: pass or except Exception with no logging loses diagnostic context.
  • Unbounded retries — retrying without a maximum count or total deadline leads to cascading failures and resource exhaustion.
  • Dropping the cause chain — raising a new exception without from original discards the root cause operators need for diagnosis.
  • Treating all errors as retryable — retrying a 400 Bad Request or a validation error wastes resources and delays the real fix.
  • Implicit timeouts — relying on library defaults (or no timeout at all) produces unpredictable latency under failure conditions.

Scope Note

  • Treat these recommendations as preferred defaults for common cases, not universal rules.
  • If a default conflicts with project constraints or worsens the outcome, suggest a better-fit alternative and explain why it is better for this case.
  • When deviating, call out tradeoffs and compensating controls (tests, observability, migration, rollback).

Invocation Notice

  • Inform the user when this skill is being invoked by name: python-design-modularity.

References

  • references/error-strategy.md
  • references/retryability-classification.md
  • references/retries-timeouts.md