/xmake-skills:xmake-addon-developmentfrom xmake-skills
Guides writing Xmake addons: manifest layout, payload directories, @self references, shipping packages, and publishing to xmake-repo.
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.
An addon packages xmake extensions — commands, rules, toolchains, templates, modules — so
that a user installs them with one command instead of copying files into ~/.xmake.
For using one, see the xmake-addons skill.
my-addon/
├── addon.lua # the manifest, the only required file
├── README.md
├── tests/test.lua # not installed
└── src/ # the payload root, @see set_sourcedir
├── plugins/hello/ # xmake hello (a new command)
├── rules/app/ # add_rules("@addon/my-addon/app")
├── toolchains/mycc/ # set_toolchains("@addon/my-addon/mycc")
├── modules/ # import("@addon.my-addon.foo") / @self
├── includes/board/ # includes("@addon/my-addon/board")
└── templates/c/foo/ # xmake create -t foo
Only the payload directories are installed, so tests, CI files and the README never land in
the user's ~/.xmake/addons/<name>/<version>/. Ship only what you actually provide.
-- addon.lua
addon("my-addon")
set_homepage("https://github.com/me/my-addon")
set_description("What this addon provides, one line.")
set_license("Apache-2.0")
set_sourcedir("src") -- omit if the payloads sit at the repo root
add_deps("serial-tools") -- other addons this one needs
The addon names itself here, so its name never depends on the repository or the package that distributes it.
@selfAn addon must never hardcode its own name — it can always ask for itself:
-- in a rule, a toolchain or a plugin of this addon
import("@self.private.board")
-- when you need the name (e.g. to bind your own toolchain to a target)
import("core.package.addon")
local addonname = assert(addon.owner(), "not in an addon!")
target:set("toolchains", "@addon/" .. addonname .. "/mycc")
A toolchain addon usually needs binaries. Carry the package recipes and let the project consume them through an includes file:
-- src/includes/packages/xmake.lua
package("my-toolchain")
set_kind("toolchain")
add_urls("https://.../$(version).tar.gz")
add_versions("1.0.0", "<sha256>")
on_install(function (package)
os.cp("*", package:installdir())
end)
package_end()
-- src/includes/board/xmake.lua
includes("../packages")
option("board", {default = "uno", description = "Set the target board."})
set_defaultplat("cross")
add_requires("my-toolchain")
The project then only writes includes("@addon/my-addon/board").
add_globalmodules(...) exposes a module under its plain name. Use it only for the
lookups xmake performs by a computed name:
addon("avr-devel")
add_globalmodules("detect.tools.find_avrdude", -- find_tool("avrdude")
"core.tools.avr_gcc") -- the tool module of a compiler
-- src/modules/core/tools/avr_gcc.lua
inherit("core.tools.gcc") -- avr-gcc is a gcc cross compiler
A global module that collides with a module of xmake or of another addon is rejected at
install time. Everything else stays namespaced (@addon.<name>.<module>).
::: tip
A finder also names the tool: shipping detect.tools.find_avr_gcc makes find_toolname()
resolve avr-gcc to avr_gcc, so the matching core.tools.avr_gcc module must exist too.
:::
xmake addon --install . # install from the working copy
xmake addon --list
xmake hello # exercise the payloads
xmake addon --remove my-addon
A tests/test.lua which installs, exercises and removes the addon is the standard shape —
it is exactly what a user does, and it runs unchanged in CI.
Addons live in addons/<first-letter>/<name>/xmake.lua, beside the C/C++ packages:
package("my-addon")
set_kind("addon")
set_homepage("https://github.com/me/my-addon")
set_description("What this addon provides, one line.")
set_license("Apache-2.0")
add_urls("https://github.com/me/my-addon/archive/refs/tags/$(version).tar.gz",
"https://github.com/me/my-addon.git")
add_versions("v1.0.0", "<sha256>")
add_deps("serial-tools", {kind = "addon"})
on_test(function (package)
assert(package:has_addon({rules = "app", toolchains = "mycc",
plugins = "hello", templates = "c/foo"}))
end)
Steps:
xmake l hash.sha256 <file> (or shasum -a 256).xmake l scripts/test_addons.lua --addon my-addon
That installs it from your local xmake-repo checkout, runs on_test, and removes it again.
add_deps is declared in both files on purpose: the recipe is what xmake reads before
downloading the sources, the manifest is what a local directory install reads. The repo test
script checks that the two agree.
addon.lua: the version comes from the package recipe.set_sourcedir is what keeps tests/ out of the install; without it everything at the
repo root that matches a payload name is installed.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
xmake, addon-development, build-system, plugin-development, xmake-addon
npx claudepluginhub xmake-io/xmake-skills --plugin xmake-skills58 skills in this plugin
/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-basicsOther plugins' skills for the same job