secret-handling

Prevents agents from reading .env files and committing credentials to git history.

2|Updated Jul 24, 2026
Ready to run
npx skills add https://github.com/elbruno/ElBruno.MagenticUI --skill secret-handling-elbruno
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: secret-handling
Source: https://github.com/elbruno/ElBruno.MagenticUI/tree/main/.squad/templates/skills/secret-handling
Command: npx skills add https://github.com/elbruno/ElBruno.MagenticUI --skill secret-handling-elbruno

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Agents with repository access can read .env files containing live credentials and write them into committed files, leaking secrets into git history. This Skill codifies absolute prohibitions, safe alternatives, and pre-commit validation to stop credential leaks before they happen. ## Core Features & Use Cases - Prohibited File Rules: Blocks reads of .env, .env.local, .env.production, and other .env.* variants while allowing safe templates like .env.example and .env.sample. - Secret Pattern Detection: Provides regex patterns for API keys, passwords, connection strings, JWT tokens, private keys, AWS credentials, and email addresses to scan staged content. - Pre-Commit Validation: Defines a Scribe workflow that scans staged .squad/ files, blocks commits containing secrets, and reports violations with clear remediation steps. - Use Case: An agent needs database configuration details. Instead of reading .env and writing a live connection string into a committed decision log, it reads .env.example and documents only the schema with placeholder references. ## Quick Start Instruct the agent to follow the secret-handling rules so it never reads .env files and scans all staged .squad files for credential patterns before committing.

Frequently Asked Questions about secret-handling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent AI agents from leaking secrets into git commits?▼

Define explicit prohibitions on reading .env files, provide regex patterns for detecting API keys, passwords, and tokens, and require a pre-commit scan of all staged files. Block the commit and report the violation if any secret pattern is detected.

What files should agents never read for configuration info?▼

Agents must never read .env, .env.local, .env.production, .env.development, .env.staging, or .env.test files. Safe alternatives are .env.example, .env.sample, and .env.template, which show structure without real credentials.

How do I scan staged git files for secrets before committing?▼

Use git diff --cached to get staged content, then match it against regex patterns for API keys, passwords, connection strings, JWTs, private keys, and AWS credentials. If a match is found, unstage the files with git reset HEAD and abort the commit.

What should I do if a secret was already committed to git history?▼

Stop all work immediately and alert the user with the commit hash, file, and leaked pattern. The credential must be revoked and rotated, then removed from history using git filter-repo or BFG, followed by a force-push of the cleaned history.

Can agents read .env files just to understand the config schema?▼

No, reading .env for schema understanding is explicitly prohibited. Agents should read .env.example for structure, check documentation, or ask the user directly for the configuration details they need.