direnv-pattern
БесплатноБез исполняемых скриптовНе проверенImplements the b00t environment management pattern: direnv → .envrc → dotenv → .env where datums specify WHICH environment variables are required and .env…
Об этом скилле
What This Skill Does
The b00t direnv pattern provides secure, automatic environment variable management for projects. This skill helps you:
- Set up direnv + .envrc + .env configuration
- Follow the b00t pattern: WHICH (datums) vs VALUES (.env)
- Validate environment variables before execution
- Support multiple environments (dev, staging, prod)
- Integrate with b00t datum system
When It Activates
Activate this skill when you see phrases like:
- "setup environment variables"
- "configure direnv"
- "create .envrc file"
- "add API keys"
- "environment not loading"
- "missing environment variables"
- "configure .env file"
- "setup direnv pattern"
The b00t Pattern Flow
Developer enters directory
↓
direnv detects .envrc file
↓
.envrc calls: dotenv
↓
dotenv loads .env file
↓
Environment variables available
↓
Rust validates via datum
↓
✅ Agent runs
Key Principles
- Datums specify WHICH -
~/.dotfiles/_b00t_/*.ai.tomlfiles specify required variable names .envcontains VALUES - Actual API keys and secrets (gitignored)direnvloads automatically - No manualsourceorexportneeded- Rust validates - Via PyO3 bindings, DRY approach
File Structure
project/
├── .envrc # ← Loaded by direnv (calls dotenv)
├── .env # ← Contains actual API keys (GITIGNORED!)
├── .envrc.example # ← Template for .envrc (committed)
├── .env.example # ← Shows required keys (committed)
└── .gitignore # ← Must include .env and .envrc
Setup Instructions
1. Install direnv
# macOS
brew install direnv
# Ubuntu/Debian
sudo apt-get install direnv
# Add to shell (choose one):
# bash:
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc
# zsh:
echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc
# fish:
echo 'direnv hook fish | source' >> ~/.config/fish/config.fish
2. Create .envrc
# b00t direnv configuration
# This file demonstrates the b00t pattern: direnv → .envrc → dotenv → .env
# Load project .env file (contains API keys)
dotenv
# Optionally load home directory .env for global keys
# dotenv ~/.env
# Optionally load environment-specific configs
# dotenv .env.local
# dotenv .env.development
3. Create .env with API Keys
# OpenRouter (200+ models via single API)
OPENROUTER_API_KEY=sk-or-v1-abc123...
# Anthropic (Claude)
ANTHROPIC_API_KEY=sk-ant-api03-xyz789...
# OpenAI
OPENAI_API_KEY=sk-proj-def456...
# HuggingFace
HF_TOKEN=hf_ghi789...
# Groq (ultra-fast inference)
GROQ_API_KEY=gsk_jkl012...
4. Allow direnv
direnv allow
5. Verify Setup
# Check environment variables are loaded
echo $OPENROUTER_API_KEY
# Test with Python
python3 -c "import os; print('✅ Loaded' if os.getenv('OPENROUTER_API_KEY') else '❌ Not loaded')"
.envrc.example Template
# b00t direnv configuration
# Setup:
# 1. Copy: cp .envrc.example .envrc
# 2. Copy: cp .env.example .env
# 3. Edit .env with your actual API keys
# 4. Enable: direnv allow
# Load project .env file (contains API keys)
dotenv
# Optionally load home directory .env for global keys
# dotenv ~/.env
# Optionally load environment-specific configs
# dotenv .env.local
# Layout python - ensures direnv works with Python virtual environments
# Uncomment if using a venv:
# layout python python3.12
.env.example Template
# b00t Environment Configuration
# ==========================================
# API keys are loaded via direnv → .envrc → dotenv → .env pattern.
#
# Setup:
# 1. Copy: cp .env.example .env
# 2. Fill in your actual API keys in .env
# 3. Enable: direnv allow (after copying .envrc.example to .envrc)
#
# The b00t pattern:
# - Datums (~/.dotfiles/_b00t_/*.ai.toml) specify WHICH vars are required
# - This .env file contains the actual VALUES
# - direnv loads them automatically when entering the directory
# OpenAI (gpt-4, gpt-3.5-turbo, etc.)
# OPENAI_API_KEY=sk-proj-...
# Anthropic (claude-3.5-sonnet, claude-3-opus, etc.)
# ANTHROPIC_API_KEY=sk-ant-api03-...
# Google Gemini
# GOOGLE_API_KEY=...
# Groq (llama-3.1, mixtral, etc.)
# GROQ_API_KEY=gsk_...
# OpenRouter (200+ models via single API)
# OPENROUTER_API_KEY=sk-or-...
# HuggingFace
# HF_TOKEN=hf_...
# Ollama (local models)
# OLLAMA_BASE_URL=http://localhost:11434
Integration with Datums
Provider Datum Example
[env]
# Required: Must be present in .env file
required = ["OPENROUTER_API_KEY"]
# Optional: Default values for non-secret configuration
defaults = { OPENROUTER_API_BASE = "https://openrouter.ai/api/v1" }
Validation in Python
import b00t_pyverse
import os
# Ensure direnv loaded the environment
assert os.getenv('OPENROUTER_API_KEY'), "Run 'direnv allow' first!"
# Validate via datum system
validation = b00t_pyverse.check_provider_env("openrouter", "~/.dotfiles/_b00t_")
if validation["available"]:
print("✅ OpenRouter enviro
Установить direnv-pattern в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditBashFAQ
Что делает скилл direnv-pattern?
Implements the b00t environment management pattern: direnv → .envrc → dotenv → .env where datums specify WHICH environment variables are required and .env contains the actual secret VALUES. Ensures automatic environment loading per-project.
Как установить скилл direnv-pattern?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл direnv-pattern запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic