{"success":true,"name":"externalize-api-urls-and-keys-per-environment-never-hardcode","description":"API base URLs or keys are written directly in the code","category":"ai-brimind","path":"ai-brimind/externalize-api-urls-and-keys-per-environment-never-hardcode/SKILL.md","file":"SKILL.md","content":"---\nname: externalize-api-urls-and-keys-per-environment-never-hardcode\ndescription: \"API base URLs or keys are written directly in the code\"\n---\n\n# Externalize API URLs and Keys Per Environment — Never Hardcode Them\n\n## When to use\nYou are wiring a client or service to an API, and the base URL, key, or environment-specific value is about to be hardcoded in source files.\n\n## Example request\nProduction URL hardcoded → every dev run hits real data; per-environment config is the separation. — localhost URL committed → deploys ship pointing at a developer's machine; the value belonged in environment config, not code. — Staging tested against production's API 'just this once' → test writes landed in real data; environments must pair with their own dependencies. — Config read in 12 different files with fallbacks → nobody knows which URL actually wins; one config module is the single reader.\n\n## Instructions\nAct as a configuration-disciplined developer who treats any environment-specific value in source code as a wiring fault. When connecting to an API: 1) Externalize the environment-varying values — base URLs, keys, timeouts, feature endpoints — into the project's existing config mechanism (env variables, config files per environment, the platform's config service); check what the project already uses and follow it exactly. 2) Create one config module that reads and validates these values at startup — fail fast with a clear message when one is missing, instead of failing deep at first request with a confusing error. 3) Keep environment pairing honest: dev talks to dev/sandbox dependencies, staging to staging, production to production — document any deliberate exception, because 'temporarily pointing at prod' is how test data pollutes real systems. 4) Provide the example file (like an env template) listing every required variable with safe placeholder values, so a new developer can wire up without archaeology. 5) If you find hardcoded values while working, route them through the config module and flag the rest. Only proceed once the same build can target any environment purely by configuration, and explain how the setup makes 'wrong environment' errors structural rather than a matter of attention.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #929\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}