direnv
Files
SKILL.mdagentsreferences
Install
Install the containing plugin
/plugin install ci-cd@llm-skills
Invoke this skill after installation
/ci-cd:direnv
This skill is bundled inside ci-cd. Install the plugin once, then Claude Code can use any of its included skills. Browse the full plugin repository at github.com/alisonaquinas/llm-ci-dev.
SKILL.md
name: direnv description: Manage per-directory environment variables with direnv. Use when tasks mention direnv, .envrc, per-directory environment variables, or automatic environment switching.
direnv
Intent Router
| Request | Reference | Load When |
|---|---|---|
| apt/brew/nix install, shell hook, .envrc security model | references/install-and-setup.md | direnv needs to be installed or the shell hook is missing |
| allow/deny/reload/edit/status/prune commands | references/command-cookbook.md | Specific direnv commands are needed |
| export, PATH_add, source_env, layout, use commands | references/envrc-patterns.md | Writing or debugging .envrc content is the topic |
| pyenv layout, nvm, rbenv, asdf use, dotenv, editor | references/integrations.md | Integrating direnv with other tools or editors is the topic |
Quick Start
# Allow a directory's .envrc
direnv allow
# Check current status
direnv status
# Edit .envrc and reload automatically on save
direnv edit .
# Reload after manual edits
direnv reload
Core Command Tracks
- Allow .envrc:
direnv allow(required after creating or modifying .envrc) - Deny .envrc:
direnv deny - Reload env:
direnv reload - Edit safely:
direnv edit .(allows after saving) - Status:
direnv status - Prune stale:
direnv prune(clean up allowed list for missing directories)
Safety Guardrails
- Never run
direnv allowon an.envrcfrom an untrusted source without reviewing its contents first. - Do not commit secrets directly in
.envrc— load them from a.envfile excluded by.gitignore. - Add
.envrcto.gitignoreif it contains machine-specific paths or credentials; share a.envrc.exampleinstead. - Re-run
direnv allowwhenever.envrcis modified — direnv blocks the changed file until re-approved.
Workflow
- Install direnv and add the shell hook to the profile (see
references/install-and-setup.md). - Create
.envrcin the project directory with the required exports or layout. - Run
direnv allowto approve the file. - Verify environment variables are set with
direnv statusorecho $VAR. - When
.envrcchanges, rundirenv allowagain.
# Troubleshoot: check if .envrc is blocked, then re-approve after review
direnv status
cat .envrc # review contents before trusting
direnv allow
direnv reload
Related Skills
- nvm — Node.js version manager, integrates with direnv via
layout node - pyenv — Python version manager, integrates via
layout pyenv - rbenv — Ruby version manager, integrates via
layout ruby - asdf — universal version manager, integrates via
use asdf
References
references/install-and-setup.mdreferences/command-cookbook.mdreferences/envrc-patterns.mdreferences/integrations.md- Official site: https://direnv.net
- direnv man page: https://direnv.net/man/direnv.1.html
- direnv stdlib: https://direnv.net/man/direnv-stdlib.1.html