본문으로 건너뛰기
Skillpedia
에이전트280k · #320

gateguard

하는 일

GateGuard는 AI가 문맥을 먼저 이해하지 않고 코드 파일을 바꾸거나 새로 만드는 것을 막는 검사 도구입니다. 수정을 허용하기 전에, AI가 중요한 정보를 먼저 제시하도록 요구합니다.

사용하는 경우

  • ✓서로 연결된 파일이 많은 코드 프로젝트에서 작업할 때.
  • ✓AI가 만든 코드가 특정 패턴을 따라야 할 때.
  • ✓정해진 형식이나 구조를 가진 데이터 파일을 다루는 프로젝트일 때.

스킬 링크

https://github.com/affaan-m/ECC/blob/main/skills/gateguard/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/affaan-m/ECC/blob/main/skills/gateguard/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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.ts files always); Python: def/class not starting with _, dunders, __all__, a module-level public assignment such as BASE_URL = ... (__init__.py always); Go: capitalised func/type/var/const names, 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.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬