git-guardian

git-guardian is a skill for Claude Code, Codex from suryast/free-ai-agent-skills. It costs 40 tokens per session (3,393 once invoked), scanned C, original, MIT.

A set of checks that reviews staged Git changes before they are committed. It looks for exposed secrets, sensitive files, oversized files, merge-conflict markers, and common mistakes in AI-generated code.

In plain words
What is it for?
Use it to check API keys and other credentials, review staged files, catch unfinished merge conflicts, and audit AI-generated changes before committing or pushing.
Why use it?
It helps prevent unsafe or accidental files from entering the repository history. This is useful when an AI assistant has changed many files quickly.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Claude Code; mentions Codex.

Good fit Use it to check API keys and other credentials, review staged files, catch unfinished merge conflicts, and audit AI-generated changes before committing or pushing.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/suryast/free-ai-agent-skills/git-guardian
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 suryast/free-ai-agent-skills --skill git-guardian
Clone the repo
git clone --depth 1 https://github.com/suryast/free-ai-agent-skills

Made for: Claude Code, Codex.

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 git-guardian

README.md
[![agentmods](https://agentmods.dev/badge/skills/suryast/free-ai-agent-skills/git-guardian/github.svg)](https://agentmods.dev/skills/suryast/free-ai-agent-skills/git-guardian)
Your own site
<a href="https://agentmods.dev/skills/suryast/free-ai-agent-skills/git-guardian"><img src="https://agentmods.dev/badge/skills/suryast/free-ai-agent-skills/git-guardian/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 git-guardian

Your own site · 80×15
<a href="https://agentmods.dev/skills/suryast/free-ai-agent-skills/git-guardian"><img src="https://agentmods.dev/badge/skills/suryast/free-ai-agent-skills/git-guardian.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,393 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 original No closer match found 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.00040 $0.03393
Opus 5 $0.00020 $0.01697
Sonnet 5 $0.00008 $0.00679
Haiku 4.5 $0.00004 $0.00339

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

Security

Grade C, and why

git-guardian 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 11d 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.

Reaches for credential fileshighPrivilege escalation

SSH keys, cloud credentials, git-credentials, .npmrc, /etc/shadow: reading these is how a config file becomes a credential leak.

\.netrc$|
git-guardian/SKILL.md · 413 lines

How it starts

The opening of the file, as written. The whole thing — 413 lines — stays where its author put it; the contents beside it link to each section on GitHub.

🛡️ Git Guardian

Compatible with Claude Code, Codex CLI, Cursor, Windsurf, and any SKILL.md-compatible agent.

Pre-commit safety checks built for AI-assisted development. AI agents generate code fast — sometimes too fast. Git Guardian catches secrets, sensitive files, merge conflicts, and common AI mistakes before they land in your history.


Triggers

Activate this skill when:

  • "check before commit", "is this safe to commit", "pre-commit check"
  • "any secrets in staged files?", "check for API keys"
  • About to commit AI-generated code
  • "run git guardian", "safety check", "audit staged changes"
  • After a large AI-generated code dump, before pushing
  • User sets up a new repo and wants pre-commit safety

The Full Check Suite

Run these checks against staged changes (or a specified path). Report findings with severity: 🔴 BLOCK, 🟡 WARN, 🔵 INFO.


Check 1: Secret Detection 🔴

Patterns that indicate leaked credentials:

# Check staged files for secrets
git diff --cached --name-only | while read f; do
  echo "=== $f ==="
  git show ":$f" 2>/dev/null
done | grep -inE \
  'api[_-]?key|apikey|api[_-]?secret|\
secret[_-]?key|secret[_-]?token|\
auth[_-]?token|access[_-]?token|bearer[_-]?\
private[_-]?key|ssh[_-]?key|rsa[_-]?private|\
password\s*=\s*["\x27][^\x27"]{6,}|\
passwd\s*=\s*["\x27][^\x27"]{6,}|\
aws_access_key_id|aws_secret_access_key|\
AKIA[0-9A-Z]{16}|\
ghp_[a-zA-Z0-9]{36}|github_pat_|\
sk-[a-zA-Z0-9]{32,}|\
xoxb-|xoxa-|xoxp-|\
glpat-|glcpat-|\
npm_[a-zA-Z0-9]{36}|\
-----BEGIN (RSA|EC|DSA|OPENSSH) PRIVATE KEY'

High-risk literal patterns to check for:

# Check for raw high-entropy strings (possible tokens/keys)
git diff --cached | grep "^+" | grep -vE "^(\\+\\+\\+)" | \
  grep -E '[a-zA-Z0-9+/]{40,}={0,2}' | \
  grep -vE '(hash|sha|digest|checksum|fingerprint|base64|encoded|example|placeholder|YOUR_|REPLACE_|<.*>)' | \
  head -20

Common secret formats by provider:

Provider Pattern Example prefix
OpenAI sk-[a-zA-Z0-9]{48} sk-proj-...
Anthropic sk-ant-[a-zA-Z0-9-]{95} sk-ant-api03-...
GitHub ghp_[a-zA-Z0-9]{36} ghp_abc...
AWS AKIA[A-Z0-9]{16} AKIAIOSFODNN7...
Google API AIza[0-9A-Za-z-_]{35} AIzaSy...
Slack xoxb-[0-9-]{50,} xoxb-123-...
Stripe sk_live_[a-zA-Z0-9]{24} sk_live_...
Twilio SK[a-zA-Z0-9]{32} SK1234...
JWT eyJ[a-zA-Z0-9-_]+\.[a-zA-Z0-9-_]+\. eyJhbGc...

Read the full file on GitHub · 413 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. 11d ago First seen · 413 lines · 40 tokens per session scan C d78a17696e2f

Subscribe to this mod's changes

git-guardian is a skill published in the GitHub repository suryast/free-ai-agent-skills (2 stars, last pushed yesterday), licensed MIT. It adds 40 tokens to every session and 3,393 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it C with 1 finding (reaches for credential files). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

awesome-git-history-rebuild

Erases a repository's git history and rebuilds it as a curated commit series over the same tree: an approved split plan (proposed here or supplied by awesome-git-commit-plan), the repo's own commit rules and hooks, paced timestamps, signed commits, a verified mirror backup, a confirmation gate before every…

khasky/awesome-agent-skills · 150 tokens

awesome-git-author-rewrite

Rewrites the author and committer identity on a commit — or on every commit carrying a wrong identity — and force-pushes it safely: ownership and write-access checks, a verified mirror backup, a counted hash blast radius, and a confirmation gate before anything irreversible. Takes a commit URL plus the replacement…

khasky/awesome-agent-skills · 134 tokens

awesome-git-commit-plan

Turns a codebase into a commit plan: a navigation map of its modules and their dependency direction, then a split where every commit builds and tests on its own, so the series is bisectable end to end. Each commit is verified by replaying the ladder in a scratch clone against the repo's own gates. Output is one plan…

khasky/awesome-agent-skills · 144 tokens

spec-checkpoint

Create a comprehensive checkpoint commit with detailed analysis of all changes. Use this skill when the user says "checkpoint", "commit everything", "save my progress", "create a commit", or wants to stage and commit all current changes with a well-crafted message. Also use when the user says "/spec-checkpoint" (or…

benjaminthomas/spec-driven-dev · 98 tokens

git-workflow-and-versioning

Structures git workflow practices. Use when making any code change. Use when committing, branching, resolving conflicts, splitting uncommitted work in a messy working tree into clean atomic commits, opening or reviewing a pull request (PR), pushing to a remote, or when you need to organize work across multiple…

addyosmani/agent-skills · 89 tokens

git-advanced-workflows

Master advanced Git workflows including rebasing, cherry-picking, bisect, worktrees, and reflog to maintain clean history and recover from any situation. Use when managing complex Git histories, collaborating on feature branches, or troubleshooting repository issues.

wshobson/agents · 54 tokens