gateguard
Skill0 starsChanged 2 months agoMITView on GitHub
Check key facts before file edits, new files, and risky commands. Use this skill to stop guesses and protect code, data, and project rules.
- Deletes or force-pushes
- Installs packages
- Commits and pushes
9 other projects use a version of this.
Adopted by
Most recently taken up by
- lhbsaa/apex-unifiedtheir own version, first seen Nov 8, 2026
- pankaj-mahaur/Agent-Daemontheir own version, first seen Nov 6, 2026
- renepf/claude-skillstheir own version, first seen Oct 25, 2026
- davidanthonyn/claude-skillstheir own version, first seen Oct 20, 2026
- NISTALTALSON/essential-claude-skillstheir own version, first seen Oct 11, 2026
- 5throck/ai-workspace-standardstheir own version, first seen Sep 26, 2026
Used with
Projects with it also use improve-codebase-architecture.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
GoogleSkillimprove-codebase-architecture
Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.
Also in 3 projects that use this
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- Fmarzochi/EGC★ 61same name
- 5throck/ai-workspace-standards★ 25same name
- NISTALTALSON/essential-claude-skills★ 1same name
- SamuelNDCE/claude-super-skill-library★ 1same name
- YogirajA/Claude-Skills★ 1same name
- davidanthonyn/claude-skills★ 0same name
- lhbsaa/apex-unified★ 0same name
- pankaj-mahaur/Agent-Daemon★ 0same name
- renepf/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
29 rules. 1 is common, 25 are distinctive, and 3 are very specific to this project.
1
Common
Most of the 9 edited versions we read keep these.
25
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 42
Do not mark a gate as passed until all facts are shown.
- Distinctive: line 43
Do not treat a plan or a promise as proof.
- Distinctive: line 44
Do not run outside tools or make web calls for a gate.
- Distinctive: line 45
Do not show secret values or private user data.
- Distinctive: line 47
Read-only checks may run before the gate passes.
- Distinctive: line 51
Before editing a file, require:
- Very specific: line 63
Search the full project when safe.
- Distinctive: line 65
If no file uses the target, show the search used and say that no use was found.
- Distinctive: line 69
Treat a rename or move as both an edit and a new path.
- Distinctive: line 73
Before creating a file, require:
- Distinctive: line 85
If the new file is a test, config file, or tool entry file, name the test runner or tool that will load it.
- Distinctive: line 87
If no caller exists yet, name the file that will be changed to add the caller.
- Distinctive: line 89
Do not gate files made by a known build tool unless the user plans to edit those files by hand.
- Distinctive: line 114
If the action cannot be undone, say so in plain words.
- Distinctive: line 116
If a command uses a wildcard, link, variable, or short path, resolve the real targets first.
- Distinctive: line 131
Do not gate each later safe command unless its goal changes in a major way.
- Very specific: line 178
Use scripts/hooks/gateguard-fact-force.js from this plugin.
- Common: line 180
If GateGuard blocks its own setup or repair, start that session with:
- Very specific: line 186
Use ECC_DISABLED_HOOKS when you only need to turn off the GateGuard hook.
- Distinctive: line 212
Do not ignore source code, tests, data rules, or live config just to make the gate quiet.
- Distinctive: line 214
Keep gate text short and exact.
- Distinctive: line 218
Do not replace fact checks with "Are you sure?"
- Distinctive: line 219
Do not accept a guess as a search result.
- Distinctive: line 220
Do not skip data shape or date checks.
- Distinctive: line 221
Do not show real secrets or private records.
- Distinctive: line 222
Do not gate every safe shell command.
- Distinctive: line 223
Do not reuse a passed gate for a new file or changed command.
- Distinctive: line 224
Do not allow a risky command when its target is not clear.
- Distinctive: line 225
Do not block read-only checks needed to answer the gate.
“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GateGuard
Community work. Credit the original author and project in every copy or fork.
GateGuard is a PreToolUse hook. It blocks an action until the agent checks key facts.
The gate follows three steps:
1. DENY: Block the first action.
2. FORCE: List the facts the agent must find.
3. ALLOW: Let the agent retry after it shows those facts.The gate must ask for facts. Do not ask, "Are you sure?" A yes or no answer does not prove that the agent checked the project.
When to Use
Use GateGuard when:
- One file may affect many other files.
- Data has a set shape or date style.
- New code must match old code.
- A command may delete or replace work.
- The agent may guess instead of checking.
Gate Rules
Track gate state by session, action type, and file path.
- Gate the first edit to each file.
- Gate each file in a batch edit.
- Gate the first routine shell command in a session.
- Gate every risky shell command.
- Gate a retry again if its target or command has changed.
- Do not mark a gate as passed until all facts are shown.
- Do not treat a plan or a promise as proof.
- Do not run outside tools or make web calls for a gate.
- Do not show secret values or private user data.
Read-only checks may run before the gate passes. These include file reads, file lists, code search, and safe status checks.
Edit Gate
Before editing a file, require:
Before editing {file_path}, show these facts:
1. List every file that imports, loads, or calls this file.
2. List the public functions, classes, routes, or data fields that may change.
3. If this file reads or writes data, show the field names, shape, and date style.
Use fake or hidden values. Do not show real private data.
4. Quote the user's current request word for word.Search the full project when safe. Skip folders such as .git/, .venv/, node_modules/, build output, and saved vendor code unless they are part of the task.
If no file uses the target, show the search used and say that no use was found.
For a batch edit, check every file before any file in the batch is changed. If the tool cannot gate each file on its own, block the whole batch and list all target files.
Treat a rename or move as both an edit and a new path. Check old users and new users.
New File Gate
Before creating a file, require:
Before creating {file_path}, show these facts:
1. Name the files and lines that will use this new file.
2. Search for an old file that may already do the same job.
3. If this file will read or write data, show the field names, shape, and date style.
Use fake or hidden values. Do not show real private data.
4. Quote the user's current request word for word.If the new file is a test, config file, or tool entry file, name the test runner or tool that will load it.
If no caller exists yet, name the file that will be changed to add the caller. If the file is meant for direct use, state how the user will run it.
Do not gate files made by a known build tool unless the user plans to edit those files by hand.
Risky Shell Gate
Gate every command that may delete data, lose work, replace history, or change a live system.
Examples include:
rm -rfgit reset --hardgit cleangit push --forceDROP TABLE- Commands that erase, replace, or send live data
Require:
Before running this command, show these facts:
1. List each file, folder, record, branch, or service it may change or delete.
2. Give a one-line way to undo the change.
3. Quote the user's current request word for word.If the action cannot be undone, say so in plain words. Do not make up an undo step.
If a command uses a wildcard, link, variable, or short path, resolve the real targets first. Block it if the target is still not clear.
A safe test run does not pass the gate for the real command. Gate the real command too.
Routine Shell Gate
Gate only the first safe shell command in a session.
Require:
1. State the user's current request in one sentence.
2. State what this command will check or make.Do not gate each later safe command unless its goal changes in a major way.
Example
User request:
Add a display name to user profiles.First edit attempt:
Edit src/profile.pyGate response:
DENY
Before editing src/profile.py, show these facts:
1. List every file that imports, loads, or calls this file.
2. List the public functions, classes, routes, or data fields that may change.
3. Show the profile data shape and date style with fake values.
4. Quote the user's current request word for word.A valid fact report may look like this:
1. src/api/users.py imports Profile.
tests/test_profile.py imports build_profile.
2. Profile, build_profile, and the /users/{id} reply may change.
3. Shape: {id, display_name, created_at}
Date style: "2026/05/12 09:30"
The value is fake.
4. "Add a display name to user profiles."The next matching edit may pass. A later edit to another file must pass its own file gate.
Setup
Included Hook
Use scripts/hooks/gateguard-fact-force.js from this plugin. Turn it on in hooks.json.
If GateGuard blocks its own setup or repair, start that session with:
ECC_GATEGUARD=offUse ECC_DISABLED_HOOKS when you only need to turn off the GateGuard hook. Use the hook ID set by the plugin.
Turn the gate back on after setup.
Python Package
pip install gateguard-ai
gateguard initThis creates .gateguard.yml. Use it to set gate types, ignore paths, and custom fact prompts.
Good Defaults
Ignore files that should not be checked by hand:
ignore_paths:
- .git/
- .venv/
- node_modules/
- dist/
- build/Do not ignore source code, tests, data rules, or live config just to make the gate quiet.
Keep gate text short and exact. Add project rules only when they help the agent find a real fact.
Common Mistakes
- Do not replace fact checks with "Are you sure?"
- Do not accept a guess as a search result.
- Do not skip data shape or date checks.
- Do not show real secrets or private records.
- Do not gate every safe shell command.
- Do not reuse a passed gate for a new file or changed command.
- Do not allow a risky command when its target is not clear.
- Do not block read-only checks needed to answer the gate.
Evidence
Two tests compared the same tasks with and without the gate:
| Task | Gated | Ungated | Gap |
| Analytics module | 8.0/10 | 6.5/10 | +1.5 |
| Webhook validator | 10.0/10 | 7.0/10 | +3.0 |
| Average | 9.0/10 | 6.75/10 | +2.25 |
In these tests, both versions ran and passed tests. The gated work had better design depth. Treat these results as small tests, not a promise for every project.
Related Skills
safety-guard: Checks safety while code runs.code-reviewer: Reviews work after edits.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

