skills-templates/dotenvx/SKILL.md
dotenvx - secure environment variable management with encryption. Use for encrypting .env files, multi-environment configuration, cross-platform secret management, and migrating from plaintext dotenv.
npx skillsauth add enuno/claude-command-and-control dotenvxInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
dotenvx is a secure dotenv from the creator of the original dotenv package. It adds encryption, multi-environment support, and cross-platform compatibility to environment variable management. Think of it as "dotenv with encryption" - your secrets are encrypted at rest and can be safely committed to version control.
Core Value Proposition: Encrypt your .env files so they can be safely committed to git, while keeping decryption keys separate and secure.
This skill should be triggered when:
Traditional .env files are plaintext - if committed to git or exposed, all secrets are compromised. dotenvx solves this by:
┌─────────────────────────────────────────────────────────────┐
│ dotenvx WORKFLOW │
└─────────────────────────────────────────────────────────────┘
.env (plaintext) .env.keys (NEVER commit)
┌──────────────────┐ ┌──────────────────────────┐
│ HELLO=World │ │ DOTENV_PRIVATE_KEY=... │
│ API_KEY=secret │ │ DOTENV_PUBLIC_KEY=... │
└────────┬─────────┘ └────────────┬─────────────┘
│ │
▼ dotenvx encrypt │
┌──────────────────┐ │
│ HELLO="encrypted:│◄───────────────────────┘
│ BE9Y5L..." │ Uses public key to encrypt
│ API_KEY="encrypt │
│ ed:CGY8..." │
└────────┬─────────┘
│
▼ Safe to commit to git!
┌──────────────────┐
│ Git Repository │
└────────┬─────────┘
│
▼ dotenvx run (at runtime)
┌──────────────────┐
│ Decrypts using │◄── Private key from:
│ private key │ - .env.keys file
│ │ - DOTENV_PRIVATE_KEY env var
└────────┬─────────┘
│
▼
┌──────────────────┐
│ process.env.HELLO│
│ = "World" │
└──────────────────┘
| File | Purpose | Git? |
|------|---------|------|
| .env | Development environment variables | ✅ Yes (when encrypted) |
| .env.production | Production environment variables | ✅ Yes (when encrypted) |
| .env.keys | Private decryption keys | ❌ Never |
| .env.local | Local overrides | ❌ No |
npm install @dotenvx/dotenvx --save
brew install dotenvx/brew/dotenvx
curl -sfS https://dotenvx.sh | sh
docker run -it --rm -v $(pwd):/app dotenv/dotenvx help
winget install dotenvx
npx @dotenvx/dotenvx help
Run any command with environment variables injected:
# Basic usage
dotenvx run -- node index.js
# Specify environment file
dotenvx run -f .env.production -- node index.js
# Multiple files (earlier takes precedence)
dotenvx run -f .env.local -f .env -- node index.js
# Use framework conventions (Next.js, etc.)
dotenvx run --convention=nextjs -- npm run build
# Override existing environment variables
dotenvx run --overload -- node index.js
Convert plaintext .env to encrypted format:
# Encrypt default .env file
dotenvx encrypt
# Encrypt specific file
dotenvx encrypt -f .env.production
# Encrypt all .env* files
dotenvx encrypt -f .env*
Result: Creates/updates .env.keys with encryption keys.
Revert encrypted .env to plaintext:
# Decrypt default .env file
dotenvx decrypt
# Decrypt specific file
dotenvx decrypt -f .env.production
Add or update encrypted variables:
# Set a variable (encrypts automatically)
dotenvx set HELLO World
# Set in specific environment
dotenvx set HELLO production -f .env.production
# Set from stdin (for sensitive values)
echo "supersecret" | dotenvx set API_KEY
# Get single variable
dotenvx get HELLO
# Get from specific file
dotenvx get HELLO -f .env.production
# Get all variables as JSON
dotenvx get --all --format json
# Show public/private key pair
dotenvx keypair
# Show for specific environment
dotenvx keypair -f .env.production
project/
├── .env # Development (encrypted)
├── .env.production # Production (encrypted)
├── .env.staging # Staging (encrypted)
├── .env.local # Local overrides (not committed)
├── .env.keys # All private keys (NEVER commit)
└── .gitignore
# Never commit private keys
.env.keys
# Never commit local overrides
.env.local
.env.*.local
# DO commit encrypted .env files
# (remove these from .gitignore if present)
# .env
# .env.production
# .env.staging
Each environment gets its own key pair:
# .env.keys after encrypting multiple environments
DOTENV_PRIVATE_KEY="ec9d6..." # For .env
DOTENV_PRIVATE_KEY_PRODUCTION="a]c8..." # For .env.production
DOTENV_PRIVATE_KEY_STAGING="3d5f..." # For .env.staging
# Next.js convention loads in this order:
# .env.local → .env.development → .env
dotenvx run --convention=nextjs -- npm run dev
package.json:
{
"scripts": {
"dev": "dotenvx run -- node index.js",
"start": "dotenvx run -f .env.production -- node index.js"
}
}
index.js:
// Option 1: Use dotenvx as drop-in replacement
require('@dotenvx/dotenvx').config()
console.log(process.env.HELLO)
// Option 2: Use dotenvx.get() for explicit access
const dotenvx = require('@dotenvx/dotenvx')
dotenvx.config()
console.log(dotenvx.get('HELLO'))
package.json:
{
"scripts": {
"dev": "dotenvx run --convention=nextjs -- next dev",
"build": "dotenvx run -f .env.production -- next build",
"start": "dotenvx run -f .env.production -- next start"
}
}
Dockerfile:
FROM node:20-alpine
# Install dotenvx
RUN curl -sfS https://dotenvx.sh | sh
WORKDIR /app
COPY . .
RUN npm install
# Run with dotenvx (provide DOTENV_PRIVATE_KEY at runtime)
CMD ["dotenvx", "run", "--", "node", "index.js"]
docker-compose.yml:
services:
app:
build: .
environment:
- DOTENV_PRIVATE_KEY_PRODUCTION=${DOTENV_PRIVATE_KEY_PRODUCTION}
name: Deploy
on: [push]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dotenvx
run: curl -sfS https://dotenvx.sh | sh
- name: Build with secrets
env:
DOTENV_PRIVATE_KEY_PRODUCTION: ${{ secrets.DOTENV_PRIVATE_KEY_PRODUCTION }}
run: dotenvx run -f .env.production -- npm run build
dotenvx set API_KEY "production-secret" -f .env.production
vercel env add DOTENV_PRIVATE_KEY_PRODUCTION
# Paste the key from .env.keys
{
"buildCommand": "dotenvx run -f .env.production -- npm run build"
}
# Comments start with #
HELLO=World
DATABASE_URL=postgres://localhost/mydb
# Quoted values
MESSAGE="Hello, World!"
SINGLE_QUOTED='No $expansion here'
# Multiline with backticks
PRIVATE_KEY=`-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA...
-----END RSA PRIVATE KEY-----`
# Reference other variables
BASE_URL=https://api.example.com
API_ENDPOINT=${BASE_URL}/v1
# Default values
PORT=${PORT:-3000}
# Alternate if set
DEBUG_MODE=${DEBUG:+enabled}
# Embed command output
HOSTNAME=$(hostname)
USER=$(whoami)
TIMESTAMP=$(date +%s)
After running dotenvx encrypt:
#/-------------------[DOTENV_PUBLIC_KEY]--------------------/
#/ public-key encryption for .env files /
#/ [how it works](https://dotenvx.com/encryption) /
#/----------------------------------------------------------/
DOTENV_PUBLIC_KEY="034a..."
# Encrypted values
HELLO="encrypted:BE9Y5L3OxAOOmfq..."
API_KEY="encrypted:CGY8BDMHfq..."
.env.keys - Add to .gitignore immediately# Set private key as environment variable
export DOTENV_PRIVATE_KEY_PRODUCTION="your-private-key"
# dotenvx automatically uses it for decryption
dotenvx run -f .env.production -- npm run build
# Developer 1: Encrypts new secret
dotenvx set NEW_API_KEY "secret123"
git add .env
git commit -m "Add NEW_API_KEY (encrypted)"
git push
# Developer 2: Pulls and runs (has .env.keys locally)
git pull
dotenvx run -- npm run dev # Works automatically
# Option 1: Secure channel (1Password, Signal, etc.)
cat .env.keys | pbcopy # Copy to clipboard
# Option 2: In-person/video call
# Option 3: Company secrets manager
# Store DOTENV_PRIVATE_KEY in vault
Error: Missing private key for .env.production
Solution: Set the private key:
# Option 1: Create/restore .env.keys file
echo 'DOTENV_PRIVATE_KEY_PRODUCTION="abc123..."' > .env.keys
# Option 2: Set environment variable
export DOTENV_PRIVATE_KEY_PRODUCTION="abc123..."
Cause: Wrong private key or corrupted encrypted value
Solution:
# Verify key matches
dotenvx keypair -f .env.production
# Re-encrypt if needed
dotenvx decrypt -f .env.production # If you have the right key
dotenvx encrypt -f .env.production
# Debug: Show what dotenvx is loading
dotenvx run --debug -- node -e "console.log(process.env)"
# Check file is being read
dotenvx run -f .env.production --verbose -- echo "loaded"
# Check which file has encrypted values
grep "encrypted:" .env*
# Ensure matching .env.keys entries
cat .env.keys
npm install @dotenvx/dotenvx --save
npm uninstall dotenv
// Before
require('dotenv').config()
// After (drop-in replacement)
require('@dotenvx/dotenvx').config()
# Encrypt current .env file
dotenvx encrypt
# Verify encryption worked
cat .env # Should show encrypted: values
# Save .env.keys somewhere secure!
cat .env.keys
{
"scripts": {
"dev": "dotenvx run -- node index.js",
"start": "dotenvx run -f .env.production -- node index.js"
}
}
tools
MemPalace local-first AI memory system. Use when setting up persistent memory for Claude Code sessions, mining project files or conversation transcripts, querying past context, configuring MCP tools, managing the knowledge graph, or troubleshooting palace operations.
tools
LangSmith Python SDK — trace, evaluate, and monitor LLM applications. Covers @traceable decorator, trace context manager, Client API, evaluate() / aevaluate(), comparative evaluation, custom evaluators, dataset management, prompt caching, ASGI middleware, and pytest plugin.
development
LangGraph (Python) — build stateful, controllable agent graphs with checkpointing, streaming, persistence, interrupts, fault tolerance, and durable execution. Covers both Graph API (StateGraph) and Functional API (@entrypoint/@task).
development
LangGraph Graph API (Python) — build explicit DAG agent workflows with StateGraph, typed state, nodes, edges, Command routing, Send fan-out, checkpointers, interrupts, and streaming. Use when you need explicit control flow and graph topology.