Secret Guard: Catch Leaked Keys Before You Commit
Audit staged git changes for API keys and credentials with masked previews and remediation steps.
Free
Works with the AI Agents you already use
Secret Guard: Catch Leaked Keys Before You Commit
Example session with this skill installed
I just staged some changes for the new auth module. Can you check if I accidentally included any API keys or tokens before I commit?
- Read your context and instructions
- Compiled the secret guard
I have scanned your staged changes using git diff --cached. I found one sensitive item that needs to be addressed before you proceed with the commit.
Secrets Audit Results
| File | Line | Type | Masked Preview | Action Required |
|---|---|---|---|---|
src/config/auth.ts | 12 | AWS Access Key | AKIA**************** | Unstage and move to .env |
The scan also checked package.json and src/index.ts, which are clean.
Next steps
- Unstage the file: Run
git restore --staged src/config/auth.ts. - Secure the key: Move the value to your local
.envfile and ensure.envis listed in your.gitignore.
Rotate if necessary: If this key was ever pushed to a remote branch in a previous commit, it is compromised and must be rotated in the AWS console.
Connects securely to your tools. The creator never sees your data.
About this skill
Staging credentials in git by mistake leads to compromised infrastructure and hours of rotation work. This skill acts as a pre-commit audit tool to identify sensitive strings before they hit your history.
What it does
- Staged scanning identifies API keys, tokens, and private keys in your current
git diff --cached. - Secret masking displays identified leaks with only the first four characters visible to prevent further exposure.
- Context filtering ignores common placeholders, documentation examples, and test fixtures.
- Remediation guidance provides exact commands to unstage files and move secrets to environment variables.
- Exposure alerts warns users to rotate credentials if they have been previously committed or pushed.
How it works
- Use the
guardcommand to trigger thescripts/guard.pyscan on staged files. - Review the list of hits which includes the file name, line number, and secret type.
- Follow the generated instructions to unstage the sensitive files.
- Update your
.gitignoreor move values to a secrets manager as directed.
Frameworks & tools
This skill utilizes Git for diff analysis and Python for the scanning logic. It is designed to work with standard .env files, cloud provider credentials, and common API token formats.
Why this beats prompting it yourself
Generic prompts often fail to distinguish between a real secret and a documentation placeholder, leading to false positives. This skill follows a strict verification logic and ensures that the agent never inadvertently displays the full secret in the chat logs.
Use cases
- Auditing a PR before pushing to a public repository.
- Cleaning up accidentally staged
.envfiles. - Verifying that local configuration changes haven't leaked cloud provider keys.
- Teaching junior developers proper secrets hygiene during the commit process.
Known limitations
This only checks staged changes, not the entire repository history or unstaged files. It relies on git diff --cached and requires the repository to be initialized with git.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Security.
Only scans staged changes, not full git history or unstaged files. Requires git to be initialized in the workspace.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed today
- Free with an Agensi account
- Software
Git