gateguard
하는 일
GateGuard는 AI가 문맥을 먼저 이해하지 않고 코드 파일을 바꾸거나 새로 만드는 것을 막는 검사 도구입니다. 수정을 허용하기 전에, AI가 중요한 정보를 먼저 제시하도록 요구합니다.
사용하는 경우
- ✓서로 연결된 파일이 많은 코드 프로젝트에서 작업할 때.
- ✓AI가 만든 코드가 특정 패턴을 따라야 할 때.
- ✓정해진 형식이나 구조를 가진 데이터 파일을 다루는 프로젝트일 때.
스킬 링크
https://github.com/affaan-m/ECC/blob/main/skills/gateguard/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“'utils.js' 파일을 수정하기 전에, 다음 사실을 먼저 알려 주세요. 이 파일을 가져오는 모든 파일 목록, 변경으로 영향을 받는 공개 함수 목록, 이 파일이 읽고 쓰는 데이터 파일의 구조, 그리고 원래 사용자 지시를 그대로 인용해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI가 파일을 수정하거나 만들려고 하면 GateGuard가 먼저 그 작업을 막습니다. 그다음 AI에게 코드와 데이터에 대한 구체적인 정보를 모으라고 지시합니다. AI가 그 정보를 제시한 뒤에야 작업을 다시 시도할 수 있습니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
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:
| 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 | 6.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;
entries without their own file_path are gated as the call's file_path.
NotebookEdit is gated as an Edit of its notebook_path: same class, checked
key, credit and cap rules, the full questions (the cell change is not read),
and never a comment-only pass.
The questions depend on the target's class (see Questions by target class). For code targets the Edit gate asks:
Before editing {file_path}, present these facts:
1. List ALL files that import/require this file (search the tree — Glob/Grep, or find/grep via Bash)
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
These four are the full set, asked whenever the change cannot be read with confidence. When it can (see Questions fit the change), an edit that touches no public declaration asks instead for the call sites in the file or its module that rely on the changed behaviour, and item 3 is dropped when the change handles no data.
Write Gate (first new file creation)
For code targets the Write gate asks:
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 (search the tree — Glob/Grep, or find/grep via Bash)
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
Item 3 is dropped when the new content handles no data.
Questions fit the change
For code targets the gate reads the change it is about to allow (Edit
old_string/new_string, every MultiEdit entry for the file, Write
content) and decides three things:
- Public surface: a line on either side declares or exposes a public name.
JS/TS:
export,exports,public,declare(.d.tsfiles always); Python:def/classnot starting with_, dunders,__all__, a module-level public assignment such asBASE_URL = ...(__init__.pyalways); Go: capitalisedfunc/type/var/constnames,package, lines starting with a capital; Rust:pub,impl,trait,extern,#[macro_export],#[derive],#[repr],#[no_mangle]; shell: function definitions,export,declare -x; PowerShell:function,filter,param,Export-ModuleMember,[CmdletBinding. A member of an exported container counts too, judged from the file: lines inside an exported interface, enum, type, object or export list, member declarations of an exported class,__all__entries, public class attributes and dataclass fields, and members
…
자주 묻는 질문
왜 AI가 사실을 제시해야 하나요?
AI는 추측으로 실수할 수 있습니다. 사실을 요구하면 AI가 자신의 행동이 미치는 영향을 이해하게 되어, 더 안전하고 품질 높은 코드를 만들 수 있습니다.
AI가 제시해야 하는 정보는 어떤 것인가요?
파일 종류와 변경 내용에 따라 다릅니다. 보통 변경되는 파일을 사용하는 다른 파일, 영향을 받는 코드의 공개 부분, 관련된 데이터 파일의 세부 사항이 포함됩니다.
GateGuard가 AI의 작업을 멈추나요?
아니요. 행동하기 전에 생각하도록 요구해서, AI가 더 똑똑하고 안전하게 작업하도록 할 뿐입니다. 특히 코드의 중요한 부분에서 효과가 큽니다.
상세 정보
작성자의 원본 설명
PreToolUse fact-forcing gate that denies the first Edit/Write/Bash (including MultiEdit and NotebookEdit) attempt until the agent presents concrete facts (importers, data schemas, verbatim user instruction), then allows retry; A/B-tested at +2.25 quality points. Use when enabling or configuring the GateGuard hook, exempting paths via env vars, or handling first-touch denials.
repo: affaan-m/ECC
인기도
- GitHub 스타
- 280k
- 순위
- #320
- 라이선스
- MIT
- 업데이트
- 2026. 10. 15.
댓글
- …
이 저장소의 다른 스킬
accessibility
280k에이전트가 모든 사람이 쓸 수 있는 인터페이스를 만들도록 돕습니다. 시각 장애나 운동 장애가 있는 사람도 쓸 수 있게 합니다.
agent-architecture-audit
280k에이전트가 모든 것이 올바르게 작동하는지 점검하도록 돕습니다. AI 시스템의 문제를 찾아 고쳐서 기대대로 작동하게 합니다.
agent-eval
280k에이전트가 서로 다른 AI 코딩 도구를 비교하도록 돕습니다. 특정 작업에서 어느 도구가 더 빠르고, 저렴하고, 믿을 만한지 측정합니다.
agent-harness-construction
280k에이전트가 작업을 더 잘 이해하도록 돕습니다. 에이전트가 쓰는 도구와 지시문을 최적화해 성공 가능성을 높입니다.
비슷한 스킬
add-model-provider
394k에이전트가 안전한 설정 명령으로 새 AI 모델 제공자를 OpenClaw에 연결하고, API 키를 평문으로 두지 않으며, 실시간 테스트를 실행하도록 돕습니다.
acp-router
394k에이전트가 OpenClaw를 통해 Claude Code나 Cursor 같은 코딩 도우미에 작업을 전달해, 작업이 그 도구에서 실행되도록 돕습니다.
browser-automation
394k에이전트가 로그인, 탭, 페이지 응답이 멈췄을 때의 복구를 포함해 웹 페이지를 단계별로 조작하도록 가르칩니다.