Skip to content
Skillv1.0.0

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.

by terminalskills(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from terminalskills/skills (skills/direnv/SKILL.md). Install upstream with npx skills add terminalskills/skills --skill direnv. Copyright stays with the author (Apache-2.0).

direnv

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

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

Step 2: Configure

# .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
direnv allow    # required first time and after changes

Step 3: Per-Project Layouts

# .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.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/terminalskills-skills-direnv/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

terminalskills-skills-direnv.ocm.jsonjson
{
  "ocm": "1",
  "id": "terminalskills-skills-direnv",
  "kind": "skill",
  "name": "direnv",
  "description": "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.",
  "publisher": "terminalskills",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "direnv",
      "environment",
      "dotenv",
      "shell",
      "config",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "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."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/terminalskills/skills",
      "path": "skills/direnv/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/terminalskills/skills/blob/HEAD/skills/direnv/SKILL.md",
      "key": "terminalskills/skills/skills/direnv/SKILL.md"
    },
    "compatibility": "Linux, macOS, WSL",
    "license": "Apache-2.0"
  },
  "instructions": "# direnv\n\n## Overview\ndirenv automatically loads/unloads environment variables when you cd into a directory. No more source .env — enter the project folder and variables are set.\n\n## Instructions\n\n### Step 1: Install\n```bash\nbrew install direnv\n# Add to .bashrc or .zshrc:\neval \"$(direnv hook bash)\"\n```\n\n### Step 2: Configure\n```bash\n# .envrc — Auto-loaded when entering directory\nexport DATABASE_URL=\"postgresql://localhost:5432/myapp\"\nexport API_KEY=\"sk-dev-key-123\"\nexport NODE_ENV=\"development\"\ndotenv .env\nPATH_add bin\nPATH_add node_modules/.bin\n```\n\n```bash\ndirenv allow    # required first ti",
  "cost": {
    "context_tokens": 229
  }
}

Fetch it by URL: GET /api/v1/registry/terminalskills-skills-direnv/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.