| name | gateguard |
| description | Pre-edit fact-forcing quality gate. Ensures agents investigate a file's importers, schemas, and scope constraints before making changes. Part of the 3-layer enforcement model (Hook โ Prompt โ Skill).
|
| version | 1.0.0 |
| last_reviewed | "2026-08-01T00:00:00.000Z" |
| status | active |
| scope | common |
| l2_propagate | true |
| owner | pm |
| prerequisites | Bun runtime |
| metadata | {"type":"process","triggers":["gateguard","/gateguard","investigate file","check before edit","pre-edit check"]} |
Skill: gateguard
Context
GateGuard is a pre-edit quality gate that forces agents to investigate a file before making changes. It ensures agents understand:
- Which files import or depend on the target file
- What data schemas, interfaces, and type definitions the file exports
- Whether the user's instructions impose scope constraints
This is the manual/skill layer of the 3-layer enforcement model. The hook layer (PreToolUse/BeforeTool) provides automatic enforcement on Claude CLI and Gemini CLI. This skill covers manual invocation and Antigravity (where hooks don't fire).
Enforcement Coverage
| Platform | Hook | Prompt | Skill |
|---|
| Claude Code CLI | โ
PreToolUse | โ
| โ
|
| Claude Desktop App | โ
* (bundled CLI) | โ
| โ
|
| Gemini CLI | โ
BeforeTool | โ
| โ
|
| Antigravity | โ | โ
| โ
|
* Claude Desktop App: documented by Anthropic but workspace testing (2026-05) observed intermittent behavior.
Execution Steps
When invoked (via /gateguard <file-path> or trigger match):
- Receive target file path from arguments or user input
- Search for importers: Run
grep for import patterns referencing the target file's basename
grep -r "from ['\"].*<basename>['\"]" --include="*.ts" --include="*.js" --include="*.json" --include="*.md" . | grep -v node_modules | grep -v ".git"
- Extract schemas: Scan the target file for
interface, type, enum, class exports
- Summarize findings (1-3 sentences):
- List importers (if any) and their relationship to the target
- Note any exported schemas that downstream consumers depend on
- Flag any scope constraints from user instructions
- Present to agent: Output summary as
[GATEGUARD] Pre-edit investigation complete with findings
Agent Behavior After Investigation
After completing the GateGuard investigation, the agent may proceed with the edit. If importers were found, the agent should verify that changes won't break downstream consumers.
Related
- CONSTITUTION.md ยง11.2 โ GateGuard specification
scripts/hooks/gateguard-fact-force.ts โ Hook layer implementation
- ADR-0021 โ Platform Settings Parity Policy