Skip to content
Back to skills

Secrets Scan

ASecurity

Scan for secrets (API keys, tokens, private keys, credentials, real .env files) before committing or pushing — enforces "never commit secrets". Prefers gitleaks if installed; otherwise uses high-signal patterns. Reports findings by file:line with the value redacted. Use before any commit/push, when adding config or fixtures, or whenever asked to check for leaked secrets. Read-only.

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added October 16, 2026
ai-agentsgobashgitapi

Works with

  • api

Security analysis

A100/100

Scanned November 23, 2026

npx -y skills add chipi/agentic-ai-homelab --skill secrets-scan --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Secrets Scan?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Secrets Scan
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/chipi-secrets-scan/badge)](https://www.skillsdirectory.com/skills/chipi-secrets-scan)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: secrets-scan
description: Scan for secrets (API keys, tokens, private keys, credentials, real .env files) before committing or pushing — enforces "never commit secrets". Prefers gitleaks if installed; otherwise uses high-signal patterns. Reports findings by file:line with the value redacted. Use before any commit/push, when adding config or fixtures, or whenever asked to check for leaked secrets. Read-only.
---

# secrets-scan

Catch secrets before they land in git. Enforces the non-negotiable: `.env`,
credentials, tokens, API keys — never in git, never in fixtures, never in a
commit message. **Read-only** — it never writes; it blocks by reporting.

## Run

```bash
~/.claude/skills/secrets-scan/scripts/scan.sh            # staged changes (what `git commit` would add)
~/.claude/skills/secrets-scan/scripts/scan.sh --push     # commits not yet on the upstream (what `git push` sends)
~/.claude/skills/secrets-scan/scripts/scan.sh --range origin/main..HEAD
~/.claude/skills/secrets-scan/scripts/scan.sh --tree [PATH]   # the working tree, no history
```

Run it from inside the repo.
- **With gitleaks:** gitleaks is used when installed, with ~200 provider rules. Findings are
  listed `file:line — rule (commit …)`, with values redacted.
- **Without it:** the script falls back to the same high-signal regexes as the hook below, and
  says so.
- **`.env`:** a real `.env` (not `.env.example`) in the change is a finding by itself.

It ends with `SECRETS SCAN: PASS/FAIL`, exit 1 on FAIL.

**The automatic net:** the `secrets-guard.sh` PreToolUse hook (`workstation/claude/hooks/`,
wired in `~/.claude/settings.json` since 2026-07-30) blocks a `git commit`/`git push` from
Claude whose change matches. Since 2026-10-17 it also runs gitleaks when installed. This script is
the on-demand report with file:line; `ship` runs it as its secrets gate.


## Report

- End with `SECRETS SCAN: PASS` or `SECRETS SCAN: FAIL`.
- On FAIL, list each hit as `file:line — <rule>` with the value **redacted**
  (never echo the secret). Tell the operator to remove it AND rotate — a secret
  committed to git is compromised even if later deleted.
- Don't cry wolf on obvious placeholders: `buddy-is-the-king`, `hf_xxx…`,
  `<your-…>`, `${VAR}`, `changeme`, `example`, empty values. Note them as skipped.

## Conventions this enforces

- **Never commit secrets** (rule #29). If one ever lands, treat it as compromised
  and rotate immediately.
- `.env` stays gitignored; only `.env.example` with placeholders is tracked.
- Install gitleaks for real coverage; the pattern fallback catches the common
  shapes but is not exhaustive — say so when you use it.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.