gesmith0606/claude-config-public/secrets-handling
Claude Code and agent skill by gesmith0606/claude-config-public
- community
Checking that the SKILL.md file is still in the repository.
Write-time secret hygiene: keep credentials out of code as it's written. Use when adding a DB connection, API client, auth token, cloud SDK call, or .env — or when asked where a credential should live. Covers runtime resolution (env / AWS / Azure / GCP / Vault), password-free connection strings, log redaction, and rotation.
Install
npx vskill@latest install gesmith0606/claude-config-public/secrets-handlingSKILL.md
The same SKILL.md was published earlier as gesmith0606/claude-config-public/secrets-handling.
Secrets Handling (write-time)
Keep credentials out of source as you write it. The rule: code carries the *name* of a secret, never its *value*. Resolve the value at runtime.
This is the prevention counterpart to insecure-defaults (which detects hardcoded secrets and fail-open fallbacks after the fact). For credential APIs that are easy to misuse see sharp-edges; for failures during resolution see error-handling.
The one rule, four tiers
Pick the lowest tier that fits the deployment:
- Local dev —
.envfile (git-ignored) loaded viadotenv. Commit a
.env.example with keys and placeholder values only.
- CI / runtime — process environment variables injected by the platform
(GitHub Actions secrets, container env, systemd EnvironmentFile).
- Servers / cloud — a secret manager: AWS Secrets Manager, Azure Key Vault,
GCP Secret Manager, or HashiCorp Vault. Fetch at startup, cache in memory.
- Workload identity — no stored secret at all; assume an IAM role / managed
identity and let the SDK sign requests. Prefer this when available.
Resolve at runtime, fail-secure
Invoke Python as python3 (on Windows the MS-Store python may be a stub; use py -3 if python3 is unavailable).
Local secrets: password-manager backends
This config resolves credentials at runtime through ~/.claude/scripts/resolve-secret.js: env var → OS keychain → op (1Password) → bw (Bitwarden). Pin one in machine.json (secrets.backend; default auto). Store secret names in config files, never values — "webhookSecret": "DISCORD_WEBHOOK_CLAUDE" — and health-check fails the run if a raw token appears in machine.json.
For operating the Bitwarden CLI itself — unlocking, adding secrets, diagnosing "not found" — use the `bitwarden` skill.
Connection strings without embedded passwords
Never bake the password into a literal URL. Build it from resolved parts, or hand credentials to the driver separately so they never live in one string.
- For workload identity, omit the password entirely and use IAM auth tokens
(RDS IAM, Cloud SQL connector, Azure AD) generated per-connection.
.envexample:DATABASE_URL=postgresql+psycopg://app@localhost/app— note
the password is absent; the driver prompts/resolves it.
Redact in logs and tracebacks
Secrets leak through print, log lines, exception messages, and repr of config objects. Defend at the boundary:
- Never log a connection URL, header dict, or full config object verbatim.
- Wrap secrets in a type whose
__repr__/__str__returns"***"(e.g.
Pydantic SecretStr), so accidental interpolation can't expose them.
- Scrub known keys (
password,token,api_key,authorization) in a
logging filter before records are emitted.
- On exceptions, log the secret's name/source, not its value — see
error-handling for the message-shaping pattern.
Rotation
Assume every secret will be rotated. Resolve at startup (and on a refresh interval or on auth-failure retry) rather than caching for the process lifetime, so a rotated value is picked up without a redeploy. Prefer managers that version secrets so rollback is a pointer change.
Never
- Inline a literal key/password/token in source, even "temporarily."
- Commit a real
.env, keyfile, or*.pem— git-ignore them; commit only
.env.example.
- Print secrets in notebooks (outputs are saved to disk and pushed) or echo
them in CI logs (use the platform's masked-secret mechanism).
- Pass secrets as command-line args (visible in
ps/ shell history) — use env
or stdin.
- Embed credentials in container images, IaC literals, or front-end bundles.
Before finishing any change that touches credentials, run insecure-defaults over the diff to confirm nothing hardcoded slipped in.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/secrets-handling/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/gesmith0606/claude-config-public/secrets-handling)