Use this skill whenever writing code that touches configuration, environment variables, API keys, credentials, authentication, or external service connections. Also use when setting up a new project, adding dependencies, creating Docker configurations, or writing CI pipelines. This skill prevents accidental exposure of secrets and enforces dependency safety. It should be consulted alongside any language-specific coding skill.
This skill prevents the most common security mistakes in codebases: leaking secrets and shipping vulnerable dependencies. These rules apply to every language, framework, and project.
These rules have zero exceptions. Do not rationalise around them. "Just for testing", "I'll rotate it later", "it's only local" — none of these are valid reasons.
.env.example, never .env. The .env file must be in .gitignore. Provide .env.example with placeholder values documenting every required variable:
DATABASE_URL=postgresql://user:password@localhost:5432/dbname
API_KEY=your-api-key-here
ENV in a Dockerfile for secrets. Pass them at runtime via docker run -e or Docker Compose environment/env_file with a .env file that is gitignored.${{ secrets.MY_SECRET }}), never plaintext in workflow files.Every project's .gitignore must include at minimum:
# Secrets and environment
.env
.env.local
.env.*.local
*.pem
*.key
*.p12
*.pfx
# IDE and OS
.idea/
.vscode/
*.swp
.DS_Store
Thumbs.db
# Dependencies (language-specific — add the appropriate patterns)
node_modules/
__pycache__/
*.pyc
vendor/
# Build outputs (language-specific — add the appropriate patterns)
dist/
build/
*.o
*.class
Tailor the language-specific sections to the actual stack. The secrets section is non-negotiable for all projects.
package-lock.json, poetry.lock, Gemfile.lock, etc.) and commit them. This ensures reproducible builds and prevents supply chain attacks via version drift.npm audit, pip-audit, or Dependabot/Renovate for automated vulnerability alerts. Don't ignore security warnings.If a secret is committed to any branch, even locally:
git filter-repo or BFG Repo-Cleaner — but treat this as damage limitation, not a fix. The old credential must be considered compromised.The rotation step is the only one that actually secures the system. History rewriting is cosmetic.