Env and config audit
Finds hardcoded secrets and config in code, moves them to environment variables, maintains a documented .env.example, ensures .env is git-ignored and checks git history for leaks. Use when the user asks to audit secrets, clean up config or before publishing a repo.
env-config-auditInstall
Run one command — it saves SKILL.md into your agent's skills folder. Restart the agent and the skill is picked up automatically.
mkdir -p ~/.claude/skills/env-config-audit && curl -fsSL https://anymodel.org/en/skills/devops/env-config-audit/SKILL.md -o ~/.claude/skills/env-config-audit/SKILL.md
mkdir -p ~/.agents/skills/env-config-audit && curl -fsSL https://anymodel.org/en/skills/devops/env-config-audit/SKILL.md -o ~/.agents/skills/env-config-audit/SKILL.md
New-Item -ItemType Directory -Force "$HOME\.claude\skills\env-config-audit" | Out-Null; Invoke-WebRequest https://anymodel.org/en/skills/devops/env-config-audit/SKILL.md -UseBasicParsing -OutFile "$HOME\.claude\skills\env-config-audit\SKILL.md"
New-Item -ItemType Directory -Force "$HOME\.agents\skills\env-config-audit" | Out-Null; Invoke-WebRequest https://anymodel.org/en/skills/devops/env-config-audit/SKILL.md -UseBasicParsing -OutFile "$HOME\.agents\skills\env-config-audit\SKILL.md"
Any other agent: save the file into its skills folder, or give it the link to the file: https://anymodel.org/en/skills/devops/env-config-audit/SKILL.md
SKILL.md
Env and Config Audit
Find secrets and environment-specific values hardcoded in a repository, move them to environment variables, and make the setup documented and safe. This is about secrets handling, so be strict about not exposing values.
Hard rules
- Never print, log, quote or commit a secret value. When reporting, show the file, line, and secret type only, with the value masked (
sk-****). - Never put real values into
.env.example, tests, docs or commit messages. - If a secret is found in git history or was ever public, tell the user to rotate it. Removing it from the code does not make it safe.
- Do not rewrite git history (filter-repo, force push) without the user's explicit confirmation; explain the consequences first.
Step 1: Protect before you change
- Check
.gitignore. It must ignore.env,.env.*(except.env.example), key files (*.pem,*.key), and local credential files. - If a file with secrets is tracked, stop and tell the user:
git ls-files | grep -E "\.env|\.pem|\.key|credentials". Untracking usesgit rm --cached <file>, which is safe for the file on disk, but still confirm first. - Add ignore rules first, then create any new secret-holding file.
Step 2: Scan the working tree
Use a dedicated scanner if one is installed (gitleaks, trufflehog, detect-secrets). Otherwise grep:
git grep -nIE "(api[_-]?key|secret|token|passwd|password|private[_-]?key)\s*[:=]\s*['\"][^'\"]{8,}"
git grep -nIE "AKIA[0-9A-Z]{16}|ghp_[A-Za-z0-9]{36}|sk-[A-Za-z0-9]{20,}|-----BEGIN [A-Z ]*PRIVATE KEY-----"
git grep -nIE "(postgres|mysql|mongodb|redis|amqp)://[^ '\"]*:[^ '\"]*@"
Also look for hardcoded, environment-specific config: hostnames, ports, URLs of internal services, bucket names, account ids, feature toggles, IP addresses, and email addresses of real people. Ignore test fixtures that are clearly fake, but say you did.
Step 3: Classify each finding
- Secret (credential, token, key, connection string with password): must move to env and be rotated if it was committed.
- Config that varies per environment (URLs, ports, hostnames): move to env with a default for local development.
- Constant that is the same everywhere: leave in code.
Step 4: Move to environment variables
- Read the value through the project's existing config mechanism (a settings module,
process.env,os.environ). Do not introduce a new config library without asking. - Fail fast on missing required secrets with a clear error naming the variable, not the value. Give optional values a safe default.
- Keep names consistent and prefixed by service where the project does (
PAYMENTS_API_KEY). - Do not read env vars scattered throughout the code; centralize reads in one config module if the project already does so.
API_KEY = os.environ["PAYMENTS_API_KEY"] # required, raises KeyError if missing
TIMEOUT = float(os.environ.get("PAYMENTS_TIMEOUT", "10"))
Step 5: Maintain .env.example
- One line per variable, grouped, with a comment on purpose, format and whether it is required.
- Placeholders only:
PAYMENTS_API_KEY=orPAYMENTS_API_KEY=changeme. - Every variable the code reads must be listed; every listed variable must be used. Verify by grepping env reads against the file.
- Mention in the README how to copy it:
cp .env.example .env.
Step 6: Check git history
git log --all --oneline -S"<non-secret marker, e.g. variable name>" -- .
git log --all --diff-filter=A --name-only --format= | grep -E "\.env$|\.pem$|id_rsa|credentials"
gitleaks git --redact --log-opts="--all" . # if installed (older versions: gitleaks detect)
Report whether secrets exist in past commits, in which files and commits (hashes only, values masked). For each one say: rotate now, and optionally clean history later with the user's approval. Remind the user that forks, clones and CI logs may still hold copies.
Output format
- Findings table:
file:line | type | action taken | needs rotation (yes/no); values always masked. - List of new or renamed environment variables, and whether
.env.exampleand docs were updated. .gitignorestatus.- History scan result and the explicit rotation list for the user.
- What you could not check (private branches, CI settings, other repos).
Pitfalls
- Base64 or "obfuscated" secrets are still secrets.
- Frontend bundles expose every env var baked in at build time; public keys only.
- Do not commit
.env"just for the team"; use a secret manager or a shared vault. - Docker
ARG/ENVand CI config files also leak secrets; check them too. - Rotating a key without updating the deployment breaks production; tell the user the order of operations.
Source: AnyModel skills catalog · License: CC BY 4.0
Connect through AnyModel API
This skill runs on whatever model your agent uses. Point Claude Code, Codex or Cursor at AnyModel to run it on Claude, GPT, Gemini and more with one key — pay per token, no subscription.
AnyModel