/xmake-skills:xrepo-envfrom xmake-skills
Manages virtual environments for C/C++ libraries and CLI tools using xrepo. Creates ad-hoc, project-level, or named environments akin to conda/venv for native toolchains.
Ships in xmake-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
xrepo env gives you a virtual environment for native tools and libraries. You describe a set of packages, xrepo installs them, and then sets up PATH, LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, PKG_CONFIG_PATH, and any package-specific env vars so those tools "just work" inside the env.
Think conda/venv, but for C/C++ dependencies and CLI tools (cmake, ninja, python, luajit, protoc, …), sourced from xmake-repo or any registered private repo.
There are three ways to use it, ordered from most ad-hoc to most persistent.
Pass a comma-separated package list to -b/--bind and xrepo env auto-installs and activates them.
xrepo env -b "python 3.x,luajit,cmake" shell
[python,luajit,cmake] $ python --version
Python 3.10.6
[python,luajit,cmake] $ cmake --version
cmake version 3.25.3
[python,luajit,cmake] $ xrepo env quit
$
xrepo env quit (or just exit) leaves the subshell.Skip the subshell and run a single command inside the env:
xrepo env -b "python 3.x" python script.py
xrepo env -b "cmake,ninja" cmake -B build -G Ninja
xrepo env -b "protobuf" protoc --version
xrepo env -b "llvm 18.x" clang++ hello.cpp -o hello
Great for scripting / CI — no subshell juggling.
Same syntax as add_requires:
xrepo env -b "python 3.11.x,cmake >=3.25" shell
xrepo env -b "boost" -f "regex=true" shell # package configs
xrepo env -b "llvm" -m debug shell # debug build
./xmake.lua)Drop an xmake.lua in a directory — xrepo env in that directory reads it automatically. This is the right choice when a project needs a reproducible set of tools per working tree, checked into git.
-- ./xmake.lua
add_requires("zlib 1.2.11")
add_requires("python 3.x", "luajit")
add_requires("cmake 3.27.x", "ninja")
-- optional: also load a toolchain env
set_toolchains("msvc") -- or "clang", "gcc-11", "llvm-mingw", ...
cd myproject
xrepo env shell # activates everything in ./xmake.lua
xrepo env cmake --version # one-shot
This is the xmake equivalent of a requirements.txt / environment.yml that also pins your compiler.
Register an env file globally and refer to it by name from anywhere. Use this for long-lived environments you switch between — "my embedded toolchain", "the CUDA build env", etc.
xrepo env --add /tmp/base.lua # register file as env "base"
xrepo env --list # show all registered envs
xrepo env --remove base
Registered envs live under ~/.xmake/envs/.
Example base.lua:
add_requires("python 3.11.x")
add_requires("cmake", "ninja", "llvm 18.x")
xrepo env -b base shell # interactive
xrepo env -b base python --version # one-shot
xrepo env -b base cmake -B build
xrepo env --add envs/cuda.lua cuda
xrepo env --add envs/embedded.lua embedded
xrepo env -b cuda nvcc --version
xrepo env -b embedded arm-none-eabi-gcc --version
Before activating, see the exact environment variables that would apply:
xrepo env --show luajit
xrepo env --show -b base
xrepo env --show -b "python 3.x,cmake"
Example output:
{
PATH = "/home/ruki/.xmake/packages/l/luajit/.../bin:...",
LD_LIBRARY_PATH = "/home/ruki/.xmake/packages/l/luajit/.../lib",
PKG_CONFIG_PATH = "...",
XMAKE_PROGRAM_DIR = "...",
...
}
Use this to debug "why isn't python the one I expect" — the first PATH entry wins.
xrepo env one-shot mode is perfect for CI — no shell management, no activation scripts:
# GitHub Actions example
- run: curl -fsSL https://xmake.io/shget.text | bash
- run: xrepo env -b "cmake 3.27.x,ninja,llvm 18.x" cmake -B build -G Ninja
- run: xrepo env -b "cmake 3.27.x,ninja,llvm 18.x" cmake --build build
Or commit an envs/ci.lua and reference it:
xrepo env --add envs/ci.lua ci
xrepo env -b ci bash ./scripts/build.sh
set_toolchains(...) inside the env file loads that compiler's environment too — VS vars on Windows, Xcode SDK on macOS, a cross SDK on Linux. This lets a single xrepo env shell give you both the right cmake/ninja and the right compiler.
add_requires("cmake", "ninja")
set_toolchains("msvc", {vs = "2022"})
xrepo env shell
> cl /? # MSVC on PATH, env loaded
> cmake -G Ninja ..
xrepo env -b "cmake 3.27.x" cmake ...xmake.lua with add_requires, use xrepo env shell-b <name>xrepo env -b "..." <cmd> per step, or a committed envs/ci.luaxrepo env --show -b ...xrepo env -b python 3.x shell splits python and 3.x as separate args. Always quote: -b "python 3.x". Same for comma lists: -b "cmake,ninja".xmake.lua. Re-enter the env — xrepo env reads the file at activation time; an already-running subshell won't pick up edits.which cmake and xrepo env --show; if the registered env's PATH prefix isn't there, the env failed to install that package — rerun with -vD.xrepo env --add foo.lua stores a pointer; if you move or delete foo.lua, the env breaks. Keep env files somewhere stable (e.g. inside the repo).quit vs exit. Both leave the subshell; xrepo env quit is just a friendlier alias. Nested envs are allowed — quit pops one level.xrepo-clixmake.lua build (not just tools on PATH) → xmake-packagesset_toolchains(...) → xmake-toolchainsWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub xmake-io/xmake-skills --plugin xmake-skills58 skills in this plugin
/xmake-addon-developmentUse when writing an Xmake addon — the `addon.lua` manifest, the payload layout (plugins/rules/toolchains/modules/includes/templates), `@self` references, shipping package definitions with an addon, `add_globalmodules`, testing it locally, and publishing it to xmake-repo as an `addon` kind package./xmake-addonsUse when installing or using an Xmake addon — `xmake addon --install/--list/--remove/--upgrade/--search`, declaring `add_addons(...)` in a project, and referencing addon payloads with `@addon/<name>/<rule>`, `@addon.<name>.<module>` or `@self`. For writing and publishing one, see xmake-addon-development./xmake-async-jobsUse when running parallel / async work inside xmake scripts — `async.runjobs` for parallel job execution, `async.jobgraph` (DAG) for dependency-ordered jobs, `async.jobpool` (tree structure), `core.base.scheduler` coroutine scheduling, semaphores, and `on_build_files(..., {jobgraph = true})` in rules. For running external compile jobs faster, see `xmake-build-optimization`./xmake-basicsUse when the user is starting a new Xmake project, installing Xmake, or needs the minimal xmake.lua structure. Covers installation, `xmake create`, the project layout, and the smallest valid xmake.lua./xmake-build-cacheUse when configuring or debugging xmake's local build cache (built-in, replaces ccache) or the remote compile cache service (shared across machines via `xmake service --ccache`). Covers enabling/disabling, fallbacks to external ccache, remote cache server/client setup, and cache cleaning./xmake-build-optimizationUse when a project builds slowly and you want to make it faster — parallel jobs, unity build, precompiled headers, build cache, LTO, link-time improvements, binary package cache, and profiling with `XMAKE_PROFILE=perf:*`. Covers idiomatic xmake speedups and the order to try them.Other plugins' skills for the same job