Get the FREE Ultimate OpenClaw Setup Guide →

configuring

Scanned
npx machina-cli add skill oaustegard/claude-skills/configuring --openclaw
Files (1)
SKILL.md
3.3 KB

Configuring

Unified configuration management across AI coding environments. Load environment variables, secrets, and other opinionated configuration setups from any AI coding platform.

Quick Start

import sys
sys.path.insert(0, '/path/to/claude-skills')  # or wherever skills are installed
from configuring import get_env, detect_environment

# Get a variable (searches all sources automatically)
token = get_env("TURSO_TOKEN", required=True)

# With default
port = get_env("PORT", default="8080")

# What environment are we in?
env = detect_environment()  # "claude.ai", "claude-code-desktop", "codex", "jules", etc.

Supported Environments

EnvironmentConfig Sources
Claude.ai Projects/mnt/project/*.env, /mnt/project/*-token.txt
Claude Code~/.claude/settings.json (env block), .claude/settings.json
OpenAI Codex~/.codex/config.toml, setup script → ~/.bashrc, shell_snapshots/*.sh
JulesEnvironment settings UI, .env in repo
Universalos.environ, .env, .env.local

API Reference

# Core
get_env(key, default=None, *, required=False, validator=None) -> str | None
load_env(path) -> dict[str, str]           # Load specific file
load_all(force_reload=False) -> dict       # Load all sources

# Utilities
detect_environment() -> str                 # Current platform
mask_secret(value, show_chars=4) -> str    # Safe logging
debug_info() -> dict                        # Troubleshooting
get_loaded_sources() -> list[str]          # What was checked

Credential File Formats

.env files (KEY=value):

TURSO_TOKEN=eyJhbGciOiJFZERTQSI...
EMBEDDING_API_KEY=sk-svcacct-...

Single-value files (*-token.txt, *-key.txt):

eyJhbGciOiJFZERTQSI...

Filename becomes key: turso-token.txtTURSO_TOKEN

Claude Code settings.json:

{
  "env": {
    "TURSO_TOKEN": "eyJhbGciOiJFZERTQSI..."
  }
}

Priority Order

Later sources override earlier:

  1. OS environment variables
  2. Platform-specific sources (detected automatically)
  3. .env files in cwd
  4. OS environment variables (again - explicit exports always win)

Debugging

import sys
sys.path.insert(0, '/path/to/claude-skills')
from configuring import debug_info
print(debug_info())
# {'environment': 'claude.ai', 'sources': ['os.environ', 'claude.ai:/mnt/project/'], ...}

CLI:

cd /path/to/claude-skills/configuring
python scripts/getting_env.py                    # Show debug info
python scripts/getting_env.py TURSO_TOKEN        # Get specific key

Migration from api-credentials / getting-env

Replace:

# Old (api-credentials)
from credentials import get_anthropic_api_key
key = get_anthropic_api_key()

# Old (getting-env)
from getting_env import get_env
key = get_env("ANTHROPIC_API_KEY")

# New (configuring)
import sys
sys.path.insert(0, '/path/to/claude-skills')
from configuring import get_env
key = get_env("ANTHROPIC_API_KEY", required=True)

Source

git clone https://github.com/oaustegard/claude-skills/blob/main/configuring/SKILL.mdView on GitHub

Overview

Configuring provides unified configuration management across AI coding environments. It loads environment variables, secrets, and other configuration from Claude.ai, Claude Code, OpenAI Codex, Jules, and standard .env files, enabling consistent credential handling across tools.

How This Skill Works

Expose core APIs: get_env, load_env, load_all, detect_environment, plus utilities like mask_secret and debug_info. It discovers sources from OS environment, platform-specific stores (Claude.ai, Claude Code, Codex, Jules), and .env files, then merges them in priority order so later sources can override earlier values.

When to Use It

  • Configuring across Claude.ai Projects, Claude Code, Codex, Jules, and Universal environments.
  • Load and merge secrets and config from multiple sources (env files, token files, and settings.json).
  • Detect the current platform to customize behavior with detect_environment().
  • Debug and audit loaded credentials with debug_info() and get_loaded_sources().
  • Migrate from old api-credentials or getting-env to the new configuring API.

Quick Start

  1. Step 1: Add the claude-skills path and import get_env and detect_environment.
  2. Step 2: Retrieve credentials, e.g., token = get_env("TURSO_TOKEN", required=True).
  3. Step 3: Detect the platform with detect_environment() and adjust behavior.

Best Practices

  • Use get_env with required=True for sensitive keys like TURSO_TOKEN.
  • Keep secrets in their platform sources (env blocks, *.txt tokens, or settings.json) to avoid hard-coding.
  • Place a .env in the project root or cwd to ensure reliable loading.
  • Use mask_secret when logging sensitive values.
  • Run debug_info() and get_loaded_sources() during development and CI to verify sources.

Example Use Cases

  • token = get_env("TURSO_TOKEN", required=True)
  • port = get_env("PORT", default="8080")
  • env = detect_environment() # e.g., 'claude.ai', 'codex', 'jules'
  • Claude Code settings.json contains { "env": { "TURSO_TOKEN": "..." } }
  • Use load_all() to preload all sources before starting the app.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers