secrets-handling

Replace hardcoded secrets with environment variables and validate startup configuration.

13|2|Updated Jan 21, 2026
One-click install
npx skills add https://github.com/yanko-belov/code-craft --skill secrets-handling
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: secrets-handling
Source: https://github.com/yanko-belov/code-craft/tree/main/skills/secrets-handling
Command: npx skills add https://github.com/yanko-belov/code-craft --skill secrets-handling

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Hardcoding secrets creates serious risk: credentials can leak through version control history, logs, and error messages, potentially compromising systems.

Core Features & Use Cases

  • Environment-driven configuration to replace hardcoded values with environment variables across codebases and deployments.
  • Secrets hygiene rules to prevent logging, printing, or exposing sensitive data at runtime or in errors.
  • Use Case: migrate a production app that stores API keys into env vars and implement startup validation for required keys.

Quick Start

Refactor code to load secrets from environment variables, add startup validation, and provide a .env example with placeholders (do not commit real values).

Frequently Asked Questions about secrets-handling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I eliminate hardcoded secrets from my codebase?

To eliminate hardcoded secrets, refactor your codebase to load API keys and credentials from environment variables instead of literal values. This prevents leakage through version control by enforcing environment-driven configuration across development, CI, and deployment workflows.

How do I prevent environment variables and secrets from leaking in application logs?

Preventing secrets from leaking in logs requires enforcing strict secrets hygiene rules at runtime. You must sanitize logging and error messages to ensure sensitive environment variables are never printed or exposed when the application handles exceptions.

What is the best way to validate required environment variables at application startup?

Validating environment variables at startup involves checking that all required API keys and credentials are present before the application executes. This secrets validation ensures missing configuration fails safely and immediately rather than causing runtime errors.

How do I migrate a production app to use environment variables for API keys?

Migrating a production app to use environment variables requires replacing hardcoded API keys with environment-driven configuration and adding startup validation. You should also provide a .env example file with placeholders while ensuring real credential values are never committed.

Why does my application expose credentials in error messages?

Applications expose credentials in error messages when secrets are hardcoded or improperly handled during exceptions. Implementing secrets hygiene rules prevents sensitive data exposure by sanitizing error outputs and loading values exclusively from environment variables.