gateguard
Fungsinya
GateGuard adalah pemeriksa yang mencegah AI mengubah atau membuat file kode tanpa lebih dulu memahami konteksnya. AI diwajibkan menyampaikan informasi penting sebelum perubahan diizinkan.
Kapan dipakai
- โSaat bekerja pada proyek kode dengan banyak file yang saling terhubung.
- โSaat kode yang dibuat AI perlu mengikuti pola tertentu.
- โPada proyek yang menangani file data dengan format atau struktur yang sudah ditentukan.
Link skill
https://github.com/affaan-m/ECC/blob/main/skills/gateguard/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
โSebelum mengedit file 'utils.js', tolong sampaikan fakta-fakta berikut: daftar semua file yang mengimpor file ini, daftar fungsi publik yang terdampak perubahan, struktur dari file data yang dibaca atau ditulis file ini, dan kutipan instruksi asli dari pengguna.โ
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Saat AI mencoba mengedit atau membuat file, GateGuard lebih dulu memblokir tindakan tersebut. Lalu GateGuard meminta AI mengumpulkan informasi spesifik tentang kode dan data. Setelah AI menyampaikan informasi itu, barulah AI boleh mencoba tindakannya lagi.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
โฆ
Pertanyaan umum
Mengapa AI perlu menyampaikan fakta?
AI bisa membuat kesalahan karena menebak-nebak. Dengan mewajibkan penyampaian fakta, AI benar-benar memahami dampak tindakannya, sehingga kode yang dihasilkan lebih aman dan berkualitas.
Informasi apa saja yang perlu disampaikan AI?
Tergantung jenis file dan perubahannya. Umumnya meliputi file lain yang menggunakan file yang diubah, bagian publik dari kode yang akan terdampak, serta detail dari file data yang terlibat.
Apakah GateGuard menghentikan AI untuk bekerja?
Tidak. GateGuard hanya memastikan AI bekerja lebih cerdas dan aman dengan mewajibkannya berpikir sebelum bertindak, terutama pada bagian kode yang penting.
Detail
Deskripsi asli dari pembuat
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
Popularitas
- Bintang GitHub
- 280k
- Peringkat
- #320
- Lisensi
- MIT
- Diperbarui
- 15/10/2026
Komentar
- โฆ
Skill lain dari repositori ini
accessibility
280kMembantu agent Anda membuat antarmuka yang ramah untuk semua orang. Memastikan website dan aplikasi tetap bisa dipakai penyandang disabilitas, seperti tunanetra.
agent-architecture-audit
280kMembuat agent Anda memeriksa apakah semuanya berjalan dengan benar. Agent akan menemukan dan memperbaiki masalah pada sistem AI agar bekerja sesuai harapan.
agent-eval
280kMembantu agent Anda membandingkan berbagai alat coding AI. Mengukur mana yang lebih cepat, lebih murah, dan lebih andal untuk tugas tertentu.
agent-harness-construction
280kMembuat agent Anda lebih memahami cara menyelesaikan tugas. Agent mengoptimalkan alat dan instruksi yang digunakan agar peluang berhasilnya lebih besar.
Skill serupa
add-model-provider
394kMemungkinkan agent Anda menghubungkan penyedia model AI baru ke OpenClaw dengan perintah pengaturan yang aman, menjaga kunci API tetap di luar teks biasa, dan menjalankan uji langsung.
acp-router
394kMembantu agent Anda mengirim tugas ke asisten pemrograman seperti Claude Code atau Cursor lewat OpenClaw, sehingga pekerjaan dijalankan di alat tersebut.
browser-automation
394kMengajari agent Anda mengendalikan halaman web langkah demi langkah, termasuk login, tab, dan pemulihan saat halaman berhenti merespons.