direnv

Automates loading and unloading of per-directory environment variables on Linux and macOS.

7|1|Updated Jul 12, 2026
One-click install
npx skills add https://github.com/julianobarbosa/claude-code-skills --skill direnv
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: direnv
Source: https://github.com/julianobarbosa/claude-code-skills/tree/main/skills/direnv
Command: npx skills add https://github.com/julianobarbosa/claude-code-skills --skill direnv

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill guides you in using direnv to automatically load and unload per-project environment variables, reducing context-switching and configuration toil.

Core Features & Use Cases

  • Per-project environments: Automatic environment loading when entering a project directory.
  • Stdlib functions: PATH and dotenv helpers keep your shell clean and consistent.
  • Security model: Explicit allowlists to prevent untrusted env changes.

Quick Start

Set up a .envrc for a project and run direnv allow to enable automatic env loading.

Frequently Asked Questions about direnv

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automatically load environment variables for each project directory?

Per-project environment variables load automatically when you enter a directory with a .envrc file and run direnv allow. This eliminates manual env setup for each project, keeping shell configuration consistent across Python, Node.js, Ruby, Go, and other toolchains.

Does direnv work with dotenv files and language-specific project layouts?

Yes, direnv loads dotenv files and detects language-specific layouts for Python, Node.js, Ruby, and Go projects. Built-in stdlib functions manage PATH and environment loading securely, integrating with version managers and nix-direnv for consistent per-project setups.

How does direnv's security model prevent unauthorized environment changes?

Direnv uses an explicit allowlist model requiring you to run direnv allow before activating environment variables in a directory. This prevents untrusted .envrc files from modifying your shell environment without your explicit approval.

Can I use direnv on macOS and Linux with my shell session?

Direnv automatically applies within shell sessions on macOS and Linux. It integrates seamlessly with your shell to load and unload per-directory environments without manual context-switching between projects.

What happens when I leave a project directory with direnv loaded?

Environment variables unload automatically when you exit the project directory, restoring your previous shell state. This prevents environment pollution and configuration conflicts across multiple projects.