secrets-guard

Blocks shell commands that could expose credentials, tokens, or environment secrets.

1|Updated Jun 2, 2026
One-click install
npx skills add https://github.com/psiagoleal/ai-coding-agent-profiles --skill secrets-guard-psiagoleal
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: secrets-guard
Source: https://github.com/psiagoleal/ai-coding-agent-profiles/tree/main/skills/secrets-guard
Command: npx skills add https://github.com/psiagoleal/ai-coding-agent-profiles --skill secrets-guard-psiagoleal

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? AI coding agents can accidentally print secrets into the conversation history when running shell commands like cat .env or kubectl get secret -o yaml, and once exposed, a credential persists in model context, caches, and logs, forcing costly rotation. This Skill enforces an absolute rule that secrets never pass through the agent window. ## Core Features & Use Cases - Prohibited command list: Blocks direct or indirect display of .env files, environment variables, keyrings, JWT tokens, cloud CLI credential output (aws/gcloud/az), and Kubernetes secrets. - Indirect verification patterns: Provides safe alternatives such as test -n presence checks, truncated SHA-256 digests, masked last-four-character display, and end-call health checks that report only success or failure. - Rationalization defense: Lists the common justifications agents use to bypass the rule ("it's just dev", "the user asked") and instructs the agent to stop when it catches itself reasoning this way. - Use Case: While debugging a failing deployment, the agent needs to confirm an API key is set; instead of running printenv, it runs test -n "${API_KEY:-}" and reports only that the key is present with its character count. ## Quick Start Ask the agent to verify that the API_KEY environment variable is configured without printing its value.

Frequently Asked Questions about secrets-guard

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

FAQPage Schema
How do I check if an environment variable is set without printing it?

Use a presence check like `test -n "${API_KEY:-}"` combined with printing only the variable's length via `${#API_KEY}`. This confirms the credential exists and its size without ever exposing the value in the command output.

How can an AI agent validate an API key without exposing it?

Validate the credential through its end call, such as sending an authenticated request to a /healthz endpoint and reporting only the HTTP status code. Alternatively, compare a truncated SHA-256 digest of the key rather than the key itself.

Which shell commands leak secrets into AI agent context?

Commands like `cat .env`, `printenv`, `env | grep`, `git config --list`, `kubectl get secret -o yaml`, `gcloud auth print-access-token`, and `docker compose config` can all print credentials. The rule targets any command whose output might contain sensitive material, not just a fixed list.

What should an agent do when the user explicitly asks to see a secret?

The agent should refuse the exposure and deliver the underlying result instead, since the user wants the outcome, not the raw credential. If direct inspection is truly unavoidable, the human runs it locally outside the agent window and returns only sanitized results.

How do I make secret protection structural instead of relying on agent behavior?

Add pre-commit scanning with tools like gitleaks, trufflehog, or detect-secrets, and configure a PreToolUse hook that blocks prohibited command patterns before they execute. This makes the protection deterministic rather than dependent on the agent remembering the rule.