/tools-plugin:hf-downloadsfrom tools-plugin
Downloads Hugging Face models to a large disk without filling root, handles gated repo auth, and avoids ENOSPC errors from xet cache. Use when downloading HF models or encountering disk-full/401 errors.
Ships in tools-plugin. 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.
Read when SKILL.md points to them.
Download Hugging Face models to a big disk without filling root, authenticate against gated repos, and verify transfers — the failure modes that make multi-GB hf download runs abort or 401.
Scoped to huggingface_hub / hf. For disk-full recovery in general — reclaiming space, hunting what filled the disk — use macos-plugin:macos-disk-usage instead.
--local-dir Does Not Cover Transfer State--local-dir only controls where the final file lands. HF still writes intermediate transfer state — the hub manifest and, critically, xet transfer chunks — to ~/.cache/huggingface/{hub,xet} regardless.
hf download <repo> <file> --local-dir /big/disk/staging
The <file> argument is required in practice, not optional: hf download <repo> with no file downloads the entire repo, including any demo/, examples/, or obsolete/ directories it carries — there is no listing or confirmation step first. To see what's in a repo before downloading, use the listing recipe below rather than dropping the file argument.
The final file lands on /big/disk/, but the xet chunks stage under ~/.cache/huggingface/xet/. Xet is HF's newer transfer protocol: it stages compressed blocks under ~/.cache while reconstructing the file, and those staged blocks are roughly file-sized. On a small root disk the symptom is:
OSError: I/O error: IO Error: No space left on device (os error 28)
Reaching for a bare hf download <repo> to see what a repo contains fetches the whole thing instead — there is no listing subcommand. Use one of these instead:
# List files without downloading anything
python3 -c "from huggingface_hub import HfApi; print('\n'.join(HfApi().list_repo_files('<repo>')))"
# Download only a subset by glob, skipping demo/examples/obsolete directories
hf download <repo> --include 'model.safetensors' --include '*.json' --local-dir /big/disk/staging
--include / --exclude accept glob patterns and compose (--exclude 'demo/*' --exclude 'obsolete/*' to keep everything else). Prefer naming the files you want over excluding the ones you don't — the file argument stays load-bearing either way.
HF_HOME Is the UmbrellaSetting HF_HOME relocates both HF_HUB_CACHE ($HF_HOME/hub) and HF_XET_CACHE ($HF_HOME/xet) onto the same disk as the destination:
HF_HOME=/big/disk/hf-cache hf download <repo> <file> --local-dir /big/disk/staging
HF_HOME is a path, not a secret, so persist it by exporting in .zshenv/.zshrc, a mise [env] block, or a per-project .envrc (direnv). On a machine whose root is small:
export HF_HOME=/mnt/big-disk/hf-cache
hf download preserves the repo's directory structure under --local-dir, which is rarely what you want at the destination. Stage first, then move only the file:
mkdir -p /big/disk/staging /big/disk/hf-cache
HF_HOME=/big/disk/hf-cache hf download <repo> <path/in/repo> --local-dir /big/disk/staging
mv /big/disk/staging/<path/in/repo> /destination/
rm -rf /big/disk/staging
Never stage on /tmp. /tmp is sometimes tmpfs (RAM-backed), and on installs that put / on a small SSD it fills root fast. Always stage on a disk you've verified with df -h. The Claude Code harness also writes Bash output files to /tmp/claude-<uid>/, so a full /tmp stops Bash entirely.
HF_HOMEhf auth login writes the token to the fixed path ~/.cache/huggingface/token. But when HF_HOME is set, the SDK and CLI read their token from $HF_HOME/token instead. The two paths diverge silently: every gated download under HF_HOME=… 401s with GatedRepoError, even though hf auth whoami works fine (it reads ~/.cache/huggingface/token).
Signature of this mismatch: model_info() calls succeed (metadata is public), LICENSE.md fetches return 200, but *.safetensors fetches under the same auth return 401.
Two fixes — prefer HF_TOKEN scoped to one command for ephemeral use, copy the file for persistent setups:
# Ephemeral: HF_TOKEN is read directly, bypassing the file-location lookup.
# Set it on the one command rather than exporting it into the shell.
export HF_HOME=/big/disk/hf-cache
HF_TOKEN="$(cat ~/.cache/huggingface/token)" hf download <repo> <file> --local-dir /big/disk/staging
# Persistent: copy the token into the HF_HOME location after login
cp ~/.cache/huggingface/token "$HF_HOME/token"
All three must be true to download a gated file:
Diagnostic page: https://huggingface.co/settings/gated-repos lists every gated repo the logged-in account has touched, with status (Accepted / Pending / Rejected). If the repo isn't listed, the "Agree" click landed on the wrong account. gated: auto in the API just means the gate auto-approves on click — it does not mean the gate is approved for you.
api.model_info(<gated-repo>) is not a reliable access probe — it returns metadata regardless of whether the token can download the actual files. To check real download access, HEAD the file URL with the token (see REFERENCE.md for the script). If the gating page shows Accepted but the HEAD returns 401/403, the token is stale: regenerate at https://huggingface.co/settings/tokens, hf auth login with the new token, and copy it to $HF_HOME/token if HF_HOME is set.
For very large files, HEAD-check the download URL before committing (see REFERENCE.md for the script). Then confirm the destination disk's free space is at least 2× that (staging + final), or 1× if HF_HOME is on the destination disk itself.
Multi-GB downloads should run via Bash run_in_background: true. The harness notifies on completion — do not poll. After completion, move staged files into place, remove the staging dir, and verify sizes against the HEAD-reported Content-Length:
stat -c '%s' /destination/<file>
hf download exiting with code 1 while the .safetensors files are on disk at full size usually means the post-download cache cleanup ran out of root disk, not that the transfer failed. Verify file sizes before re-downloading.
| Context | Command |
|---|---|
| Redirect all cache to the big disk | HF_HOME=/big/disk/hf-cache hf download <repo> <file> --local-dir /big/disk/staging |
| Bypass token-location lookup | HF_TOKEN="$(cat ~/.cache/huggingface/token)" hf download <repo> <file> ... |
| Verify final size vs Content-Length | stat -c '%s' /destination/<file> |
| Confirm staging disk has room | df -h /big/disk |
For the gated-access HEAD probe and the pre-download size-check scripts, see REFERENCE.md.
macos-plugin:macos-disk-usage — general disk-full forensics and space recoveryWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub laurigates/claude-plugins --plugin tools-plugin18 skills in this plugin
/apptainerApptainer: run OCI images as rootless batch jobs with --nv GPU passthrough and digest-pinned SIFs. Use when running a CUDA tool without Docker, podman lacks GPU support, or a pull fills root./binary-analysisBinary analysis: strings, binwalk, hexdump, xxd, file, objdump. Use when identifying unknown files, extracting strings, hunting credentials, or entropy analysis./cli-smoke-recipesCLI smoke recipes: expose pure-function modules via subcommands with a bulk-smoke justfile recipe. Use when designing data-transform modules or authoring smoke tests./d2-diagramsGenerate diagrams from text using D2 with automatic layouts and themes. Use when creating architecture diagrams, flowcharts, decision trees, sequence flows, or ERDs./deps-installDeps install: auto-detect package manager (uv, bun, npm, yarn, pnpm, cargo, go) and run the right install. Use when installing deps or syncing lockfiles./fd-file-findingfd fast file finding: smart defaults, gitignore-aware, parallel. Use when searching for files by name, extension, or pattern across directories.Other plugins' skills for the same job