A belt is a git repository (or local folder) that xxToolbelt clones and syncs alongside your core scripts. This guide covers everything needed to publish a belt others can add with a single xxtb -a command.
my-toolbelt/
├── bash/
│ └── xxhello.sh
└── python/
├── xxfetch.py
└── requirements.txt
Rules:
- Language folders sit at the repo root — no nesting.
- Every script must start with
xxto avoid clashing with system commands. - Files starting with
_are libraries — not synced to~/.local/bin. - Only executables are synced —
chmod +xyour scripts.
Any language in XXTOOLBELT_SCRIPTS_WHITELIST works. The whitelist contains:
py sh erl hrl exs java rs ps1 pwsh rb lua cpp c pl groovy d go js php r cs ts janet zig v
The shebang is what actually matters — if your runtime can be invoked from a shebang, it works.
#!/usr/bin/env bash#!/usr/bin/env python3#!/usr/bin/env -S bash -c 'exec "$(dirname "$(realpath "$0")")"/.venv/bin/python3 "$0" "$@"'Resolves the real script path (following symlinks) and uses the .venv next to it.
#!/usr/bin/env -S bash -c 'exec "$HOME/.xxtoolbelt/.venv/bin/python3" "$0" "$@"'See python-venv.md for when to choose shared vs per-belt.
#!/usr/bin/env node#!/usr/bin/env ruby#!/usr/bin/env gorunDrop a requirements.txt in your python/ folder. xxToolbelt creates a venv and installs it automatically on first sync.
Default (per-belt, isolated):
No extra files needed — a .venv is created inside python/.
Opt-in shared venv:
Add an empty .shared-venv marker file:
touch python/.shared-venvAll belts that opt in share ~/.xxtoolbelt/.venv. Use this when your deps overlap with other belts and you want to save disk/RAM. See python-venv.md for the full tradeoff.
Same rule as core scripts — name the file xxscript.private.ext and it is gitignored but synced with the clean name xxscript.
xxtb -a mybelt git@github.com:you/my-toolbelt.gitOr a local folder (no cloning, changes reflect immediately):
xxtb -a mybelt /path/to/my-toolbeltxxtb --remove-belt mybelt # removes symlinks, unregisters; folder NOT deleted
xxtb -a mybelt git@github.com:... # clone and registerEdit .belts directly — change the URL to an absolute path and re-sync:
# ~/.xxtoolbelt/.belts
mybelt|/absolute/path/to/my-toolbeltxxtb -s- Language folders at repo root
- All scripts named
xx* - All scripts are executable (
chmod +x) - Library files named
_* -
requirements.txtpresent if Python deps are needed -
.shared-venvmarker added if opting into shared venv - Shebangs tested standalone before registering