direnv

Load per-directory environment variables securely without exposing secrets.

3|1|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/Cogni-AI-OU/cogni-ai-agent-skills --skill direnv-cogni-ai-ou
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: direnv
Source: https://github.com/Cogni-AI-OU/cogni-ai-agent-skills/tree/main/direnv
Command: npx skills add https://github.com/Cogni-AI-OU/cogni-ai-agent-skills --skill direnv-cogni-ai-ou

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

direnv solves the problem of securely loading per-project environment variables (like API keys) without printing or exposing secrets in terminal output or version control.

Core Features & Use Cases

  • Secure credential loading: Authorizes directories with direnv so secrets are injected when you enter a project, rather than copied into logs.
  • Session-safe exporting: Ensures variables are actually loaded into the current shell session via the recommended export evaluation step.
  • Use Case: When an agent runs project commands that require credentials stored in a local .env file, use direnv to authorize and load those variables automatically for that directory.

Quick Start

Run direnv allow <path-to-env-dir> and then eval "$(direnv export bash)" in the same execution context to load the approved variables.

Frequently Asked Questions about direnv

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

FAQPage Schema
How do I securely load environment variables from a .env file without exposing secrets in terminal output?▼

You can securely load environment variables by authorizing the directory with direnv, which injects credentials upon directory entry without printing secret values to terminal logs.

Why are my .env variables not loading into the current shell session after using direnv?▼

Environment variables require an explicit export step to load into the shell session. You must run direnv allow followed by eval "$(direnv export bash)" in the same execution context.

What is the best way to manage per-directory project secrets for local development?▼

The best way to manage per-directory secrets is using direnv to authorize specific project directories, automatically loading credentials only when you enter that directory.

Can I use direnv to prevent accidental commits of local .env authentication files?▼

Yes, direnv loads project-specific authentication variables directly into the shell environment, avoiding the need to copy secret values into files that might be accidentally committed.

Does direnv work for automated agent command workflows that require project credentials?▼

Yes, direnv applies to agent command workflows by authorizing environment-variable sources and loading required project-specific credentials safely for automated execution.