Claude Code Guardrails: stop false "done" reports

    1

    Three bash hooks that surface failed commands, force checked-vs-unchecked replies, and break retry loops.

    Free

    Security scanned

    Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+22 more

    Claude Code Guardrails: stop false "done" reports

    Example session with this skill installed

    Install the guardrail hooks for this project. Make sure we have the loop breaker and the verification quantifier.

    • Read your context and instructions
    • Compiled the claude code guardrails

    Installed the three guardrail hooks into this project. This is the real output from bash install.sh ~/myproj (macOS, jq 1.7):

      installed  ~/myproj/.claude/hooks/verify-before-done.sh
      installed  ~/myproj/.claude/hooks/quantify-claims.sh
      installed  ~/myproj/.claude/hooks/loop-breaker.sh
    
      settings   ~/myproj/.claude/settings.json  (backup written alongside)
      json ok
    
    Restart Claude Code, or open /hooks once, to load them.
    

    Check

    WhatCommandResult
    Hook events registeredjq '.hooks | keys' .claude/settings.json["PostToolUse", "UserPromptSubmit"]
    Backup writtenls .claude/settings.json.bak.20260929125322
    Second runbash install.sh ~/myprojadds no duplicate entries

    What the agent sees after a failing test run

    Fed a Bash result of === 2 failed, 14 passed === with exit code 1, verify-before-done.sh returned this context to the agent:

    The command that just ran shows failure signals: failing tests.
    
    Do NOT report this turn as done, fixed, working, or passing until you have
    addressed it. Required:
      1. Read the actual output and exit code. Do not infer them.
      2. State plainly what failed and why.
      3. Anything you could not verify, label as unverified.
    

    Next steps

    • Restart Claude Code or open /hooks once so the hooks load.
    • To remove: restore the newest settings.json.bak.*, or delete the three entries whose command ends in verify-before-done.sh, quantify-claims.sh or loop-breaker.sh.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Claude Code sometimes summarizes a turn as finished when a command in it failed. A rule in CLAUDE.md does not reliably prevent that: in one workspace the verification rule was in context for all 22 verification-shaped replies and was followed in 13 of them (59%). Hooks fire at the moment the rule matters, so these three move the rules out of the instructions file.

    What is included (3 bash hooks, 58-69 lines each, bash + jq only):

    • verify-before-done: after each Bash call, scans the output for failure signals (non-zero exit, failing test counts, tracebacks, connection refused, permission denied) and adds a note naming what it found. Skips cat/grep/head/--help so reading a file about failures does not fire it.
    • quantify-claims: on verification-shaped prompts, asks the reply to open with "verified n% (numerator/denominator)" and to name what was not checked.
    • loop-breaker: counts consecutive calls to the same tool and, past a threshold, tells the agent to stop and choose a different move. Ordinary tools (Bash, Read, Grep, Edit, Write) are skipped by default.

    install.sh merges into your existing settings.json, writes a timestamped backup first, and adds nothing on a second run. Nothing is sent anywhere; the hooks only read the hook payload on stdin. Read the hooks before installing.

    What it does not do: it does not make an agent honest or prevent every false completion. It makes failed output hard to skip past.

    How to install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free forever

    No account required to browse

    Trust & safety

    Security scanned

    Verified clean 2 days ago

    • Free to download with an account

    Listed2 days ago

    What's inside

    Frequently Asked Questions