Hub documentation

Hugging Face AI 智能体 CLI

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Hugging Face AI 智能体 CLI

hf CLI 是将您的智能体连接到 Hugging Face Hub 及其生态系统的绝佳方式。您可以从任意编码智能体中搜索模型、管理数据集和存储桶、启动 Spaces 以及运行任务。

这是一份关于使用 CLI 的代理的快速指南。如需更详细的信息,请参阅CLI 参考文档本身。

安装 CLI

请确保已安装并更新到最新版本的 hf CLI。有关安装说明,请参阅 CLI 安装指南。

推荐的独立安装程序还会全局安装 CLI Skill,包括 Claude Code 位置,因此代理无需额外步骤即可使用。传入 --exclude-skill(在 Windows 上为 -ExcludeSkill)可跳过此步骤。

添加 CLI 技能

Skills 为您的智能体提供有效使用工具所需的上下文。独立安装程序会为您添加 CLI Skill——如果您使用 pip 或 Homebrew 安装、跳过了该步骤,或希望将其安装在单个项目中,请手动安装。有关 Skills 的更多信息,请访问 agentskills.io。

# install globally (available in all projects, works with Claude Code, Codex, Cursor,
# OpenCode, and any agent that loads skills from ~/.agents/skills)
hf skills add --global

# or install for the current project only
hf skills add

Skill 是根据您本地安装的 CLI 版本生成的,因此升级后它会过时。hf update 会刷新全局安装的 Skill——绝不会重新添加您已移除的 Skill——而 hf skills update -g 会独立刷新它。如果 Skill 缺失或过时,hf 每天会提醒一次;使用 HF_HUB_DISABLE_UPDATE_CHECK=1 可关闭该提醒。

或者,您可以通过 Claude Code 插件系统进行安装:

claude
/plugin marketplace add huggingface/skills
/plugin install hf-cli@huggingface-skills

资源

Update on GitHub