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.
- Star
- 3,473
- 分类
- 写作与翻译
- 许可证
- MIT
- 最近提交
- 2026年6月7日
memory_data/skills/robust-error-handling-in-scripts/SKILL.md
在 GitHub 上查看Robust Error Handling in Scripts
Shell scripts:
set -euo pipefail # Exit on error, undefined var, pipe failure
trap 'echo "Failed at line $LINENO"' ERR
Python scripts:
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:
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(): ...
相似的 Skill
精选
writing-fragments
MAmattpocock/skills336k近 7 天新增 4,217 个 star
writing-shape
MAmattpocock/skills336k近 7 天新增 4,217 个 star
writing-beats
MAmattpocock/skills336k近 7 天新增 4,217 个 star
perfect-docs
MAmattpocock/skills336k近 7 天新增 4,217 个 star
writing-skills
OBobra/superpowers331k近 7 天新增 5,030 个 star