check-secrets

Detect committed secrets and sensitive files in git history and working tree.

1|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/mattbobambrose/mattbobambrose-claude-skills --skill check-secrets
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: check-secrets
Source: https://github.com/mattbobambrose/mattbobambrose-claude-skills/tree/main/plugins/code-quality/skills/check-secrets
Command: npx skills add https://github.com/mattbobambrose/mattbobambrose-claude-skills --skill check-secrets

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents accidental exposure of secrets by discovering sensitive files in the working tree and in git history, identifying tracked secrets that require removal, and ensuring sensitive file patterns are excluded via .gitignore so secrets are not committed in the future.

Core Features & Use Cases

  • Repository-wide secret discovery: Glob-based scans for .env files, key files, credentials, and other common secret patterns across the working tree.
  • Tracking and history analysis: Uses git ls-files to detect currently tracked secrets and git log searches to find historical exposures.
  • Remediation and prevention: Updates root .gitignore safely for uncovered patterns and optionally installs a POSIX pre-commit hook to block future secret commits.
  • Use Case: Run before open-sourcing a project or releasing to ensure no secrets are tracked or historically exposed and to add automated checks for future commits.

Quick Start

Run the check-secrets skill to scan the repository for tracked or historical secrets, append missing patterns to .gitignore, and optionally install a POSIX pre-commit hook to block future secret commits.

Frequently Asked Questions about check-secrets

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I scan git history for committed secrets and credentials?

Scanning git history for committed secrets involves using git ls-files to find currently tracked sensitive files and git log searches to uncover historical exposures, all without printing the actual secret contents.

What's the best way to prevent accidentally committing .env files and private keys?

Preventing accidental commits of .env files and private keys is best handled by updating .gitignore patterns and installing a POSIX pre-commit hook to block future secret commits automatically.

Can I audit a repository for sensitive files before open-sourcing it?

You can audit a repository before open-sourcing by running repository-wide glob-based scans for .env files, key files, and credentials across the working tree and git history.

Does a pre-commit hook work to block secrets from being committed?

A POSIX pre-commit hook works to block future secret commits by scanning the working tree against sensitive file patterns before allowing the commit to complete.

How do I remove tracked secrets from my git repository?

Removing tracked secrets requires identifying them using git ls-files and glob scans, then safely updating root .gitignore to exclude the sensitive patterns and prevent future tracking.