Safe .env Manager
by @pioneer-weirdo
Safe .env key-first operations (CRUD) with secret-safe defaults. Use when troubleshooting missing env keys, auth/config failures, or when asked to add/update...
clawhub install env-ops-standardπ About This Skill
name: env-ops-standard description: Safe .env key-first operations (CRUD) with secret-safe defaults. Use when troubleshooting missing env keys, auth/config failures, or when asked to add/update/remove/list .env entries. Always list/check keys first and never expose secret values unless the user explicitly requests it.
env-ops-standard
Enforce a Key-First SOP for .env management.
Detailed naming/comment standard lives in:
{baseDir}/references/env-key-standard.mdWhen user asks about naming conventions, comment templates, key semantics clarity, or ambiguity prevention, read and follow that reference.
Workflow (mandatory)
1. Run key discovery first (no values):
- node {baseDir}/scripts/envsafe.js --file
2. Confirm target key exists/does not exist:
- node {baseDir}/scripts/envsafe.js --file
3. Then perform write operation only if needed:
- set/update: set (new key must include --comment by default policy)
- delete: unset
4. Validate after every write:
- node {baseDir}/scripts/envsafe.js --file
5. For org-wide consistency, run with policy + profile:
- node {baseDir}/scripts/envsafe.js --policy /home/node/.openclaw/envsafe-policy.json --profile openclaw-core --file
Safety rules
/home/node/.openclaw/.env unless user specifies otherwise..env full content.set defaults to stdin-only input. Passing value via argv requires explicit --allow-argv.--comment "...") to avoid ambiguity.used-by and updated markers).^[A-Z][A-Z0-9_]*$), no ad-hoc naming.--backup-keep, --backup-ttl-days).--force is explicitly passed.unset is destructive; confirm intent if user did not explicitly ask to remove key.Commands
node {baseDir}/scripts/envsafe.js --file /home/node/.openclaw/.env keys
node {baseDir}/scripts/envsafe.js --file /home/node/.openclaw/.env exists OPENAI_API_KEY
printf '%s' 'NEW_VALUE' | node {baseDir}/scripts/envsafe.js --file /home/node/.openclaw/.env set OPENAI_API_KEY --stdin
printf '%s' 'NEW_VALUE' | node {baseDir}/scripts/envsafe.js --file /home/node/.openclaw/.env set NEW_PROVIDER_API_KEY --stdin --comment "Provider key for xxx integration"
printf '%s' 'NEW_VALUE' | node {baseDir}/scripts/envsafe.js --file /home/node/.openclaw/.env set OPENAI_API_KEY --stdin --if-missing
node {baseDir}/scripts/envsafe.js --file /home/node/.openclaw/.env unset OPENAI_API_KEY
node {baseDir}/scripts/envsafe.js --file /home/node/.openclaw/.env lint
node {baseDir}/scripts/envsafe.js --file /home/node/.openclaw/.env doctor
node {baseDir}/scripts/envsafe.js --file /home/node/.openclaw/.env --strict doctor
... set/unset ... --dry-run
node {baseDir}/scripts/envsafe.js --policy /home/node/.openclaw/envsafe-policy.json policyOutput contract
keys: one key per lineexists: prints present or missingset/unset: prints changed count + backup file pathlint: prints OK if clean; otherwise prints findings and exits non-zero