Secret guard
Skill logicleap-labs/claude-plugins/plugins/secret-guard/skills/secret-guard
Open Claude Code plugins for shipping AI output that's actually good. By Josh Matthews / LogicLeap Ltd.
npx -y skills add logicleap-labs/claude-plugins --skill secret-guardAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use whenever you are about to put a credential, API key, token, or password into code — or whenever a secret already appears in a file you're editing. Triggers on "add the API key", "paste the token", "hardcode the secret", "set the password", "AWS/Stripe/OpenAI/GitHub key", "connect to <service>", "use this credential", config/setup work that wires up a third-party service, and any moment a real secret value is in hand. The rule: secrets go in the environment, never in source.
SKILL.md
3.7 KB, as published. Nobody here has run it
Secret Guard
A secret in source is a secret that's already leaked. The moment a live key lands in a tracked file it gets committed, pushed, mirrored, cached, and shared — and you can't un-publish it. The only safe assumption for a hardcoded credential is that it's burned.
Secret Guard makes the safe path the default: a PreToolUse hook scans the new
content of every Edit/Write/MultiEdit and blocks the write when it
carries a real-looking credential into a non-env source file.
The rule
Secrets live in the environment, never in source. Read them at runtime; commit a placeholder, never the value.
The method
-
Never type the literal into code. Put the real value in a
.envfile (which is gitignored) or your secret manager:# .env (gitignored — the correct home for the real value) STRIPE_SECRET_KEY=sk_live_...realvalue... -
Read it at runtime instead of hardcoding it:
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);stripe.api_key = os.environ["STRIPE_SECRET_KEY"] -
Commit a placeholder, not the secret, so teammates know what's needed:
# .env.example (committed — safe, no real value) STRIPE_SECRET_KEY=sk_live_your_key_here -
If a real key ever touched a file or a commit, rotate it now. Don't
git rmand hope — assume it's compromised, revoke it, issue a new one, and move the new one into.env.
What this catches
The hook blocks a write when the added text contains a live-looking secret —
AWS access key ids (AKIA…), GitHub tokens (ghp_…), OpenAI/Anthropic keys
(sk-…, sk-ant-…), Stripe live keys (sk_live_…, pk_live_…), Google API
keys (AIza…), Slack tokens (xox…), -----BEGIN PRIVATE KEY----- blocks, and
a long high-entropy literal assigned to a secret-named variable
(apiKey = "…").
It deliberately does not block the safe patterns:
.env,.env.*,*.env, and*.example/*.sample/*.templatefiles — that's where secrets and their placeholders belong.process.env.X,os.environ["X"],getenv(...)— reading from the environment is the pattern we want.- Placeholders and examples —
your-key-here,<TOKEN>,${VAR},xxxxx,changeme,REDACTED,..., all-same-char values.
When the hook blocks you
It's telling you a real value is about to be committed. Don't reword it to slip
past — fix the design: move the value to .env, read it at runtime, leave a
placeholder in .env.example. If the value is a deliberately fake,
shaped-like-a-key test fixture (not a live credential), say so on its own line:
SECRET-GUARD: ALLOW — fake Stripe key, test fixture only
Kill switch
False positive, or a context where the gate doesn't apply:
touch .secret-guard-off in the project root (or
~/.claude/.secret-guard-off globally), or export SECRET_GUARD_GATE=off.
Fails open on any error — a broken guard never blocks your work.
Pairs with
scope-guard— scope says which files; secret-guard says what must never be in them.verify-before-done— once the key is in.envand read at runtime, prove the integration actually connects.