hf-cli
Hugging Face Hub CLI (`hf`) for downloading, uploading, and managing models, datasets, spaces, buckets, repos, papers, jobs, and more on the Hugging Face Hub. Use when: handling authentication; managing local cache; managing Hugging Face Buckets; running or scheduling jobs on Hugging Face infrastructure; managing Hugging Face repos; discussions and pull requests; browsing models, datasets and spaces; reading, searching, or browsing academic papers; managing collections; querying datasets; config
Security Assessment
Detected risks:
About hf-cli
The Hugging Face Hub CLI skill wraps the hf command-line tool for interacting with the Hugging Face Hub, covering models, datasets, spaces, buckets, repositories, papers, jobs, and collections. It is the successor to the deprecated huggingface-cli, and applies broadly whenever a user mentions Hugging Face or needs to download, upload, or manage AI and ML assets, or wants cloud storage for training checkpoints, data pipelines, or agent traces. Installation is a single script: curl -LsSf https://hf.co/cli/install.sh | bash -s.
The tool groups functionality into top-level commands and subcommand namespaces. Core file operations include hf download and hf upload (both accepting --type model, dataset, or space, include/exclude filters, and revisions), hf cp for copying between local paths, repos, and buckets, and hf sync for reconciling a local directory with a bucket. Authentication lives under hf auth (login, logout, switch, token, whoami, list). Storage is managed under hf buckets (create, delete, info, list, move, remove, cp, sync), and the local download cache under hf cache (list, prune, rm, verify). Additional namespaces cover hf collections and hf datasets, the latter exposing dataset cards, info, and leaderboards for comparing model benchmark scores.
Most commands accept a --format option (auto, human, agent, json, or quiet) so output can be tuned for human reading or machine parsing, which is useful when the CLI is driven by an agent. The skill notes it was generated from huggingface_hub v1.22.0 and can be regenerated with hf skills add --force. It encourages reaching for hf --help to discover the full command surface rather than memorizing every flag.
FAQ
How do I install the hf CLI?
Run curl -LsSf https://hf.co/cli/install.sh | bash -s. The hf command replaces the deprecated huggingface-cli.
How do I authenticate with the Hugging Face Hub?
Use the hf auth namespace, primarily hf auth login (via browser or a token from huggingface.co settings/tokens), plus hf auth whoami, list, switch, logout, and token.
Can I download and upload models, datasets, and spaces?
Yes. hf download REPO_ID and hf upload REPO_ID both accept --type model, dataset, or space, along with include/exclude filters and a revision.
What are Hugging Face Buckets used for?
They provide cloud storage for needs like training checkpoints, data pipelines, and agent traces, managed under hf buckets (create, list, cp, sync, remove, and more).
How do I manage the local download cache?
Use the hf cache commands: list, prune to remove detached revisions and incomplete downloads, rm to delete specific entries, and verify to check checksums.
Install hf-cli
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
huggingface/skills