gitleaks

gitleaks is a skill for Claude Code, Codex from fmind/dot. It costs 41 tokens per session (783 once invoked), scanned A, original, MIT.

A guide for finding leaked credentials and other secrets in staged changes, files, or Git history using gitleaks.

In plain words
What is it for?
Use it to scan pending changes, the working tree, recent commits, or the full history, and to manage approved exceptions and credential rotation.
Why use it?
It helps catch credentials before they reach a remote repository and identifies secrets that may already exist in past commits.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/fmind/dot/gitleaks
Any agent
npx skills add fmind/dot --skill gitleaks
Clone the repo
git clone --depth 1 https://github.com/fmind/dot

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 gitleaks

README.md
[![agentmods](https://agentmods.dev/badge/skills/fmind/dot/gitleaks.svg)](https://agentmods.dev/skills/fmind/dot/gitleaks)
Your own site
<a href="https://agentmods.dev/skills/fmind/dot/gitleaks"><img src="https://agentmods.dev/badge/skills/fmind/dot/gitleaks.svg" alt="Measured on agentmods" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 783 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00041 $0.00783
Opus 5 $0.00020 $0.00392
Sonnet 5 $0.00008 $0.00157
Haiku 4.5 $0.00004 $0.00078

Measured today against content hash 5edd608da7a6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

gitleaks scanned grade A with 0 findings 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 today.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/gitleaks/SKILL.md · 63 lines

How it starts

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

Gitleaks

Find credentials before they reach a remote and the ones that already did; each scope answers a different question, and secure orders the pass.

Commands

gitleaks git --staged --verbose                        # pre-commit: the change about to be committed
gitleaks git --log-opts="--max-count=100" --verbose    # check:leaks: the recent commits (bounded, fast)
gitleaks git --verbose                                 # full history: the scheduled audit
gitleaks dir . --verbose                               # working tree, including untracked files
gitleaks git --redact=100 --report-format sarif --report-path gitleaks.sarif

Mise Task

Expose a scope-aware scan as check:leaks per mise: scan the working tree before the repository has a commit, retain the bounded history scan afterward, and forward --staged from the pre-commit hook in lefthook:

[tasks."check:leaks"]
description = "Audit staged changes, the working tree, or recent commits for leaked secrets (gitleaks)"
run = """
sh -c '
if [ "$#" -gt 0 ]; then
  gitleaks git --verbose "$@"
elif git rev-parse --verify HEAD >/dev/null 2>&1; then
  gitleaks git --log-opts="--max-count=100" --verbose
else
  gitleaks dir . --verbose
fi
' --
"""

When a Secret Is Found

  1. Rotate first: a secret in history is compromised even after the commit disappears.
  2. Remove it from the source: move the value to an environment variable or an encrypted file per sops-secrets.
  3. Rewrite history only when asked: rewrites affect every clone; confirm with the user before git filter-repo.
  4. Allowlist true false positives with an inline gitleaks:allow comment or a rule in .gitleaks.toml, each with a reason.

Gotchas

  • Shallow CI checkouts: fetch the depth the task scans (fetch-depth: 100) and keep the full-history audit in the scheduled security.yml job at fetch-depth: 0 per github-actions.
  • Fresh repository: the task uses gitleaks dir until HEAD exists, avoiding a misleading Git error while still scanning untracked files; --staged keeps pre-commit scoped to the index.
  • --redact in shared logs: never print a found secret in CI output or an uploaded report.

Read the full file on GitHub · 63 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. today Changed · +10 lines 5edd608da7a6
  2. yesterday First seen · 53 lines · 41 tokens per session scan A 3e8be6fcbe72

Subscribe to this mod's changes

gitleaks is a skill published in the GitHub repository fmind/dot (4 stars, last pushed yesterday), licensed MIT. It adds 41 tokens to every session and 783 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.