What is Claude Code Mistake Guards?
Claude Code Mistake Guards is a set of hooks and pre-ship scripts that block recurring mistakes made by AI agents working in Claude Code. It is intended for developers and teams who want project-specific checks at the point commands run, replies are produced, records are saved, or work is prepared for upload. The repository includes seven guards based on logged mistakes, with tests and instructions for installing them as a plugin or copying and configuring them in a project.
Claude Code Mistake Guards Features:
Shell Command Guard: A Bash hook blocks process-search and kill commands when their pattern would match the shell running Claude Code, and provides guidance on safer alternatives.
Optional Bash Rules: Additional configurable rules can block bare git pulls, headless visits to specified sites, upload-folder layout problems, and a first commit missing a required line.
Short Save Check: A pre-tool hook can reject saves below a configured character minimum when the save tool replaces an entire record.
Reply Checks: A Stop hook checks for configured claims about account eligibility or traffic demand and can require Claude to rewrite a matching reply.
Pre-Ship Scripts: Scripts can check marketplace listing tags and terms, preview videos, known facts and fallback answers, duplicate record titles, and sprite placement.
Project Configuration: The copy-install setup lets teams edit rules and values for their own tools, records, content, upload paths, and project workflows.
Guard Tests: Shell tests check both that configured mistakes are blocked and that examples intended to pass remain allowed.
Claude Code Mistake Guards Benefits:
Fewer Repeat Errors: Turning a repeated mistake into a blocking check can prevent the same issue from depending on an agent remembering a written instruction.
Safer Shell Work: Checking commands before execution can help avoid terminating Claude Code's own shell or getting stuck in a process-wait loop.
Earlier Catch Points: Checks during saving, replying, and pre-shipping can surface selected problems before they become a replaced record or an uploaded deliverable.
Rules That Fit: Configurable values let teams focus checks on mistakes and constraints relevant to their own workflows rather than applying every optional rule.
Visible Failure Cases: Tests for both blocked and permitted examples make it easier to check whether a rule is too broad after changing its patterns.
Use Cases:
Claude Code Shells: Use the plugin when Claude runs process-matching commands such as pkill or pgrep that could affect its own Bash shell.
Shared Git Work: Configure the Bash guard for a shared working tree where an unplanned bare git pull could disrupt concurrent work.
Overwrite-Based Saving: Set up the short-save check for an MCP save tool that replaces a full record and should not receive placeholder text.
Marketplace Publishing: Adapt the pre-ship checks for a listing workflow that needs tag limits, restricted-word checks, or a required preview video.
Generated Content: Use the generation gate in a batch pipeline where rows must match known facts and generic fallback answers should not be shipped.

