Development v1.0.0

missing-error-handling

Code handles only the happy path — external calls, I/O, and parsing have no failure handling and crash on anything...

mvogt99 更新于 2026-04-27 1 浏览
下载 SKILL

技能说明

Code handles only the happy path — external calls, I/O, and parsing have no failure handling and crash on anything unexpected.

使用场景

Every external interaction is a source of failure: network, disk, subprocess, parsing, third-party API. If the code assumes they always succeed, a production run will hit the first unexpected condition and crash unhelpfully.

直接复制以下提示词,发送给你的 AI 助手即可完成安装。

帮我下载并安装这个SKILL:https://skillhub.cstcloud.cn/download/missing-error-handling
  1. 点击上方「下载 SKILL」按钮,获取技能压缩包。
  2. 将压缩包解压到你的 Agent 技能目录。
  3. 重启客户端后即可在技能列表中选择该技能。

技能文件内容

4 个文件 · 13 kB
SKILL.md text/markdown
---
name: missing-error-handling
description: Code handles only the happy path — external calls, I/O, and parsing have no failure handling and crash on anything unexpected.
emoji: ⚠️
metadata:
  clawdis:
    os: [macos, linux, windows]
---

# missing-error-handling

Every external interaction is a source of failure: network, disk, subprocess, parsing, third-party API. If the code assumes they always succeed, a production run will hit the first unexpected condition and crash unhelpfully.

## Symptoms

- HTTP calls without status-code checks and without timeout.
- File I/O with no handling for missing files, permission denied, or partial reads.
- Subprocess calls that ignore non-zero exit codes.
- `JSON.parse` / `yaml.load` with no handling of malformed input.
- Broad `except:` / `catch (e) {}` that swallows everything without logging.

## What to do

- For each external call, list the failure modes explicitly: timeout, non-2xx status, missing resource, malformed payload, permissions. Handle each with specific recovery or a loud failure.
- Add a timeout to every network call. No exceptions.
- When catching, catch the specific exception types you can actually recover from. Let unknown errors propagate with context.
- When swallowing is unavoidable, log the full error with context — at minimum, the operation that failed and the arguments.
- Distinguish "user-visible error" (explain, ask them to retry or adjust) from "internal error" (log with stack, fail fast). Don't leak internal errors to users.

文件内容直接读取自技能仓库,仅供安装前审阅;以实际下载的压缩包为准。