AgentSkillsCN

install-tool

当需要使用某款工具、CLI 或软件包却尚未安装时,或当用户提出安装、添加新工具的需求时,这一技能便派上用场。在所有安装任务中,首选 mise 工具。

SKILL.md
--- frontmatter
name: install-tool
description: "Use when a tool, CLI, or package is needed but not installed, or when the user asks to install/add a tool. Prefers mise for all installations."
argument-hint: "[tool[@version] | package-name...]"
model: haiku
allowed-tools:
  - Bash(mise search:*)
  - Bash(mise registry:*)
  - Bash(mise ls-remote:*)
  - Bash(mise tool:*)
  - Bash(mise ls:*)
  - Bash(mise backends:*)
  - Bash(mise use --dry-run:*)
  - Bash(mise which:*)
  - Bash(which:*)
  - Bash(command -v:*)
  - Bash(chezmoi source-path:*)
  - Bash(pwd:*)
  - Bash(realpath:*)
  - Read
  - Glob
  - Grep

Install Tool

Arguments

code
$ARGUMENTS

Instructions

1. Identify the Tool

Parse the arguments for tool names and optional versions. If no version is specified, default to @latest.

2. Check If Already Installed

bash
mise which <tool> 2>/dev/null || command -v <tool> 2>/dev/null

If the tool is already available, report its location and version. Stop unless the user explicitly wants a different version.

3. Search the Mise Registry

bash
mise search <tool>
mise registry <tool>
  • mise search — fuzzy-searches the registry for matching tools
  • mise registry <tool> — shows the full backend path (e.g., core:node, aqua:jqlang/jq)

If no results, check alternate names or ask the user.

4. Choose Scope

CRITICAL: Global installs must happen in dotfiles

Before proceeding, determine if this is a global install:

  • Arguments include --global or -g
  • User explicitly asks for global install
  • Tool is general-purpose (jq, ripgrep, etc.) and no local mise.toml exists

If global install is requested:

  1. Check if we're in the chezmoi source directory:
bash
chezmoi_source=$(chezmoi source-path 2>/dev/null)
current_dir=$(pwd)
# Check if current directory is within chezmoi source directory
  1. If NOT in dotfiles (current dir not within chezmoi source-path):

    • REFUSE the install
    • Tell the user: "Global tool installs must be done from your dotfiles repository to ensure they're tracked and reproducible. Please run chezmoi cd first, then run /install-tool again."
    • Stop execution
  2. If in dotfiles:

    • Proceed with mise use --global
    • This will update home/dot_config/mise/config.toml (the chezmoi source file)
    • Remind user to apply changes: chezmoi apply ~/.config/mise/config.toml

Decision tree for project-local installs:

  • Inside a project directory with mise.toml → project-local (default)
  • No mise.toml exists → create one with mise use <tool>@<version>

5. Preview the Install

Always dry-run first:

bash
mise use --dry-run <tool>@<version>

Report what will be installed and where the config will be written.

6. Execute

bash
# Project-local (default)
mise use <tool>@<version>

# Global (only from within dotfiles)
mise use --global <tool>@<version>
# Then apply via chezmoi:
chezmoi apply ~/.config/mise/config.toml

# Pinned exact version (project-local)
mise use --pin <tool>@<version>

After global install, remind the user that the tool is now configured in their dotfiles and will be available everywhere after chezmoi apply.

7. Verify

bash
mise which <tool>
<tool> --version  # or equivalent

Confirm the tool is available and report the installed version.

When Mise Cannot Provide the Tool

If mise search and mise registry return no results:

  1. Stop and tell the user — do not fall back to brew/apt/npm/pipx
  2. Suggest alternatives:
    • Check if it's available via a different name
    • Use ubi backend: mise use ubi:owner/repo
    • Use aqua backend: mise use aqua:owner/repo
    • Use language-specific backend (see reference below)
  3. If mise truly cannot provide it, ask the user for approval before using any other installer

Mise Discovery Subcommands

CommandPurpose
mise search <name>Fuzzy-search the tool registry
mise registry <name>Show full backend path for a tool
mise registry --backend <be>List all tools for a specific backend
mise ls-remote <tool>List available versions for a tool
mise ls-remote <tool>@<prefix>Filter versions by prefix (e.g., node@20)
mise tool <name>Show info: backend, installed/active versions, config source
mise lsList all installed and active tool versions
mise backends lsList all available backends

Mise Backends Reference

BackendPrefixInstalls fromExample
corecore:Built-in support (node, python, go, etc.)mise use node@22
aquaaqua:aqua registry — GitHub releasesmise use aqua:jqlang/jq
asdfasdf:asdf plugin ecosystemmise use asdf:mise-plugins/mise-poetry
cargocargo:Rust crates (crates.io)mise use cargo:ripgrep
gogo:Go modulesmise use go:golang.org/x/tools/gopls
npmnpm:npm packagesmise use npm:prettier
pipxpipx:Python packages (isolated envs)mise use pipx:black
gemgem:Ruby gemsmise use gem:rubocop
ubiubi:GitHub releases (universal)mise use ubi:BurntSushi/ripgrep
vfoxvfox:vfox plugin ecosystemmise use vfox:version-fox/vfox-node
condaconda:Conda/mamba packagesmise use conda:scipy
dotnetdotnet:.NET toolsmise use dotnet:fantomas
spmspm:Swift packagesmise use spm:nicklockwood/SwiftFormat
httphttp:Direct URL downloadmise use http:https://example.com/tool.tar.gz

Backend Selection Guide

  1. Check mise search first — most tools have a default backend
  2. Core for major languages (node, python, ruby, go, java, etc.)
  3. Aqua for most CLI tools distributed as GitHub releases
  4. npm/pipx/cargo/go/gem for language-ecosystem packages
  5. ubi as a fallback for any GitHub release not in aqua

Examples

code
/install-tool jq                      → search, preview, install jq
/install-tool node@22                 → install Node.js 22.x
/install-tool --global ripgrep        → install ripgrep globally
/install-tool terraform jq go         → install multiple tools
/install-tool cargo:stylua            → install via cargo backend
/install-tool ubi:BurntSushi/ripgrep  → install via ubi backend