# Secret Leak Guard: Keep Your API Keys Out of Claude's Chat

> A PreToolUse hook that refuses, before it runs, any command that would print a secret into the transcript (shell tracing, env dumps, reading .env files, docker inspect, echoing key variables), while the safe patterns still pass. 94-case selftest; 6 of 7,454 real commands refused.

Secret Leak Guard: Keep Your API Keys Out of Claude's Chat is a paid AI agent skill on Agensi by Marius Andronie, in Security. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $5 (one-time purchase)
- Creator: [Marius Andronie](https://www.agensi.io/creators/marius-andronie)
- Category: [Security](https://www.agensi.io/skills/security)
- Version: 1.0
- Last updated: 2026-11-24
- Security: scan passed (2026-11-08); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/secret-leak-guard-keep-your-api-keys-out-of-claude-s-chat
- Tags: claude-code, hooks, security, secrets, devops

## About this skill

A secret does not leak because an agent is careless. It leaks because the agent is doing its job: debugging. It runs `bash -x deploy.sh` to see where the script fails, the script sources `.env`, and the trace prints every assignment. Four live keys in one command, now sitting in a transcript that is stored, synced and sometimes shared.

A rule in CLAUDE.md saying "never trace scripts that load secrets" does not stop this. The agent is not reading the rule at the moment it decides to trace. A rule that lives in front of the tool cannot be skipped.

This skill installs that rule as a Claude Code PreToolUse hook.

An agent was asked why a scheduled job failed silently. It ran the job with `bash -x`. The job sourced an env file holding a payment provider's live secret key, a telephony auth token, an email API key and a chat bot token. All four were printed into the session in plain text, and all four had to be rotated the same day. The note warning against exactly this already existed. After the hook went in, the same mistake was refused before it ran, with a reason the agent could act on.

## Requires

- Python 3 (standard library only)
- Claude Code (PreToolUse hook)
- Git

## Known limitations

A pattern guard, not a sandbox: a determined process can still read a file. It stops the common honest accident, an agent printing a secret while debugging. It cannot undo a leak that already happened (rotate the key). On real work it refused 6 of 7,454 safe commands (0.08%); each refusal names the safe alternative.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Secret Leak Guard: Keep Your API Keys Out of Claude's Chat skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What does Secret Leak Guard: Keep Your API Keys Out of Claude's Chat do?

A PreToolUse hook that refuses, before it runs, any command that would print a secret into the transcript (shell tracing, env dumps, reading .env files, docker inspect, echoing key variables), while the safe patterns still pass. 94-case selftest; 6 of 7,454 real commands refused.

### Which AI agents support Secret Leak Guard: Keep Your API Keys Out of Claude's Chat?

This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

### How do I use Secret Leak Guard: Keep Your API Keys Out of Claude's Chat?

Connect your AI agent to Agensi through MCP, then ask it to use Secret Leak Guard: Keep Your API Keys Out of Claude's Chat on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
