Skip to main content

robust-error-handling-in-scripts

Use this skill when writing shell scripts, Python automation, or any unattended batch job. Ensure failures are detected, logged, and handled — never silently ignored.

ソース情報

リポジトリ
aiming-lab/MetaClaw
ソースの最終更新活動
2026年3月10日 18:04
検出された SKILL.md の言語
英語
スター
3,464
フォーク
452

インストール方法

デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。

ソースファイルを確認

インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。

SKILL.md を表示中

SKILL.md
ソースの指示 · 読み取り専用プレビュー
name
robust-error-handling-in-scripts
description
Use this skill when writing shell scripts, Python automation, or any unattended batch job. Ensure failures are detected, logged, and handled — never silently ignored.
category
automation
# Robust Error Handling in Scripts **Shell scripts:** ```bash set -euo pipefail # Exit on error, undefined var, pipe failure trap 'echo "Failed at line $LINENO"' ERR ``` **Python scripts:** ```python import logging, sys logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s') try: main() except Exception as e: logging.exception("Unhandled error: %s", e) sys.exit(1) ``` **Retry with backoff** for transient network/API failures: ```python from tenacity import retry, stop_after_attempt, wait_exponential @retry(stop=stop_after_attempt(3), wait=wait_exponential(min=2, max=10)) def call_api(): ... ```
GitHubで見る