Skip to main content

Claude Code Prompt to Audit Env and Config Files

Audit env files, configs, Docker, and CI/CD for exposed secrets, missing vars, and config drift across dev, staging, and prod. Severity-ranked, fix-ready.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt turns Claude Code into a configuration security auditor that reads your repo's actual files instead of guessing. It walks ten explicit checks — .env for plaintext secrets and default passwords, .env.example drift against the real .env, hardcoded values that belong in env vars, Docker and compose hardening, CI/CD secret handling, database connection security, env-specific settings that differ across dev/staging/prod, and API key rotation readiness — then ends by generating a clean, documented .env.example template you can commit.

It works because it is a checklist, not an open question. Each numbered item forces Claude to look for one specific class of problem, so nothing gets skipped when a file is long or noisy. The [framework] variable pins findings to real conventions (Laravel's config/*.php, Rails' credentials.yml.enc, Node's process.env), and the critical/warning/info severity flag makes the output triageable — you fix the critical leaks first and schedule the rest.

The [environment] and [config_count] variables tune scope: you decide which environment's .env is compared, and how many framework-specific best practices Claude must check beyond the universal nine.

When to use it

  • Before making a private repo public, or onboarding a contractor who'll get repo access.
  • Right after inheriting a legacy codebase where nobody knows what's in .env or whether secrets were ever committed.
  • When php artisan or npm start fails on a fresh clone because .env.example is missing keys the app actually needs.
  • Pre-deploy, to catch a DB_PASSWORD or APP_DEBUG=true that drifted between staging and prod.
  • During a security review when you need a severity-ranked list, not a vague "looks fine."
  • When standardizing config across several services and you want one authoritative .env.example.

Example output

CRITICAL  .env:14   Stripe live key committed (sk_live_…) — rotate now, purge from git history
CRITICAL  .env:31   DB_PASSWORD=password (default) — replace before any deploy
WARNING   config/services.php:22  Mailgun secret hardcoded; move to MAILGUN_SECRET
WARNING   .env.example missing: REDIS_PASSWORD, AWS_BUCKET (present in prod .env)
INFO      docker-compose.yml  Postgres port 5432 published to host — bind to 127.0.0.1
INFO      .env extra var STALE_FLAG not referenced in code — safe to remove

Generated .env.example:
  STRIPE_SECRET=        # Live/test secret key, never commit the real value
  DB_PASSWORD=          # Per-environment; use a secrets manager in prod

Pro tips

  • Set [environment] to prod for the highest-stakes pass — that's where APP_DEBUG=true and verbose logging do real damage. Re-run for staging separately; merging environments hides drift.
  • Claude can't see your git history. Pair this with git log -p --all -S 'sk_live' (or gitleaks/trufflehog) — this prompt flags secrets present now, not ones you committed and deleted.
  • Push [config_count] to 15+ for a thorough Laravel pass so it checks SESSION_SECURE_COOKIE, queue connection encryption, and config:cache compatibility, not just the obvious keys.
  • The generated .env.example is a starting template — review every description before committing. Treat it as a draft, never auto-commit a file claiming to document secrets.
  • Run it after php artisan config:clear; cached config can mask which values are actually env-driven versus hardcoded.

Frequently Asked Questions

Will this prompt find secrets I already committed and later deleted from .env?
No. It audits the files present in your working tree right now, so a key you committed months ago and removed won't show up. Pair it with a history scanner like gitleaks or trufflehog, or git log -S, to catch secrets buried in past commits — those still need rotation even if the current .env is clean.
Do I have to fill in the [framework] variable, or can I leave it generic?
Fill it in. The framework drives where Claude looks and which best practices apply — config/*.php for Laravel, credentials.yml.enc for Rails, process.env usage for Node. Leaving it generic still catches plaintext secrets and .env.example drift, but you lose the framework-specific checks in item 8 and get weaker, less actionable findings.
Is the generated .env.example safe to commit straight away?
Treat it as a draft. Claude builds it from the keys it found and writes a description for each, but you should confirm no real secret value leaked into a default and that the descriptions match your setup. The file documents which secrets exist, so review it like any security-relevant artifact before it goes into the repo.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Claude Code Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support