Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
affaan-m avatar

Gateguard

  • 3.7k installs
  • 238k repo stars
  • Updated August 5, 2026
  • affaan-m/everything-claude-code

gateguard is a PreToolUse hook that blocks first edits until the agent gathers concrete facts about importers, schemas, and callers instead of self-evaluating.

About

gateguard is a PreToolUse hook that forces investigation before file edits instead of unreliable LLM self-evaluation. The three-stage gate denies the first Edit, Write, or destructive Bash attempt, forces the model to gather concrete facts, then allows retry after facts are presented. Edit and MultiEdit gates require listing all importers, affected public symbols, data schema fields and date formats with redacted values, and quoting the user instruction verbatim. Write gates demand caller file and line references, Glob confirmation no duplicate exists, and the same data schema check. Destructive Bash gates trigger on rm -rf, git reset --hard, git push --force, and drop table with rollback procedures required. Routine Bash gates once per session ask for the current request and command purpose. Documented A/B tests show gated agents averaging 9.0 versus 6.75 ungated on analytics and webhook validator tasks. Enable via scripts/hooks/gateguard-fact-force.js in hooks.json or pip install gateguard-ai with .gateguard.yml ignore paths. ECC_GATEGUARD=off disables during setup. Complements safety-guard runtime checks and post-edit code-reviewer skill.

  • Three-stage gate: deny first edit, force fact gathering, allow retry after investigation.
  • Edit gate requires Grep importers, public symbols, data schema date formats, and verbatim user quote.
  • Destructive Bash gate on rm -rf, git reset --hard, force push, and drop table with rollback plan.
  • A/B tests: gated 9.0 average versus 6.75 ungated on design depth while tests still pass.
  • Ships ECC hook gateguard-fact-force.js or pip gateguard-ai with .gateguard.yml path ignores.

Gateguard by the numbers

  • 3,720 all-time installs (skills.sh)
  • +216 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #51 of 1,352 Code Review & Quality skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

gateguard capabilities & compatibility

Capabilities
pre edit deny force allow gate workflow · importer and schema fact requirements · destructive and routine bash gate types · ecc hook and pip package installation paths · per project ignore path configuration
Use cases
code review · testing · debugging
From the docs

What gateguard says it does

DENY — block the first Edit/Write/Bash attempt
SKILL.md
npx skills add https://github.com/affaan-m/everything-claude-code --skill gateguard

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs3.7k
repo stars238k
Security audit2 / 3 scanners passed
Last updatedAugust 5, 2026
Repositoryaffaan-m/everything-claude-code

How do I stop Claude from guessing file structure and date formats before editing code in a multi-module codebase?

Block first Edit, Write, or destructive Bash attempts until the agent gathers concrete facts via Grep, Read, and Glob investigation.

Who is it for?

Codebases where AI edits affect multiple modules, data files with specific schemas, or teams needing fact-forcing before writes.

Skip if: Skip when you want permissive editing without investigation overhead or already use only post-edit review without pre-action gates.

When should I use this skill?

User works on multi-module codebases, data files with date formats, or enables GateGuard hooks for Claude Code or Cursor sessions.

What you get

First edit attempts trigger mandatory Grep, Read, and Glob investigation that improves design depth before changes land.

  • PreToolUse hook configuration
  • Investigation checklist template

By the numbers

  • Measured +2.25 point output-quality improvement versus ungated agents
  • Gates Edit, Write, Bash, and MultiEdit tool calls

Files

SKILL.mdMarkdownGitHub ↗

GateGuard — Fact-Forcing Pre-Action Gate

A PreToolUse hook that forces Claude to investigate before editing. Instead of self-evaluation ("are you sure?"), it demands concrete facts. The act of investigation creates awareness that self-evaluation never did.

When to Activate

  • Working on any codebase where file edits affect multiple modules
  • Projects with data files that have specific schemas or date formats
  • Teams where AI-generated code must match existing patterns
  • Any workflow where Claude tends to guess instead of investigating

Core Concept

LLM self-evaluation doesn't work. Ask "did you violate any policies?" and the answer is always "no." This is verified experimentally.

But asking "list every file that imports this module" forces the LLM to run Grep and Read. The investigation itself creates context that changes the output.

Three-stage gate:

1. DENY  — block the first Edit/Write/Bash attempt
2. FORCE — tell the model exactly which facts to gather
3. ALLOW — permit retry after facts are presented

No competitor does all three. Most stop at deny.

Evidence

Two independent A/B tests, identical agents, same task:

TaskGatedUngatedGap
Analytics module8.0/106.5/10+1.5
Webhook validator10.0/107.0/10+3.0
Average9.06.75+2.25

Both agents produce code that runs and passes tests. The difference is design depth.

Gate Types

Edit / MultiEdit Gate (first edit per file)

MultiEdit is handled identically — each file in the batch is gated individually.

Before editing {file_path}, present these facts:

1. List ALL files that import/require this file (use Grep)
2. List the public functions/classes affected by this change
3. If this file reads/writes data files, show field names, structure,
   and date format (use redacted or synthetic values, not raw production data)
4. Quote the user's current instruction verbatim

Write Gate (first new file creation)

Before creating {file_path}, present these facts:

1. Name the file(s) and line(s) that will call this new file
2. Confirm no existing file serves the same purpose (use Glob)
3. If this file reads/writes data files, show field names, structure,
   and date format (use redacted or synthetic values, not raw production data)
4. Quote the user's current instruction verbatim

Destructive Bash Gate (every destructive command)

Triggers on: rm -rf, git reset --hard, git push --force, drop table, etc.

1. List all files/data this command will modify or delete
2. Write a one-line rollback procedure
3. Quote the user's current instruction verbatim

Routine Bash Gate (once per session)

1. The current user request in one sentence
2. What this specific command verifies or produces

Quick Start

Option A: Use the ECC hook (zero install)

The hook at scripts/hooks/gateguard-fact-force.js is included in this plugin. Enable it via hooks.json.

If GateGuard blocks setup or repair work, start the session with ECC_GATEGUARD=off. For hook-level control, keep using ECC_DISABLED_HOOKS with the GateGuard hook ID.

Option B: Full package with config

pip install gateguard-ai
gateguard init

This adds .gateguard.yml for per-project configuration (custom messages, ignore paths, gate toggles).

Anti-Patterns

  • Don't use self-evaluation instead. "Are you sure?" always gets "yes." This is experimentally verified.
  • Don't skip the data schema check. Both A/B test agents assumed ISO-8601 dates when real data used %Y/%m/%d %H:%M. Checking data structure (with redacted values) prevents this entire class of bugs.
  • Don't gate every single Bash command. Routine bash gates once per session. Destructive bash gates every time. This balance avoids slowdown while catching real risks.

Best Practices

  • Let the gate fire naturally. Don't try to pre-answer the gate questions — the investigation itself is what improves quality.
  • Customize gate messages for your domain. If your project has specific conventions, add them to the gate prompts.
  • Use .gateguard.yml to ignore paths like .venv/, node_modules/, .git/.

Related Skills

  • safety-guard — Runtime safety checks (complementary, not overlapping)
  • code-reviewer — Post-edit review (GateGuard is pre-edit investigation)

Related skills

Forks & variants (1)

Gateguard has 1 known copy in the catalog totaling 1.4k installs. They canonicalize to this original listing.

How it compares

Choose gateguard over generic are-you-sure prompts when mutating tools need hard PreToolUse blocks tied to concrete codebase facts.

FAQ

Why does gateguard avoid self-evaluation questions?

Asking are you sure always returns yes; demanding facts forces Grep and Read that changes output quality.

How do I disable gateguard during setup?

Start the session with ECC_GATEGUARD=off or use ECC_DISABLED_HOOKS with the GateGuard hook ID.

What does the Edit gate require before retry?

All importers via Grep, affected public functions, data schema fields and date format, and verbatim user instruction.

Is Gateguard safe to install?

skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.