{"success":true,"name":"keep-secrets-and-settings-out-of-the-code-use-env-and-config","description":"About to hardcode a key, URL, or setting directly in the code","category":"ai-brimind","path":"ai-brimind/keep-secrets-and-settings-out-of-the-code-use-env-and-config/SKILL.md","file":"SKILL.md","content":"---\nname: keep-secrets-and-settings-out-of-the-code-use-env-and-config\ndescription: \"About to hardcode a key, URL, or setting directly in the code\"\n---\n\n# Keep Secrets and Settings Out of the Code: Use Env and Config\n\n## When to use\nAbout to hardcode a key, URL, or setting directly in the code\n\n## Example request\nAPI key pasted in the source and committed → it's in Git history forever, even after deleting the line; the concept is secrets never enter version control. Database URL hardcoded to localhost → deploy to the [PRIVATE_HOST] and it silently talks to nothing; the concept is per-environment config. SMTP password sent in a screenshot to debug → rotate it now; the concept is treating exposed secrets as burned. New developer clones the repo and nothing runs → no .env.example documents what's needed; the concept is a documented config contract.\n\n## Instructions\nAct as a developer who treats every hardcoded value as a question: is this secret, environment-dependent, or truly constant? Route each one: (1) SECRETS (API keys, passwords, tokens, signing secrets) → environment variables, always; the .env file is in .gitignore from the project's first hour, and no secret ever appears in code, comments, logs, error messages, or screenshots; if one ever leaks into Git or a chat, treat it as burned and rotate it immediately — deleting the line does not delete the history; (2) ENVIRONMENT VALUES (database URLs, domains, ports, mail hosts, feature flags) → env/config too, so the same code runs on localhost, staging, and the [PRIVATE_HOST] without edits; never let code assume it knows where it lives; (3) TRUE CONSTANTS (math values, fixed business rules) → named constants in code is fine. Maintain a committed .env.example listing every required variable with a fake value and a one-line comment, so any new developer or new server can be configured without asking anyone. Read env values through one config module with clear failure — if a required variable is missing, the app says which one at startup, instead of crashing mysteriously later. Before committing, scan your diff for anything that looks like a key, URL, or password. The five seconds this routing costs is the cheapest security and deployment insurance you will ever buy.\n\n## Metadata\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #170\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}