hugging-face-tool-builder by huggingface/skills
npx skills add https://github.com/huggingface/skills --skill hugging-face-tool-builder你现在的目标是创建可重用的命令行脚本和实用工具,用于使用 Hugging Face API,允许在有用的情况下进行链式调用、管道传输和中间处理。你可以直接访问 API,也可以使用 hf 命令行工具。模型和数据集卡片可以直接从仓库访问。
请确保遵循以下规则:
--help 命令行参数来描述其输入和输出HF_TOKEN 环境变量作为 Authorization 请求头。例如:curl -H "Authorization: Bearer ${HF_TOKEN}" https://huggingface.co/api/。这为数据访问提供了更高的速率限制和适当的授权。在有疑问或需要澄清的地方,请务必确认用户的偏好。
以下路径相对于此技能目录。
参考示例:
references/hf_model_papers_auth.sh — 自动使用 HF_TOKEN 并链式执行 trending → 模型元数据 → 模型卡片解析(带后备方案);它演示了多步骤 API 使用以及对受保护/私有内容的授权管理。广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
references/find_models_by_paper.sh — 通过 --token 可选地使用 HF_TOKEN,进行一致的认证搜索,并在 arXiv 前缀搜索范围过窄时提供重试路径;它展示了稳健的查询策略和清晰的面向用户的帮助信息。references/hf_model_card_frontmatter.sh — 使用 hf CLI 下载模型卡片,提取 YAML 前言,并输出 NDJSON 摘要(许可证、管道标签、标签、受保护提示标志)以便于过滤。基础示例(极其简单,逻辑最少,使用 HF_TOKEN 请求头输出原始 JSON):
references/baseline_hf_api.sh — bashreferences/baseline_hf_api.py — pythonreferences/baseline_hf_api.tsx — typescript 可执行文件可组合实用工具(stdin → NDJSON):
references/hf_enrich_models.sh — 从 stdin 读取模型 ID,获取每个 ID 的元数据,为流式管道输出每行一个 JSON 对象。通过管道实现组合性(兼容 shell 的 JSON 输出):
references/baseline_hf_api.sh 25 | jq -r '.[].id' | references/hf_enrich_models.sh | jq -s 'sort_by(.downloads) | reverse | .[:10]'references/baseline_hf_api.sh 50 | jq '[.[] | {id, downloads}] | sort_by(.downloads) | reverse | .[:10]'printf '%s\n' openai/gpt-oss-120b meta-llama/Meta-Llama-3.1-8B | references/hf_model_card_frontmatter.sh | jq -s 'map({id, license, has_extra_gated_prompt})'以下是 https://huggingface.co 上可用的主要 API 端点
/api/datasets
/api/models
/api/spaces
/api/collections
/api/daily_papers
/api/notifications
/api/settings
/api/whoami-v2
/api/trending
/oauth/userinfo
API 使用 OpenAPI 标准在 https://huggingface.co/.well-known/openapi.json 进行了文档化。
重要: 不要尝试 直接读取 https://huggingface.co/.well-known/openapi.json,因为它太大而无法处理。
重要: 使用 jq 查询和提取相关部分。例如,
获取所有 160 个端点的命令
curl -s "https://huggingface.co/.well-known/openapi.json" | jq '.paths | keys | sort'
模型搜索端点详情
curl -s "https://huggingface.co/.well-known/openapi.json" | jq '.paths["/api/models"]'
你也可以查询端点以查看数据的结构。这样做时,请将结果限制在较小的数量,以便于处理,但仍具有代表性。
hf 命令行工具让你可以进一步访问 Hugging Face 仓库内容和基础设施。
❯ hf --help
Usage: hf [OPTIONS] COMMAND [ARGS]...
Hugging Face Hub CLI
Options:
--help Show this message and exit.
Commands:
auth Manage authentication (login, logout, etc.).
cache Manage local cache directory.
download Download files from the Hub.
endpoints Manage Hugging Face Inference Endpoints.
env Print information about the environment.
jobs Run and manage Jobs on the Hub.
repo Manage repos on the Hub.
repo-files Manage files in a repo on the Hub.
upload Upload a file or a folder to the Hub.
upload-large-folder Upload a large folder to the Hub.
version Print information about the hf version.
hf CLI 命令已取代现已弃用的 huggingface_hub CLI 命令。
每周安装量
225
仓库
GitHub 星标数
9.9K
首次出现
2026年1月20日
安全审计
已安装于
opencode191
gemini-cli187
codex186
github-copilot175
claude-code173
cursor171
Your purpose is now is to create reusable command line scripts and utilities for using the Hugging Face API, allowing chaining, piping and intermediate processing where helpful. You can access the API directly, as well as use the hf command line tool. Model and Dataset cards can be accessed from repositories directly.
Make sure to follow these rules:
--help command line argument to describe their inputs and outputsHF_TOKEN environment variable as an Authorization header. For example: curl -H "Authorization: Bearer ${HF_TOKEN}" https://huggingface.co/api/. This provides higher rate limits and appropriate authorization for data access.Be sure to confirm User preferences where there are questions or clarifications needed.
Paths below are relative to this skill directory.
Reference examples:
references/hf_model_papers_auth.sh — uses HF_TOKEN automatically and chains trending → model metadata → model card parsing with fallbacks; it demonstrates multi-step API usage plus auth hygiene for gated/private content.references/find_models_by_paper.sh — optional HF_TOKEN usage via --token, consistent authenticated search, and a retry path when arXiv-prefixed searches are too narrow; it shows resilient query strategy and clear user-facing help.references/hf_model_card_frontmatter.sh — uses the hf CLI to download model cards, extracts YAML frontmatter, and emits NDJSON summaries (license, pipeline tag, tags, gated prompt flag) for easy filtering.Baseline examples (ultra-simple, minimal logic, raw JSON output with HF_TOKEN header):
references/baseline_hf_api.sh — bashreferences/baseline_hf_api.py — pythonreferences/baseline_hf_api.tsx — typescript executableComposable utility (stdin → NDJSON):
references/hf_enrich_models.sh — reads model IDs from stdin, fetches metadata per ID, emits one JSON object per line for streaming pipelines.Composability through piping (shell-friendly JSON output):
references/baseline_hf_api.sh 25 | jq -r '.[].id' | references/hf_enrich_models.sh | jq -s 'sort_by(.downloads) | reverse | .[:10]'references/baseline_hf_api.sh 50 | jq '[.[] | {id, downloads}] | sort_by(.downloads) | reverse | .[:10]'printf '%s\n' openai/gpt-oss-120b meta-llama/Meta-Llama-3.1-8B | references/hf_model_card_frontmatter.sh | jq -s 'map({id, license, has_extra_gated_prompt})'The following are the main API endpoints available at https://huggingface.co
/api/datasets
/api/models
/api/spaces
/api/collections
/api/daily_papers
/api/notifications
/api/settings
/api/whoami-v2
/api/trending
/oauth/userinfo
The API is documented with the OpenAPI standard at https://huggingface.co/.well-known/openapi.json.
IMPORTANT: DO NOT ATTEMPT to read https://huggingface.co/.well-known/openapi.json directly as it is too large to process.
IMPORTANT Use jq to query and extract relevant parts. For example,
Command to Get All 160 Endpoints
curl -s "https://huggingface.co/.well-known/openapi.json" | jq '.paths | keys | sort'
Model Search Endpoint Details
curl -s "https://huggingface.co/.well-known/openapi.json" | jq '.paths["/api/models"]'
You can also query endpoints to see the shape of the data. When doing so constrain results to low numbers to make them easy to process, yet representative.
The hf command line tool gives you further access to Hugging Face repository content and infrastructure.
❯ hf --help
Usage: hf [OPTIONS] COMMAND [ARGS]...
Hugging Face Hub CLI
Options:
--help Show this message and exit.
Commands:
auth Manage authentication (login, logout, etc.).
cache Manage local cache directory.
download Download files from the Hub.
endpoints Manage Hugging Face Inference Endpoints.
env Print information about the environment.
jobs Run and manage Jobs on the Hub.
repo Manage repos on the Hub.
repo-files Manage files in a repo on the Hub.
upload Upload a file or a folder to the Hub.
upload-large-folder Upload a large folder to the Hub.
version Print information about the hf version.
The hf CLI command has replaced the now deprecated huggingface_hub CLI command.
Weekly Installs
225
Repository
GitHub Stars
9.9K
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketWarnSnykWarn
Installed on
opencode191
gemini-cli187
codex186
github-copilot175
claude-code173
cursor171
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
60,400 周安装