Skip to content
mise-configuration logo

mise Configuration as Single Source of Truth

mise-configuration

Configure environment variables and project settings using mise [env] as the single source of truth. Use whenever the user needs to set up.

terrylica/cc-skills0installs75stars

SKILL.md

Full skill instructions

mise Configuration as Single Source of Truth

Use mise [env] as centralized configuration with backward-compatible defaults.

Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.

When to Use This Skill

Use this skill when:

  • Centralizing environment variables in mise.toml
  • Setting up Python venv auto-creation with mise
  • Implementing hub-spoke configuration for monorepos
  • Creating backward-compatible environment patterns

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

LanguagePatternNotes
Pythonos.environ.get("VAR", "default")Returns string, cast if int
Bash${VAR:-default}Standard POSIX expansion
JavaScriptprocess.env.VAR || "default"Falsy check, watch for "0"
Goos.Getenv("VAR") with defaultEmpty string if unset
Ruststd::env::var("VAR").unwrap_or()Returns Result<String>

Special Directives

DirectivePurposeExample
_.fileLoad from .env files_.file = ".env"
_.pathExtend PATH_.path = ["bin", "node_modules/​.bin"]
_.sourceExecute bash scripts_.source = "./​scripts/​env.sh"
_.python.venvAuto-create Python venv_.python.venv = { path = ".venv", create = true }

For detailed directive examples with options (redact, tools, multi-file): Code Patterns

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:

  1. Creates .venv if it doesn't exist
  2. Activates the venv automatically
  3. Works with uv for fast venv creation

Alternative via [settings]:

[settings]
python.uv_venv_auto = true

Hub-Spoke Architecture (CRITICAL)

Keep root mise.toml lean by delegating domain-specific tasks to subfolder mise.toml files. Applies to monorepos, ML/​research projects, infrastructure, and data pipelines.

Key rules:

  • Hub owns [tools] and orchestration tasks
  • Spokes inherit hub's [tools] automatically
  • Spoke [env] extends hub's [env] (can override per domain)
  • .mise.local.toml applies at directory level (secrets stay local)

Full guide with directory structures, examples, and anti-patterns: Hub-Spoke Architecture

Wiki Reference: Pattern-mise-Configuration

Monorepo Workspace Pattern

For Python monorepos using uv workspaces, the venv is created at the workspace root. Dev dependencies should be hoisted to root pyproject.toml using [dependency-groups] (PEP 735).

Full guide: Monorepo Workspace Pattern

Template Syntax (Tera)

mise uses Tera templating. Delimiters: {{ }} expressions, {% %} statements, {# #} comments.

Built-in Variables

VariableDescription
{{config_root}}Directory containing .mise.toml
{{cwd}}Current working directory
{{env.VAR}}Environment variable
{{mise_bin}}Path to mise binary
{{mise_pid}}mise process ID
{{xdg_cache_home}}XDG cache directory
{{xdg_config_home}}XDG config directory
{{xdg_data_home}}XDG data directory

For functions (get_env, exec, arch, read_file, hash_file), filters (snakecase, trim, absolute), and conditionals: Code Patterns - Template Syntax

Required & Redacted Variables

[env]
# Required - fails if not set
DATABASE_URL = { required = true }
API_KEY = { required = "Get from https://example.com/​api-keys" }

# Redacted - hides from output
SECRET = { value = "my_secret", redact = true }
_.file = { path = ".env.secrets", redact = true }

# Pattern-based redactions
redactions = ["*_TOKEN", "*_KEY", "PASSWORD"]

For combined patterns and detailed examples: Code Patterns - Required & Redacted

Lazy Evaluation (tools = true)

By default, env vars resolve BEFORE tools install. Use tools = true to access tool-generated paths:

[env]
GEM_BIN = { value = "{{env.GEM_HOME}}/​bin", tools = true }
_.file = { path = ".env", tools = true }

[settings] and [tools]

[settings]
experimental = true
python.uv_venv_auto = true

[tools]
python = "<version>"
node = "latest"
uv = "latest"
rust = { version = "<version>", profile = "minimal" }

# SSoT-OK: mise min_version directive, not a package version
min_version = "2024.9.5"

For full settings reference and version pinning options: Code Patterns - Settings & Tools

Implementation Steps

  1. Identify hardcoded values - timeouts, paths, thresholds, feature flags
  2. Create .mise.toml - add [env] section with documented variables
  3. Add venv auto-creation - _.python.venv = { path = ".venv", create = true }
  4. Update scripts - use env vars with original values as defaults
  5. Add ADR reference - comment: # ADR: 2025-12-08-mise-env-centralized-config
  6. Test without mise - verify script works using defaults
  7. Test with mise - verify activated shell uses .mise.toml values

GitHub Token Multi-Account Patterns {#github-token-multi-account-patterns}

For multi-account GitHub setups, mise [env] provides per-directory token configuration that overrides gh CLI's global authentication.

Rule: Always set BOTH GH_TOKEN and GITHUB_TOKEN pointing to the same token file.

VariableUsage Context
GH_TOKENmise [env], Doppler, verification tasks
GITHUB_TOKENnpm scripts, GitHub Actions, semantic-release

Full guide with templates, verification, and 1Password integration: GitHub Token Patterns

Anti-Patterns

Anti-PatternWhyInstead
mise exec -- script.pyForces mise dependencyUse env vars with defaults
Secrets in .mise.tomlVisible in repoUse Doppler or redact = true
No defaults in scriptsBreaks without miseAlways provide fallback
[env] secrets for pueue jobsPueue runs clean shell, no miseUse python-dotenv + .env file
__MISE_DIFF leaks via SSHRemote trust errorsunset __MISE_DIFF before SSH

Critical detail on non-interactive shell secrets: Anti-Patterns Guide

Task Orchestration Integration

When detecting multi-step project workflows during mise configuration, invoke the mise-tasks skill for task definitions with dependency management.

Detection triggers: multi-step workflows, repeatable commands, dependency chains, file-tracked builds.

Full guide with examples: Task Orchestration | mise-tasks skill


Additional Resources

ADR Reference: When implementing mise configuration, create an ADR at docs/​adr/​YYYY-MM-DD-mise-env-centralized-config.md in your project.


Troubleshooting

IssueCauseSolution
Env vars not loadingmise not activatedAdd mise activate to shell rc file
Venv not createdPython not installedRun mise install python
Tasks not foundWrong mise.toml locationEnsure mise.toml is in project root
PATH not updatedShims not in PATHAdd mise shims to ~/​.zshenv
.file not loading.env file missingCreate .env file or remove .file directive
Subfolder config ignoredMissing min_versionAdd min_version to subfolder mise.toml

Post-Execution Reflection

After this skill completes, check before closing:

  1. Did the command succeed? — If not, fix the instruction or error table that caused the failure.
  2. Did parameters or output change? — If the underlying tool's interface drifted, update Usage examples and Parameters table to match.
  3. Was a workaround needed? — If you had to improvise (different flags, extra steps), update this SKILL.md so the next invocation doesn't need the same workaround.

Only update if the issue is real and reproducible — not speculative.

More skills from terrylica

code-hardcode-audit logo
terrylica/cc-skills

code-hardcode-audit

Detect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.

75 152
View
doppler-workflows logo
terrylica/cc-skills

doppler-workflows

Manage credentials and secrets through Doppler for publishing and deployment workflows. Use whenever the user needs to publish Python packages.

75 0
View
sred-commit logo
terrylica/cc-skills

sred-commit

Create a git commit with SR&ED (CRA tax credit) trailers. TRIGGERS - sred commit, sred, cra commit, tax credit commit, scientific research commit.

75 0
View
log-reader logo
terrylica/cc-skills

log-reader

Read MetaTrader 5 log files. TRIGGERS - MT5 logs, Experts pane, indicator errors, compilation errors.

75 0
View
fork-intelligence logo
terrylica/cc-skills

fork-intelligence

Discover valuable GitHub fork divergence beyond stars. TRIGGERS - fork analysis, fork intelligence, find forks

75 0
View
bootstrap-monorepo logo
terrylica/cc-skills

bootstrap-monorepo

Autonomous polyglot monorepo bootstrap meta-prompt on the moon + proto + Bun stack (Nx-convergent). TRIGGERS - new monorepo, new repository, polyglot setup, scaffold repo, moon proto bootstrap, monorepo from scratch.

75 0
View
asciinema-recorder logo
terrylica/cc-skills

asciinema-recorder

Record Claude Code sessions with asciinema. TRIGGERS - record session, asciinema record, capture terminal, demo recording.

75 0
View
glossary-management logo
terrylica/cc-skills

glossary-management

Manage terminology glossary with Vale. TRIGGERS - sync terms, glossary validation, add terms, Vale vocabulary.

75 0
View
dead-code-detector logo
terrylica/cc-skills

dead-code-detector

Detect unused/unreachable code in polyglot codebases (Python, TypeScript, Rust). TRIGGERS - dead code, unused functions, unused imports

75 0
View
pre-ship-review logo
terrylica/cc-skills

pre-ship-review

Run a structured quality review before shipping code at any checkpoint such as PRs, releases, or milestones. Use whenever the user says.

75 0
View
diagnose logo
terrylica/cc-skills

diagnose

Diagnose Kokoro TTS issues. TRIGGERS - kokoro not working, tts diagnose, kokoro error, tts troubleshoot.

75 0
View
doppler-secret-validation logo
terrylica/cc-skills

doppler-secret-validation

Validate and test Doppler secrets. TRIGGERS - add to Doppler, store secret, validate token, test credentials.

75 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View