Terminal.skills
Skills/direnv
>

direnv

Auto-load environment variables per directory with direnv. Use when a user asks to manage env vars per project, auto-switch configs between projects, or avoid manual .env loading.

#direnv#environment#dotenv#shell#config
terminal-skillsv1.0.0
Works with:claude-codeopenai-codexgemini-clicursor
Source

Usage

$
✓ Installed direnv v1.0.0

Getting Started

  1. Install the skill using the command above
  2. Open your AI coding agent (Claude Code, Codex, Gemini CLI, or Cursor)
  3. Reference the skill in your prompt
  4. The AI will use the skill's capabilities automatically

Example Prompts

  • "Review the open pull requests and summarize what needs attention"
  • "Generate a changelog from the last 20 commits on the main branch"

Documentation

Overview

direnv automatically loads/unloads environment variables when you cd into a directory. No more source .env — enter the project folder and variables are set.

Instructions

Step 1: Install

bash
brew install direnv
# Add to .bashrc or .zshrc:
eval "$(direnv hook bash)"

Step 2: Configure

bash
# .envrc — Auto-loaded when entering directory
export DATABASE_URL="postgresql://localhost:5432/myapp"
export API_KEY="sk-dev-key-123"
export NODE_ENV="development"
dotenv .env
PATH_add bin
PATH_add node_modules/.bin
bash
direnv allow    # required first time and after changes

Step 3: Per-Project Layouts

bash
# .envrc — Use specific versions
use nvm 20
layout python3

Guidelines

  • Always add .envrc to .gitignore — it contains secrets.
  • Use .envrc.example (committed) as template.
  • direnv unloads vars when you leave the directory — no env pollution.

Information

Version
1.0.0
Author
terminal-skills
Category
Development
License
Apache-2.0