gateguard

gateguard is a skill for Claude Code from nklofy/code-agent-skills. It costs 58 tokens per session (1,217 once invoked), scanned C, a copy of gateguard, Apache-2.0.

A pre-action gate that blocks file edits, shell commands, and other changes until the agent investigates required facts such as imports, data formats, and project instructions.

In plain words
What is it for?
Use it in codebases where edits affect multiple modules, data files have strict schemas, or generated code must follow existing project patterns.
Why use it?
It reduces guesses in code changes by forcing the agent to gather relevant context before acting.

Skill for Claude Code

Written for Claude Code: PreToolUse hook event.

Good fit Use it in codebases where edits affect multiple modules, data files have strict schemas, or generated code must follow existing project patterns.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nklofy/code-agent-skills/gateguard
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add nklofy/code-agent-skills --skill gateguard
Clone the repo
git clone --depth 1 https://github.com/nklofy/code-agent-skills

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for gateguard

README.md
[![agentmods](https://agentmods.dev/badge/skills/nklofy/code-agent-skills/gateguard/github.svg)](https://agentmods.dev/skills/nklofy/code-agent-skills/gateguard)
Your own site
<a href="https://agentmods.dev/skills/nklofy/code-agent-skills/gateguard"><img src="https://agentmods.dev/badge/skills/nklofy/code-agent-skills/gateguard/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for gateguard

Your own site · 80×15
<a href="https://agentmods.dev/skills/nklofy/code-agent-skills/gateguard"><img src="https://agentmods.dev/badge/skills/nklofy/code-agent-skills/gateguard.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,217 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin 95% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00058 $0.01217
Opus 5 $0.00029 $0.00609
Sonnet 5 $0.00012 $0.00243
Haiku 4.5 $0.00006 $0.00122

Measured 6d ago against content hash 6e211fbe12b2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade C, and why

gateguard scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

Triggers on: `rm -rf`, `git reset --hard`, `git push --force`, `drop table`, etc.
Origin

This is a copy

95% identical to gateguard — 33 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

affaan-m-ECC/gateguard/SKILL.md · 134 lines

How it starts

The opening of the file, as written. The whole thing — 134 lines — stays where its author put it; the contents beside it link to each section on 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.

Before editing {file_path}, present these facts:

1. List ALL files that import/require this file (use Grep)
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

Write Gate (first new file creation)

Read the full file on GitHub · 134 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 134 lines · 58 tokens per session scan C 6e211fbe12b2

Subscribe to this mod's changes

gateguard is a skill published in the GitHub repository nklofy/code-agent-skills (18 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 58 tokens to every session and 1,217 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). It is 95% identical to gateguard, differing in 33 lines, and is treated as a copy.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

insight-error-page

Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…

vercel/next.js · 83 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens

next-partial-prefetching-adoption

Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…

vercel/next.js · 103 tokens