Verify which environment variable keys are present in .env files or shell environment without exposing their values. Use when you need to check env configuration or compare keys between .env files.
/plugin marketplace add iamladi/cautious-computing-machine--primitives-plugin/plugin install primitives@cautious-computing-machineThis skill inherits all available tools. When active, it can use any tool Claude has access to.
This skill allows you to verify which environment variable keys are present in .env files OR shell environment WITHOUT exposing their values.
When invoked, check for environment variable keys in the following locations:
File-based configuration:
.env.local (local overrides, gitignored).env (if it exists, usually gitignored).env.example (template file, committed).env.sample (alternative template name)Shell environment:
~/.bashrc, ~/.zshrc, etc.Use this command to extract only the keys (not values) from env files:
for file in .env.local .env .env.example .env.sample; do if [ -f "$file" ]; then echo "=== Keys in $file ==="; grep -v '^#' "$file" | grep -v '^[[:space:]]*$' | grep '=' | cut -d'=' -f1 | sort; echo ""; fi; done
Use this command to find keys that are missing from both .env.local AND the shell environment:
sample_file=""; if [ -f ".env.sample" ]; then sample_file=".env.sample"; elif [ -f ".env.example" ]; then sample_file=".env.example"; fi; local_file=""; if [ -f ".env.local" ]; then local_file=".env.local"; elif [ -f ".env" ]; then local_file=".env"; fi; if [ -n "$sample_file" ]; then sample_keys=$(grep -v '^#' "$sample_file" | grep -v '^[[:space:]]*$' | grep '=' | cut -d'=' -f1 | sort); local_keys=""; if [ -n "$local_file" ]; then local_keys=$(grep -v '^#' "$local_file" | grep -v '^[[:space:]]*$' | grep '=' | cut -d'=' -f1 | sort); fi; missing=""; for key in $sample_keys; do if [ -n "$local_keys" ] && echo "$local_keys" | grep -q "^$key$"; then continue; fi; if printenv "$key" >/dev/null 2>&1; then continue; fi; missing="$missing\n - $key"; done; if [ -n "$missing" ]; then echo "⚠️ Missing from .env.local and shell environment (present in $sample_file):"; echo -e "$missing"; else echo "✓ All required environment variables are configured (either in .env.local or shell environment)"; fi; else echo "No .env.sample or .env.example file found"; fi
Important: This command checks if variables are set in the shell environment WITHOUT exposing their values. Variables can be configured in three ways:
.env.local file.env file~/.bashrc, ~/.zshrc, or set by the system)Environment variables are considered "configured" if they exist in any of these locations:
.env.local file.env fileIf a key exists in ANY of these locations:
The verification process ONLY checks for key existence, not values. This ensures API keys and secrets are never exposed in logs or to the AI.
After running the commands, you can:
=== Keys in .env.local ===
DATABASE_URL
NEXT_PUBLIC_API_URL
=== Keys in .env.sample ===
ANTHROPIC_API_KEY
DATABASE_URL
NEXT_PUBLIC_API_URL
OPENAI_API_KEY
Scenario A: All variables configured
✓ All required environment variables are configured (either in .env.local or shell environment)
Scenario B: Some variables missing from both .env.local and shell
⚠️ Missing from .env.local and shell environment (present in .env.sample):
- ANTHROPIC_API_KEY
- SOME_OTHER_KEY
Note: If OPENAI_API_KEY was in .env.sample but not reported as missing, it means it's set in the shell environment (e.g., exported in ~/.zshrc).