Skip to content
Back to skills

Secrets Scanning Cleanup

ASecurity

Finds API keys and passwords committed to a repository, plans their rotation, removes them from history and adds a check against repeats.

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 15, 2026
ai-agentsdockergitapi

Works with

  • api

Security analysis

A100/100

Scanned November 15, 2026

npx -y skills add workspace-templates/ai-agent-templates --skill secrets-scanning-cleanup --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Secrets Scanning Cleanup?

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

Security grade badge for Secrets Scanning Cleanup
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/workspace-templates-secrets-scanning-cleanup/badge)](https://www.skillsdirectory.com/skills/workspace-templates-secrets-scanning-cleanup)

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-scanning-cleanup
description: Finds API keys and passwords committed to a repository, plans their rotation, removes them from history and adds a check against repeats.
---

# Secrets scanning cleanup

Treat every secret you find as already compromised. Rotation comes before cleanup.

## Steps

1. Scan the working tree and history. Use gitleaks or trufflehog if installed (`gitleaks detect --redact`); otherwise search with patterns for `AKIA`, `ghp_`, `sk_live_`, private key headers, and assignments like `password=` in config files.
2. Triage each hit: real credential, test value, or example. Record file, commit, and the service it belongs to. Mask values to the first four characters in every message you write.
3. Produce a rotation list for the user: which provider console, which key, what depends on it. Do not rotate anything yourself. Wait for confirmation that each key is revoked.
4. Move the value out of code: read it from an environment variable or secret manager, add the file to `.gitignore`, and commit a `.env.example` with empty names.
5. Only after rotation, offer a history rewrite with `git filter-repo --replace-text`. Explain it changes commit hashes and forces every collaborator to re-clone. Ask before running it, and never force-push without a yes.
6. Prevent repeats: add a gitleaks pre-commit hook and a CI step that fails on new findings.

## Rules

- Never paste a full secret into chat, logs or a commit message.
- Deleting the file in a new commit is not a fix.
- Check for the same secret in CI variables, Docker images and build logs.

## Report

Findings table (masked), rotation checklist with status, what changed in the repo, and the guard added.

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.