Skip to content
Back to skills

Secret Detection

ASecurity

Detect likely secrets (API keys, cloud credentials, tokens, private keys, high-entropy strings) in code and diffs, triage findings by confidence, and guide safe remediation. Use when scanning a diff for credentials or reviewing a secret-scan result.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 1, 2026
ai-agentsawsgitapi

Works with

  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned October 1, 2026

npx -y skills add matthews-wong/claude-code-plugins --skill secret-detection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Secret Detection?

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

Security grade badge for Secret Detection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/matthews-wong-secret-detection/badge)](https://www.skillsdirectory.com/skills/matthews-wong-secret-detection)

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: secret-detection
description: Detect likely secrets (API keys, cloud credentials, tokens, private keys, high-entropy strings) in code and diffs, triage findings by confidence, and guide safe remediation. Use when scanning a diff for credentials or reviewing a secret-scan result.
---

# Secret detection

A heuristic safety net for catching credentials before they are committed or shared. This is defense-in-depth, not a guarantee. Always pair it with a dedicated scanner (gitleaks, trufflehog, GitHub/GitLab secret scanning) in CI.

## Core method

1. Scope to the diff first. Newly added lines (`+` in `git diff`) are where fresh secrets appear.
2. Match against known credential shapes (see `reference/patterns.md`).
3. For strings without a known prefix, fall back to entropy and context reasoning (see `reference/entropy.md`).
4. Triage each hit: real secret, placeholder/example, or false positive.
5. Recommend remediation — and for anything already pushed, rotation is mandatory.

## Triage confidence

- **High**: recognizable provider prefix + correct length/charset (e.g. `AKIA…`, `ghp_…`, `sk-…`, `-----BEGIN … PRIVATE KEY-----`).
- **Medium**: assignment to a secret-named variable (`password`, `secret`, `token`, `api_key`) with a non-trivial literal value.
- **Low**: high-entropy string with no context; often a hash, UUID, or lockfile digest — verify before alarming.

## Known false positives

Commit SHAs, lockfile integrity hashes (`sha512-…`), UUIDs, base64 test fixtures, and documented example keys (AWS `EXAMPLE` keys, Stripe test keys `sk_test_…`). Do not treat these as live secrets, but do note test-mode keys.

## Remediation (state plainly)

- Remove the secret from the working tree and replace with an env var or secret manager reference.
- If it was ever committed or pushed: **rotate/revoke the credential** — deletion does not undo exposure.
- History rewriting (`git filter-repo`, BFG) may be needed for already-committed secrets, coordinated with the team.

## References (load on demand)

- `reference/patterns.md` — provider-specific regex patterns and prefixes.
- `reference/entropy.md` — entropy heuristics and thresholds for unknown strings.

Files in this skill

  • SKILL.md2.2 KB
  • reference/entropy.md1.5 KB
  • reference/patterns.md2 KB

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.

Comments

Loading comments…