Claude-skill-registry-data mise-configuration
Configure environment via mise [env] SSoT. TRIGGERS - mise env, mise.toml, environment variables, centralize config, Python venv, mise templates.
git clone https://github.com/majiayu000/claude-skill-registry-data
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry-data "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/mise-configuration" ~/.claude/skills/majiayu000-claude-skill-registry-data-mise-configuration && rm -rf "$T"
data/mise-configuration/SKILL.mdmise Configuration as Single Source of Truth
Use mise
[env] as centralized configuration with backward-compatible defaults.
Core Principle
Define all configurable values in
.mise.toml [env] section. Scripts read via environment variables with fallback defaults. Same code path works WITH or WITHOUT mise installed.
Key insight: mise auto-loads
[env] values when shell has mise activate configured. Scripts using os.environ.get("VAR", "default") pattern work identically whether mise is present or not.
Quick Reference
Language Patterns
| Language | Pattern | Notes |
|---|---|---|
| Python | | Returns string, cast if int |
| Bash | | Standard POSIX expansion |
| JavaScript | | Falsy check, watch for "0" |
| Go | with default | Empty string if unset |
| Rust | | Returns Result<String> |
Special Directives
| Directive | Purpose | Example |
|---|---|---|
| Load from .env files | |
| Extend PATH | |
| Execute bash scripts | |
| Auto-create Python venv | |
Python Venv Auto-Creation (Critical)
Auto-create and activate Python virtual environments:
[env] _.python.venv = { path = ".venv", create = true }
This pattern is used in ALL projects. When entering the directory with mise activated:
- Creates
if it doesn't exist.venv - Activates the venv automatically
- Works with
for fast venv creationuv
Alternative via [settings]:
[settings] python.uv_venv_auto = true
Special Directives
Load from .env Files (_.file
)
_.file[env] # Single file _.file = ".env" # Multiple files with options _.file = [ ".env", { path = ".env.secrets", redact = true } ]
Extend PATH (_.path
)
_.path[env] _.path = [ "{{config_root}}/bin", "{{config_root}}/node_modules/.bin", "scripts" ]
Source Bash Scripts (_.source
)
_.source[env] _.source = "./scripts/env.sh" _.source = { path = ".secrets.sh", redact = true }
Lazy Evaluation (tools = true
)
tools = trueBy default, env vars resolve BEFORE tools install. Use
tools = true to access tool-generated paths:
[env] # Access PATH after tools are set up GEM_BIN = { value = "{{env.GEM_HOME}}/bin", tools = true } # Load .env files after tool setup _.file = { path = ".env", tools = true }
Template Syntax (Tera)
mise uses Tera templating. Delimiters:
{{ }} expressions, {% %} statements, {# #} comments.
Built-in Variables
| Variable | Description |
|---|---|
| Directory containing .mise.toml |
| Current working directory |
| Environment variable |
| Path to mise binary |
| mise process ID |
| XDG cache directory |
| XDG config directory |
| XDG data directory |
Functions
[env] # Get env var with fallback NODE_VER = "{{ get_env(name='NODE_VERSION', default='20') }}" # Execute shell command TIMESTAMP = "{{ exec(command='date +%Y-%m-%d') }}" # System info ARCH = "{{ arch() }}" # x64, arm64 OS = "{{ os() }}" # linux, macos, windows CPUS = "{{ num_cpus() }}" # File operations VERSION = "{{ read_file(path='VERSION') | trim }}" HASH = "{{ hash_file(path='config.json', len=8) }}"
Filters
[env] # Case conversion SNAKE = "{{ name | snakecase }}" KEBAB = "{{ name | kebabcase }}" CAMEL = "{{ name | lowercamelcase }}" # String manipulation TRIMMED = "{{ text | trim }}" UPPER = "{{ text | upper }}" REPLACED = "{{ text | replace(from='old', to='new') }}" # Path operations ABSOLUTE = "{{ path | absolute }}" BASENAME = "{{ path | basename }}" DIRNAME = "{{ path | dirname }}"
Conditionals
[env] {% if env.DEBUG %} LOG_LEVEL = "debug" {% else %} LOG_LEVEL = "info" {% endif %}
Required & Redacted Variables
Required Variables
Enforce variable definition with helpful messages:
[env] DATABASE_URL = { required = true } API_KEY = { required = "Get from https://example.com/api-keys" }
Redacted Variables
Hide sensitive values from output:
[env] SECRET = { value = "my_secret", redact = true } _.file = { path = ".env.secrets", redact = true } # Pattern-based redactions redactions = ["*_TOKEN", "*_KEY", "PASSWORD"]
[settings] Section
[settings] experimental = true # Enable experimental features python.uv_venv_auto = true # Auto-create venv with uv
[tools] Version Pinning
Pin tool versions for reproducibility:
[tools] python = "3.11" # minimum baseline; use 3.12, 3.13 as needed node = "latest" uv = "latest" # With options rust = { version = "1.75", profile = "minimal" }
min_version: Enforce mise version compatibility:
min_version = "2024.9.5"
Implementation Steps
- Identify hardcoded values - timeouts, paths, thresholds, feature flags
- Create
- add.mise.toml
section with documented variables[env] - Add venv auto-creation -
_.python.venv = { path = ".venv", create = true } - Update scripts - use env vars with original values as defaults
- Add ADR reference - comment:
# ADR: 2025-12-08-mise-env-centralized-config - Test without mise - verify script works using defaults
- Test with mise - verify activated shell uses
values.mise.toml
GitHub Token Multi-Account Patterns (MANDATORY for Multi-Account Setups) {#github-token-multi-account-patterns}
For multi-account GitHub setups, mise
[env] provides per-directory token configuration that overrides gh CLI's global authentication.
Token Storage
Store tokens in a centralized, secure location:
mkdir -p ~/.claude/.secrets chmod 700 ~/.claude/.secrets # Create token files (one per account) gh auth login # authenticate as account gh auth token > ~/.claude/.secrets/gh-token-accountname chmod 600 ~/.claude/.secrets/gh-token-*
Per-Directory Configuration
# ~/.claude/.mise.toml (terrylica account) [env] GH_TOKEN = "{{ read_file(path=config_root ~ '/.secrets/gh-token-terrylica') | trim }}" GITHUB_TOKEN = "{{ read_file(path=config_root ~ '/.secrets/gh-token-terrylica') | trim }}" GH_ACCOUNT = "terrylica" # For human reference only
# ~/eon/.mise.toml (terrylica account - different directory) [env] GH_TOKEN = "{{ read_file(path=env.HOME ~ '/.claude/.secrets/gh-token-terrylica') | trim }}" GITHUB_TOKEN = "{{ read_file(path=env.HOME ~ '/.claude/.secrets/gh-token-terrylica') | trim }}" GH_ACCOUNT = "terrylica"
Variable Naming Convention
| Variable | Usage Context | Example |
|---|---|---|
| mise [env], Doppler, verification tasks | , shell scripts |
| npm scripts, GitHub Actions, semantic-release | , workflows |
Rule: Always set BOTH variables in mise [env] pointing to the same token file. Different tools check different variable names.
Alternative: 1Password Integration
For enhanced security with automatic token rotation:
[env] GH_TOKEN = "{{ op_read('op://Engineering/GitHub Token/credential') }}"
With caching for performance:
[env] GH_TOKEN = "{{ cache(key='gh_token', duration='1h', run='op read op://Engineering/GitHub Token/credential') }}"
Verification
/usr/bin/env bash << 'MISE_EOF' for dir in ~/.claude ~/eon ~/own ~/scripts ~/459ecs; do cd "$dir" && eval "$(mise hook-env -s bash)" && echo "$dir → $GH_ACCOUNT" done MISE_EOF
ADR Reference: GitHub Multi-Account Authentication
SSH ControlMaster Warning: If using multi-account SSH, ensure
is set for GitHub hosts inControlMaster no. Cached connections can authenticate with the wrong account. See semantic-release authentication for troubleshooting.~/.ssh/config
Anti-Patterns
| Anti-Pattern | Why | Instead |
|---|---|---|
| Forces mise dependency | Use env vars with defaults |
Secrets in | Visible in repo | Use Doppler or |
| No defaults in scripts | Breaks without mise | Always provide fallback |
| Mixing env/tools resolution | Order matters | Use for tool-dependent vars |
Task Orchestration Integration
When you detect workflow opportunities during mise configuration, prescriptively invoke the
mise-tasks skill.
Detection Triggers
- Multi-step workflows (test + build + deploy)
- Repeatable project commands (lint, format, release)
- Dependency chains (db-migrate depends on db-init)
- File-tracked builds (sources/outputs caching)
Prescriptive AI Reminder
PRESCRIPTIVE: When detecting multi-step project workflows, invoke
skill to generate appropriatemise-tasksdefinitions with dependency management.[tasks]
Example: From Environment to Tasks
Step 1: Configure environment (this skill):
[env] DATABASE_URL = "postgresql://localhost/mydb" _.python.venv = { path = ".venv", create = true }
Step 2: Define tasks (
mise-tasks skill):
[tasks.test] depends = ["lint"] run = "pytest tests/" [tasks.deploy] depends = ["test", "build"] run = "deploy.sh"
Tasks automatically inherit
[env] values.
Additional Resources
For complete code patterns and examples, see: references/patterns.md
For task orchestration, see:
skill - Dependencies, arguments, file tracking, watch modemise-tasks
ADR Reference: When implementing mise configuration, create an ADR at
docs/adr/YYYY-MM-DD-mise-env-centralized-config.md in your project.