github-sensitive-data-cleanup
An agent skill by daymade, from daymade/claude-code-skills. Tags: audit, compliance, github, secrets, security.
What it does
Scan and remove sensitive data (secrets, API keys, private domains/IPs, PII) from GitHub repository history. Use this skill whenever the user says "scan sensitive data", "clean git history", "remove secrets from repo", "sanitize GitHub history", "清理敏感数据", "历史重写", "force push", "泄露", or needs to repair a public repo after accidental secret/private context leakage. Also use before any force push to a public repository to verify visibility, backup, and scan results.
Install
With the skills CLI, which installs into Claude Code, Codex, Cursor and other agents:
npx skills add daymade/claude-code-skills --skill github-sensitive-data-cleanup
Or copy the skill folder into Claude Code's skills directory by hand (~/.claude/skills for every project, or .claude/skills inside one):
git clone --depth 1 https://github.com/daymade/claude-code-skills
cp -r claude-code-skills/github-sensitive-data-cleanup ~/.claude/skills/github-sensitive-data-cleanup
Safety box score
Grade D, elevated risk: 47 of 100 risk points, rated 2026-10-20. The grade rates what the skill and its scripts can reach on the machine of whoever installs it, across eight categories from shell execution to secrets access. How the score works.
This skill performs a full Git history-cleanup workflow: scanning, rewriting commits/refs, creating a backup bundle, verifying, and pushing the rewritten branch back to GitHub. The main risks are destructive history replacement on the repo and a network push to a possibly public repository; it also preserves the old history in a backup bundle and can read optional user-home config files for extra scan context.
| Category | Level | Why |
|---|---|---|
| Code & shell execution | 2 (moderate) | The shipped Python scripts run real local commands via `subprocess.run` (`git`, `gitleaks`, `gh`, `ssh`, `git-filter-repo`), but they do not evaluate arbitrary code. |
| Network access | 2 (moderate) | `scripts/safe_push.py` talks to GitHub with `gh repo view`, `git ls-remote`, and `git push`, so the workflow sends repository data and rewritten refs over the network. |
| Filesystem reach | 2 (moderate) | The workflow writes a backup bundle and JSON reports and rewrites repository history in place, and it can read optional files under the user’s home directory such as `~/.config/github-sensitive-data-cleanup/identities.txt`. |
| Secrets & credentials | 2 (moderate) | The skill is explicitly for scanning and removing secrets, and `rewrite_history.py` preserves the entire pre-cleanup history in a `git bundle --all` backup that may still contain sensitive material. |
| Privilege & persistence | 1 (low) | It recommends installing `git-filter-repo`, `gitleaks`, and `gh` with `brew install ...`, but it does not require sudo, services, or global system changes. |
| Instruction hijack surface | 0 (none) | I did not find instructions to ignore the agent’s rules, hide actions, fetch and follow remote instructions, or bypass confirmations; the `--no-verify` text is a prohibition, not a bypass. |
| Irreversible actions | 3 (high) | The skill’s purpose is to rewrite Git history and then push it back to GitHub, including a forced update path (`--force-with-lease`), which can affect collaborators and public forks. |
| Transparency | 0 (none) | All shipped files are readable source text; there are no binaries, embedded blobs, or decoded-at-runtime payloads. |
Before installing
- Read `scripts/rewrite_history.py` first; it creates a backup bundle and rewrites refs in place.
- Read `scripts/safe_push.py` first; it contacts GitHub and performs a leased push.
- If you plan to use Layer 3, inspect whether you want to expose `~/scripts/git-pii-guard/gitleaks.toml` and `~/.config/github-sensitive-data-cleanup/identities.txt`.
Rated 2026-10-20 by an automated review of 9 files from the skill's repository.
Source
- Repository
- daymade/claude-code-skills (all skills from this repository)
- Path
- github-sensitive-data-cleanup/SKILL.md
- Branch
- main
- Updated
- 2026-09-20
Related skills
- creating-secrets-using-best-practices — Creates and manages secrets in AWS Secrets Manager following security best practices.
- hardware-compliance — Reference knowledge base on EU hardware/IoT cybersecurity law.
- setting-up-cloudtrail-multi-region — Enables a multi-region AWS CloudTrail trail with S3 log storage, CloudWatch Logs integration.
- aws-iam — Provides verified corrections for IAM behaviors that AI agents frequently get wrong — policy evaluation edge cases, trust policy gotchas, STS session limits.
- aws-secrets-manager — Secret safety for AWS Secrets Manager, secret management, credentials, API keys, tokens, and passwords.
- aws-security — Covers AWS security services and workflows — Security Hub V2 (OCSF) findings, connectors, aggregators, automation rules, and security posture summaries.