secret-handling

Prevents reading .env files and committing credentials to git-tracked team files.

Updated Jun 2, 2026
One-click install
npx skills add https://github.com/codebytes/btt --skill secret-handling-codebytes
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: secret-handling
Source: https://github.com/codebytes/btt/tree/main/.copilot/skills/secret-handling
Command: npx skills add https://github.com/codebytes/btt --skill secret-handling-codebytes

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? AI agents with repository access can read .env files containing live credentials and accidentally write those secrets into committed team files, leaking them into git history. This Skill codifies absolute prohibitions and safe alternatives to prevent credential exposure. ## Core Features & Use Cases - Prohibited File Rules: Blocks reading of .env, .env.local, .env.production, and other environment files while allowing safe templates like .env.example and .env.sample. - Secret Pattern Detection: Provides regex patterns for detecting API keys, passwords, connection strings, JWT tokens, private keys, AWS credentials, and email addresses in staged content. - Pre-Commit Validation: Defines a scanning workflow that blocks commits containing secrets, unstages offending files, and reports violations before any git commit proceeds. - Leak Remediation Protocol: Outlines steps for responding when a secret is found in git history, including credential revocation and history cleanup guidance. - Use Case: An agent needs database configuration details. Instead of reading .env and writing the live connection string into a decision log, it reads .env.example and documents only the schema with placeholder values. ## Quick Start Apply the secret-handling rules to ensure no .env files are read and no credentials are written to committed team files.

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?

Block agents from reading .env files and scan all staged content for secret patterns before committing. Use regex detection for API keys, passwords, connection strings, and JWT tokens, and stop the commit if any pattern matches.

What regex patterns detect secrets in code and config files?

Common patterns include [A-Z_]+(?:KEY|TOKEN|SECRET)= for API keys, eyJ... for JWT tokens, -----BEGIN PRIVATE KEY----- for private keys, and AKIA[0-9A-Z]{16} for AWS access keys. Connection strings match postgres://user:pass@host formats.

Can agents read .env.example instead of .env files?

Yes, .env.example, .env.sample, and .env.template are safe because they contain placeholder values without real credentials. Agents should use these to understand configuration schema or ask the user directly for config details.

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 cleaned history.

Why should secret scanning happen before commit instead of after?

Scanning after commit means the secret already exists in git history, requiring complex history rewriting and credential rotation. Pre-commit validation blocks the leak entirely, which is far cheaper than remediation.