subinium/vibesubin/manage-secrets-env

Claude Code and agent skill by subinium/vibesubin

Trust tier 3
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

Opinionated defaults and full lifecycle playbook for secrets and environment variables. Decides where a secret or env-specific value lives (constant, .env, CI secret, env var), scaffolds .env.example and .gitignore, and manages the lifecycle end to end — add, update, rotate, remove, migrate between buckets, audit cross-environment drift, provision new environments. High-stakes companion to project-conventions. Language-agnostic.

Install

npx vskill@latest install subinium/vibesubin/manage-secrets-env

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as subinium/vibesubin/manage-secrets-env.

manage-secrets-env

Every project has two kinds of structural decisions. Some are low-stakes — which branch naming, which directory layout — and a mistake costs a little friction. Some are high-stakes — where a database password lives, whether .env is tracked, whether a production token is in a build-time variable — and a mistake costs an incident.

This skill owns the high-stakes slice: secrets, environment variables, and the gitignore that protects them. The low-stakes conventions (branches, directories, dep pinning, path portability) live in project-conventions. Splitting them this way means the operator can trigger the right depth of care for the right question.

The principle: the safest default is the one the operator doesn't have to invent. When they ask "where does my DB password go?", answer immediately, explain in one sentence, and offer to scaffold.

State assumptions — before acting

Before starting the procedure, write an explicit Assumptions block. Don't pick silently between interpretations; surface the choice. If any assumption is wrong or ambiguous, pause and ask — do not proceed on a guess.

Required block:

Assumptions:
- Environment tier: <dev | staging | prod — affects which bucket rules apply>
- .env.example: <present | missing (drift check cannot run yet, operator must scaffold first)>
- Tracked secrets: <none detected | FOUND — this is an incident; hand off to audit-security immediately, do not proceed with lifecycle workflows>
- Lifecycle action: <audit only | add | update | rotate | remove | migrate | provision new env>

Typical items for this skill:

  • Current environment tier (dev / staging / prod) — affects which bucket rules apply
  • Whether .env.example exists — affects drift-check baseline
  • Whether any secret-shaped value is tracked in git or git history (this is always an incident if true)

Stop-and-ask triggers:

  • A tracked secret is detected — immediate hand-off to audit-security incident mode, do NOT proceed with normal lifecycle workflows
  • Operator asks to "rotate" without naming which secret — list the candidates and ask

Silent picks are the most common failure mode: the skill runs, produces plausible output, and the operator doesn't notice the wrong interpretation was chosen. The Assumptions block is cheap insurance.

The four buckets — where does a value live?

Every value in a project fits into exactly one of these four buckets. Use this decision tree to place anything.

Value
│
├── Does it NEVER change at runtime? (colors, labels, fixed limits)
│ └── YES → Constant in source code
│ Example: MAX_RETRIES = 3
│ Rule: Commit it to git, give it a descriptive name, UPPER_SNAKE_CASE
│
├── Does it change per environment (dev/staging/prod)?
│ │
│ ├── Is it a secret? (token, password, private key, DB URL)
│ │ │
│ │ ├── Local development environment?
│ │ │ └── `.env` file (gitignored) + committed `.env.example`
│ │ │
│ │ └── Production / CI environment?
│ │ └── CI / platform secret store (GitHub Secrets, Vercel env vars, Fly secrets, etc.)
│ │ Rule: Never echo secrets in logs. Reference by name only.
│ │
│ └── Non-secret but env-specific? (log level, feature flag, port)
│ └── Environment variable
│ Example: LOG_LEVEL=debug, PORT=8080
│
└── Is it user-configurable at runtime? (theme, locale, preferences)
└── Runtime config (database row, config file, API call)
Not this skill's concern. Use whatever pattern the app already has.

When the operator asks where a value should go, walk down this tree with them in one sentence: "This is a production database URL, so it belongs in your CI provider's secret store — not `.env`, because `.env` is local only."

Secrets management — CLI over dashboards

Every hosting provider has a web UI for secrets, and every one of them also has a CLI that does the same thing faster and scripts cleanly. Prefer the CLI path — it's reproducible, diffable, and can live in a vm_setup.sh or a bootstrap script.

Do it the careful way: never paste a real secret directly into a command. Load it into a shell variable or a gitignored local file first:

bash
# Prompt without echoing the value to the terminal
read -sr DATABASE_URL && export DATABASE_URL && echo
# Or load from a local file that is already gitignored
export DATABASE_URL="$(< .secrets/database_url)"

Then reference "$DATABASE_URL" in the CLI call. This keeps the real value out of docs, screenshots, and casual copy-paste examples.

Per-platform CLI cheatsheet — GitHub, Vercel, Netlify, Fly.io, Railway, Cloud Run, AWS — is in references/secrets-cli.md. Open it only when the operator is actually setting secrets for a specific host.

Core rules, regardless of host:

  • When in doubt, start with the CLI. A 5-line shell script that sets the secrets is reproducible and documentable.
  • Never put a literal secret value in a commit message, PR body, screenshot, or shell history. Use placeholders, prompted input, shell variables, or file redirection in docs.
  • OIDC-federated identity beats a static secret when the platform supports it (AWS, GCP, Azure, Vault). The operator never has to rotate a credential that doesn't exist.
  • Rotate after every departing collaborator. It's a one-line CLI command.

The deploy-workflow side of secrets (how CI consumes them) lives in the setup-ci skill. This skill answers where the value lives; setup-ci answers how the workflow uses it.

.env and .env.example — the rule

The rule about .env is short:

  • `.env` — local only, never committed, contains real values.
  • `.env.example` — always committed, contains every key with either a safe default or a __REPLACE_ME__ placeholder, serves as the canonical list of required variables.
  • The key sets MUST match. If .env has DATABASE_URL and .env.example doesn't, someone will clone the repo and not know about that variable. When the skill adds a new env var, it updates both files.

The ready-to-use starter .env.example with __REPLACE_ME__ placeholders, commented sections for required vs optional, and safe defaults for common knobs lives in templates/.env.example.template. Copy it, fill in the real keys, and you're done.

Startup validation

A .env.example with __REPLACE_ME__ placeholders only works if the application refuses to start when it sees them. Add a check in the application's boot path, before any real work. Ready-to-paste patterns for Python, Node, and Go live in references/startup-validation.md.

The core rule is the same across languages: read the value, check for empty or placeholder, abort boot with a clear error. Do not continue with a fallback — fallbacks hide the problem.

Drift check — keep .env.example honest

The example file becomes useless the moment it drifts from the real .env. A ready-to-run drift check lives at scripts/check-env-drift.sh — wire it into a pre-commit hook, not CI. CI environments usually have no local .env, so the script would exit clean even when .env.example is out of date. Pre-commit catches it at the moment the operator adds a new variable.

Build-time vs runtime env vars (Next.js, Vite, CRA)

Environment variables in frontend frameworks come in two flavors and the distinction causes the most common leak among non-developers.

  • Build-time / public (NEXT_PUBLIC_* in Next.js, VITE_* in Vite, REACT_APP_* in CRA): baked into the client JavaScript bundle at build time. Anyone who views page source sees them. Never put a secret in a build-time variable. Safe uses: public API URLs, feature flags, non-secret configuration, analytics IDs.
  • Runtime / server-only (anything without the framework's public prefix): only available to server-side code. Safe for database URLs, API keys, session secrets, signing keys.

If a value is secret and also needs to be visible in the browser, it does not belong in env vars — it belongs behind an API route that reads the server-side secret and returns only the derived data the client actually needs.

Precedence when multiple .env files exist

Frameworks load several .env files, but the direction of precedence is not consistent across them. When debugging "why is this env var wrong?", never assume — always look up the framework's actual rule and confirm which file was loaded. The most common confusion is treating Next.js and Vite as identical; they are not.

  • Next.js: lookup is process.env (already-set OS env) → .env.$NODE_ENV.local → .env.local (skipped when NODE_ENV is test) → .env.$NODE_ENV → .env. Earlier in the chain wins. The .local variants are gitignored by convention; .env.development / .env.production are committed only when they hold non-secret defaults.
  • Vite: loads .env, .env.local, .env.[mode], .env.[mode].local, but already-set process env always wins over any file value, and mode-specific files override generic ones. Mode is development / production (default per vite dev / vite build) or any custom value passed via --mode. .local files are not loaded for mode === 'test'.
  • Node `dotenv`: one file by default. Use dotenv-flow or an explicit chain for multi-file support. By default, existing process.env values are not overwritten.
  • Python `python-dotenv`: one file by default; use dotenv_values() merging for explicit multi-file chains. load_dotenv(override=False) (the default) preserves existing os.environ values.
  • Ruby / Rails: reads .env.<environment> through dotenv-rails, with .env.local as an override.

.gitignore — the default-safe template

Non-developers routinely commit .env, SSH keys, build artifacts, and OS litter because they don't know to exclude them. The plugin ships a comprehensive default .gitignore at templates/.gitignore.template that blocks the usual suspects across Python, Node, Rust, Go, Java, OS / IDE, and local-only files.

Drop it in, trim the language sections the project doesn't use, and commit. If an existing .gitignore is missing secret-shaped entries (.env, *.pem, id_rsa), add them immediately — those are the ones that cause real incidents.

Secret-shaped entries to verify on every audit: .env, .env.* (except .env.example / .env.*.template), *.pem, *.key, id_rsa*, id_ed25519*, credentials*, secrets*, *.p12, *.pfx, service-account JSON keys (*-sa.json, *.credentials.json).

Lifecycle workflows — the "manage" part

Placing a value in the right bucket is the first decision. Everything after is lifecycle: values get added, updated, rotated, removed, migrated between buckets, and audited across environments. This section is the opinionated playbook for each operation. Full per-step detail and edge cases live in references/lifecycle-workflows.md.

Add a new value

Use the four-bucket tree to decide where it goes, then run this checklist:

  1. Add to the chosen bucket (source constant, .env + .env.example, CI/platform secret store, or environment variable).
  2. If it's in .env, add the same key to .env.example with __REPLACE_ME__ as the value.
  3. Add a startup validation check so the app refuses to boot without it. See references/startup-validation.md.
  4. Document the variable in the env-var table in README or CLAUDE.md. Hand off to write-for-ai if the table is stale or missing.
  5. Notify collaborators — if the app is deployed, the CI/platform secret must exist before the next deploy or startup validation will fail the rollout.
Update an existing value

The trap is forgetting one environment. A password changed in local .env but not in GitHub Secrets breaks the next deploy. Update in this order:

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
51
Repository forks
3
7-day trend score
20

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 4 Jul 2026, 4 months ago.

Extension points

  • hookPre/post lifecycle hooks

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/subinium/vibesubin/manage-secrets-env/badge)](https://verified-skill.com/skills/subinium/vibesubin/manage-secrets-env)

Something wrong with this skill or its page? Tell us.