skill.bundled¶
Link a package’s bundled skills and agents into one or more Claude homes.
Packages that ship <pkg>/data/skills/<name>/ (and <pkg>/data/agents/<name>.md)
all need the same ~25 lines: link each into ~/.claude/skills (or several Claude
homes, e.g. a second account’s CLAUDE_CONFIG_DIR), idempotently, reporting ok /
install / conflict per asset and never overwriting something that is not ours
without force. This is that mechanism, once.
Pure standard library and self-contained on purpose: a package that keeps zero
runtime dependencies can copy this file instead of depending on skill.
>>> import tempfile, pathlib
>>> root = pathlib.Path(tempfile.mkdtemp())
>>> (root / "data/skills/demo").mkdir(parents=True)
>>> _ = (root / "data/skills/demo/SKILL.md").write_text("---\nname: demo\n---\n")
>>> home = root / "home"
>>> [r["action"] for r in install_bundled(root / "data", homes=[home])]
['install']
>>> [r["action"] for r in install_bundled(root / "data", homes=[home])]
['ok']
Functions
Every Claude Code home on this machine: |
|
|
Install a package's bundled skills and agents into each Claude home. |
- skill.bundled.claude_homes()[source]¶
Every Claude Code home on this machine:
~/.claudeand~/.claude-*.A home counts when it has a
skillsfolder.CLAUDE_CONFIG_DIR, when set, is included even if it has none yet.>>> all(isinstance(h, Path) for h in claude_homes()) True
- skill.bundled.install_bundled(source_dir, *, homes=None, force=False, dry_run=False)[source]¶
Install a package’s bundled skills and agents into each Claude home.
source_dirholdsskills/<name>/directories and/oragents/<name>.mdfiles (a package’sdatafolder).homesdefaults toclaude_homes(). Returns one row per (home, asset):{"home", "name", "action"}withactionone of"ok": already installed (a link to the source, or an identical copy);"install": installed now (or would be, underdry_run); a"method"key sayssymlinkorcopy;"conflict": something else is at that name; left alone unlessforce.
>>> install_bundled("/no/such/folder", homes=["/tmp/never-used"]) []