secrets-manager
Skill12 starsChanged 5 months agoMITView on GitHub
Detects, prevents, and remediates leaked credentials and teaches safe secret handling using environment variables, vaults (HashiCorp Vault, AWS/GCP/Azure secret stores), KMS envelope encryption, and rotation. Use this skill when a user mentions hardcoded API keys, passwords, tokens, or .env files in code; asks how to store, inject, or rotate secrets; wants to set up a vault or KMS; needs to scrub a leaked credential from git history; or asks to add pre-commit secret scanning.
- Reads credentials
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
Scan before you advise: Run scripts/scan_secrets.py over the repo (or recommend gitleaks/trufflehog for git history).
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Secrets Manager
Overview
This skill governs the full lifecycle of secrets: keeping them out of source code, storing them in the right backend, injecting them at runtime, rotating them on schedule, and remediating leaks fast and completely. A leaked credential is an active incident — assume it is compromised the moment it touches a public surface.
Keywords: secret, credential, API key, token, password, .env, environment variable, vault, HashiCorp Vault, KMS, envelope encryption, AWS Secrets Manager, GCP Secret Manager, Azure Key Vault, SOPS, sealed-secrets, rotation, key rotation, git-secrets, gitleaks, trufflehog, pre-commit hook, scrub, BFG, git filter-repo, hardcoded credentials, dotenv, OIDC, workload identity, leaked key.
Workflow
- Classify the request into one of four modes (see Decision Framework):
- PREVENT — keep new secrets out of code.
- STORE/INJECT — choose a backend and runtime delivery.
- ROTATE — establish rotation cadence and automation.
- REMEDIATE — a secret has already leaked.
- If a secret may already be exposed, treat it as REMEDIATE first. Rotation/revocation precedes cleanup. Removing the secret from git does NOT un-leak it. Follow
references/leak-remediation.mdstep by step. - Scan before you advise. Run
scripts/scan_secrets.pyover the repo (or recommendgitleaks/trufflehogfor git history). Never assume the codebase is clean. Report findings with file, line, and a redacted match — never echo full secret values into logs, chat, or commits. - Pick a storage backend using the matrix in
references/storage-backends.md. Match to the runtime (local dev, CI, Kubernetes, serverless, VM) and the org's existing cloud. Prefer short-lived, dynamically-issued credentials and OIDC/workload identity over long-lived static keys wherever possible. - Define injection. Secrets reach the process via environment variables, mounted files (tmpfs), or a fetch-at-startup SDK call — never baked into images, never committed. Use
templates/dotenv-template.mdfor local dev and document.envin.gitignore. - Establish rotation. Set a cadence per secret class (see
references/rotation-runbook.md), automate it where the backend supports it (Vault dynamic secrets, AWS Secrets Manager rotation Lambdas), and verify zero-downtime cutover with overlapping validity windows. - Add guardrails. Install a pre-commit hook (
scripts/install_precommit.sh) and CI scanning so the next secret never lands. Verify.gitignorecovers.env,*.pem,*.key, credential files. - Verify and document. Confirm no secret remains in working tree or history, rotation is scheduled, and access is least-privilege. Produce a short summary of what changed and what the human must still do (e.g., update the secret in the vault console).
Decision Framework
| Signal in the request | Mode | First action |
| "I have this key in my config / source" already pushed | REMEDIATE | Revoke + rotate immediately, then scrub history |
| "Where should I keep my secrets?" / new app | STORE/INJECT | Backend matrix in references/storage-backends.md |
| "How often / how do I rotate?" | ROTATE | references/rotation-runbook.md |
| "Stop me committing secrets" | PREVENT | scripts/install_precommit.sh + CI scan |
| Unsure / mixed | Scan first | scripts/scan_secrets.py, then classify |
Backend selection quick guide
- Local dev:
.envfile (gitignored) loaded by dotenv, OR a developer vault likedirenv+ 1Password CLI /vaultagent. Never commit.env. - CI/CD: native masked secrets (GitHub Actions secrets/OIDC, GitLab CI variables) — prefer OIDC federation to a cloud role over storing static cloud keys.
- Cloud runtime (AWS/GCP/Azure): the cloud-native secret store + IAM/workload identity. Fetch at startup; cache in memory only.
- Kubernetes: External Secrets Operator or sealed-secrets/SOPS — avoid plain
Secretobjects checked into git (they are only base64, not encrypted). - High-compliance / multi-cloud: HashiCorp Vault with dynamic secrets and short TTLs.
Worked Examples
See examples/remediate-leaked-aws-key.md for an end-to-end leak response: detection, revocation, history rewrite, and prevention.
Inline example — converting a hardcoded secret:
# BEFORE — hardcoded, will be flagged
STRIPE_KEY = "sk_live_PLACEHOLDER_EXAMPLE_KEY"
# AFTER — read from environment, fail loudly if absent
import os
STRIPE_KEY = os.environ["STRIPE_KEY"] # set via vault/CI, never committedBest Practices
- Treat any exposed secret as compromised. Rotate first; clean up second. Attackers scrape public repos within seconds.
- Prefer short-lived dynamic credentials (Vault dynamic secrets, STS, OIDC tokens) over long-lived static keys.
- Least privilege per secret. Scope tokens to the minimum API, resource, and TTL. One secret per service per environment.
- Never log or print secret values. Redact in logs, error messages, and tracebacks. The scanner output shows partial matches only.
- Encrypt at rest with KMS envelope encryption — the data key encrypts the secret, the KMS master key encrypts the data key; rotate the master key independently.
- Keep
.env,*.pem,*.key,*.p12,credentials*out of git via.gitignoreand enforce with a pre-commit hook. - Automate rotation and alert on rotation failures; manual rotation drifts and gets skipped.
- Audit access. Enable access logging on the vault/KMS and review who/what read each secret.
Common Pitfalls
- Deleting the file but not rewriting history. The secret still lives in every prior commit and every clone/fork. Use
git filter-repoor BFG, then force-push, then have collaborators re-clone. - Rotating without revoking the old value. The leaked key keeps working until you revoke it at the provider.
- Committing Kubernetes
Secretmanifests. Base64 is encoding, not encryption — anyone can decode it. Use sealed-secrets/SOPS/External Secrets. - Storing secrets in CI environment variable definitions in code (e.g., plaintext in a YAML pipeline). Use the platform's masked secret store.
- Baking secrets into Docker image layers via
ENVorCOPY .env. They persist in the image history. Inject at runtime instead. - Using one shared key everywhere. A single leak then forces a fleet-wide rotation. Scope per service/environment.
- Trusting
.gitignorealone. It does not untrack already-committed files and does not stop agit add -f. Pair it with scanning. - Echoing the secret into chat or a summary while "helping." Redact always.
Other versions4 projects use a version of this.
Word for word · 2
- jaskirat1616/grok-skills★ 22100% same
- JayRHa/AgentSkills★ 12100% same
Edited · 0
None found.
Wrote their own version · 2
- itsmostafa/aws-agent-skills★ 1.2ksame name
- pbc-os/smb-starter-kit★ 10same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository75 other files it gives its agents.
- 0-templateSkill
- ab-test-analyzerSkill
- adr-authorSkill
- api-designerSkill
- api-docs-writerSkill
- aws-cost-optimizerSkill
- bash-script-hardeningSkill
- blog-post-writerSkill
- book-summarizerSkill
- changelog-keeperSkill
- chart-chooserSkill
- code-reviewerSkill
- competitive-analysisSkill
- concept-explainerSkill
- cover-letter-writerSkill
- cron-schedulerSkill
- data-pipeline-architectSkill
- debug-detectiveSkill
- decision-matrixSkill
- dependency-upgraderSkill
- dockerfile-proSkill
- email-composerSkill
- error-handling-patternsSkill
- event-plannerSkill
- flashcard-generatorSkill
- gdpr-data-mapperSkill
- gift-advisorSkill
- github-actions-builderSkill
- git-workflowSkill
- habit-builderSkill
- incident-postmortemSkill
- interview-prepSkill
- job-description-writerSkill
- json-schema-authorSkill
- kubernetes-manifest-authorSkill
- language-tutorSkill
- meal-plan-builderSkill
- meeting-summarizerSkill
- mermaid-diagram-builderSkill
- nginx-config-proSkill
- observability-setupSkill
- okr-writerSkill
- pandas-data-cleaningSkill
- people-dataSkill
- performance-profilerSkill
- personal-budget-plannerSkill
- presentation-builderSkill
- project-plannerSkill
- prompt-engineerSkill
- proofreaderSkill
- public-speaking-coachSkill
- rag-pipeline-designerSkill
- readme-generatorSkill
- refactoring-guideSkill
- regex-architectSkill
- release-notes-writerSkill
- resume-writerSkill
- salary-negotiatorSkill
- secure-code-reviewSkill
- secure-password-policySkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

