secret-handling

Block unsafe .env reads and scan staged git changes for secrets.

209|27|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/dotnet/maui-labs --skill secret-handling-dotnet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: secret-handling
Source: https://github.com/dotnet/maui-labs/tree/main/src/Comet/.copilot/skills/secret-handling
Command: npx skills add https://github.com/dotnet/maui-labs --skill secret-handling-dotnet

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents AI-assisted workflows from leaking live credentials by reading prohibited .env files and committing sensitive information into .squad/ history.

Core Features & Use Cases

  • Prohibits live secret access: never read .env and any .env.* variants that could contain real credentials, while allowing only safe templates like .env.example/.env.sample/.env.template.
  • Blocks secret exfiltration into team history: never write detected API keys, passwords, connection strings, JWTs, private keys, cloud credentials, or email addresses into .squad/ files.
  • Enforces pre-commit safeguards: requires staged-file scanning for secret patterns and fails loud (stops commit) with remediation instructions if anything is detected.

Quick Start

Ask the agent for the required environment variable schema, then ensure it reads .env.example and never commits .env or any detected credentials to .squad/.

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 environment variables into git history?

Prevent environment variable leaks by blocking unsafe reads of live .env files and enforcing fail-loud pre-commit secret scanning. The system scans staged changes for credential patterns and aborts the commit if matches are found.

How does pre-commit secret scanning work for .squad/ tracked artifacts?

Pre-commit secret scanning works by requiring staged-file scanning for defined secret regex patterns and filenames. It fails loud with explicit remediation instructions if detected credentials are bound for .squad/ files.

Can I use .env.example templates without triggering commit blocks?

Yes, you can use .env.example, .env.sample, and .env.template files safely. The system prohibits live .env and .env.* variants that contain real credentials while allowing safe templates.

What types of credentials does git pre-commit secret scanning detect?

Git pre-commit secret scanning detects API keys, passwords, connection strings, JWTs, private keys, cloud credentials, and email addresses. It aborts the commit with explicit user reporting when matches are found.

Why does my git commit fail when an AI workflow writes to .squad/ files?

Your git commit fails because the pre-commit safeguard detected secret patterns in staged changes written by spawned agent processes. It aborts the commit loudly to prevent credential exposure in .squad/ history.

What is the best way to secure agent workflows that spawn processes accessing repository contents?

The best way to secure agent workflows is to prohibit .env file access, scan staged git changes for secret regex patterns, and abort commits with explicit reporting when matches are detected.