silent-failure-detection
Use when a command may exit 0 without doing its job, or when a tool reports success but the effect is unverified. Asserts the intended effect on the artefact, not merely the exit status.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- silent-failure-detection
- description
- Use when a command may exit 0 without doing its job, or when a tool reports success but the effect is unverified. Asserts the intended effect on the artefact, not merely the exit status.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md350 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Silent Failure Detection
Exit code 0 means the program finished, not that it worked. Assert the effect you wanted on the real artefact; a green checkmark on an empty result is the classic silent failure.
Procedure
- Turn on strict shell behaviour for any step that must not silently miss:
set -euo pipefailat the top of scripts. - Assert the artefact, not the status. After a write, check it exists and is non-empty:
test -s out.json || { echo "empty output"; exit 1; }. - After an upsert or count-changing operation, compare before/after counts and fail if unchanged when it should have changed:
[ "$after" -gt "$before" ] || exit 1. - Never treat "no output" as success. An empty
grepmeans either no match or a bad pattern; print the count explicitly and branch on it:n=$(grep -c "ERROR" app.log || true); [ "$n" -gt 0 ] && .... - Check stderr even when the exit code is 0. Many tools print the real error to stderr and still exit 0: capture and inspect it (
2>err.txt; test ! -s err.txt || cat err.txt). - For HTTP work, assert the body/parse, not just the status: a 200 that returns an error page or
{"error": ...}is a failure. Validate a field exists:jq -e '.results | length > 0' resp.json. - For find/glob/loop steps, assert the input set was non-empty before iterating; a loop over zero items "succeeds" while doing nothing.
- For pipelines, know that
set -o pipefailcatches a failing earlier stage whose success masked a crash. - Record the assertion's evidence (the count, the byte size, the parsed field) in the workspace so the check is auditable.
- For each critical step, name the one number that proves it worked (row count, byte size, parsed field) and assert it.
- Assert the input set was non-empty before a loop or map, so zero items is a failure rather than a success.
- Hash the artefact when a transform should change it:
shasum -a 256 before.bin after.binmust differ.
Pitfalls
- Reporting "tests passed" when the runner collected 0 tests.
find src -name '*.ts' | xargs tscpassing because the glob matched nothing.- A fetch that returns a login/error HTML page with HTTP 200, parsed as if it were data.
- Ignoring stderr because the exit code was 0, missing a warning that foreshadows data loss.
- A migration that "ran" but affected 0 rows because the WHERE clause matched nothing.
- A test runner reporting success while collecting zero tests, because the glob matched nothing.
- Grepping for a success string that also appears in an error message, so failures read as passes.
Verification
test -s out.json && jq -e '.results|length>0' out.json >/dev/null && echo OK
# passes only when the artefact exists, is non-empty, and contains real results
Report to the user: for each critical step, the effect assertion run and its observed value (count, size, parsed field), not just the exit code.
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
mexc-spot-websocket
MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.
mexc-spot-rest
MEXC Spot REST workflows for public data, signed account requests, orders, wallet/admin actions, and secure signing without exposing API keys.
mexc-futures-websocket
MEXC Futures WebSocket workflows for public streams, private account/order/position streams, ping/pong, subscriptions, and depth maintenance.
0xklen-version-and-refresh-sanctions-lists
暂无简介
verify-tests-cover-changed-lines
Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.