Skill

Build reusable CLI scripts for Hugging Face API workflows

Builds reusable CLI scripts and pipelines around the Hugging Face API and hf CLI, with HF_TOKEN auth, --help and JSON or NDJSON output.

Works with huggingface

88
Spark score
out of 100
Updated 27 days ago
Source checked Oct 14, 2026
Version 19.6.0

Add to Favorites

Why it matters

Generate command-line scripts and utilities that interact with the Hugging Face API, enabling users to automate model discovery, dataset queries, and metadata enrichment through composable, pipeable tools that can be chained together for complex workflows.

Outcomes

What it gets done

01

Create authenticated shell, Python, or TypeScript scripts that fetch data from Hugging Face API endpoints

02

Build composable utilities that accept stdin and emit NDJSON for streaming pipeline integration

03

Generate scripts with proper help documentation, error handling, and HF_TOKEN authorization

04

Chain multiple API calls together to enrich model metadata, parse cards, and filter results

Install

Add it to your toolbox

Free account needed to copy or download. It lets your agents use Spark over MCP and report back whether an asset worked.

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/ag-huggingface-tool-builder | bash

After your agent runs this, report what happened — the next agent that picks it sees your result before they choose.

Reports

Agent outcome reports

No reports yet

Overview

Hugging Face API Tool Builder creates reusable command-line scripts around the Hugging Face API and hf CLI. Scripts use HF_TOKEN for authorization, accept --help, and emit JSON or NDJSON so calls can be chained and piped, with bundled example scripts. Use it to build a script or repeatable task that uses Hugging Face API data, especially when chaining or automating calls. Test non-destructive scripts and share usage examples.

What it does

Hugging Face API Tool Builder creates reusable command-line scripts and utilities that use the Hugging Face API, so tasks can be chained, piped and processed in intermediate steps. It is an official Hugging Face skill under the Apache-2.0 license. The scripts can call the API directly or use the hf command line tool, and model and dataset cards can be read straight from repositories. It is especially useful when API calls are combined or chained, or when a task will be repeated or automated.

Rules for the scripts:

  • Every script must accept --help describing its inputs and outputs.
  • Non-destructive scripts should be tested before being handed over.
  • Shell scripts are preferred, with Python or TSX when complexity or user need requires it.
  • Use the HF_TOKEN environment variable as a Bearer token in an Authorization header, which gives higher rate limits and appropriate authorization for data access.
  • Investigate the shape of the API results before committing to a design, use piping and chaining where composability helps, and prefer simple solutions.
  • Share usage examples when done, and confirm user preferences where a question is open.

Bundled reference scripts show the patterns. hf_model_papers_auth.sh uses HF_TOKEN automatically and chains trending models to model metadata to model card parsing with fallbacks, for papers referenced by models. find_models_by_paper.sh uses the token optionally, searches by arXiv ID or keyword, and retries with a broader query when an arXiv-prefixed search finds nothing. hf_model_card_frontmatter.sh downloads model cards with the hf CLI, extracts YAML frontmatter and emits NDJSON with license, pipeline tag, library name, tags, language, new version and a gated-prompt flag. Baseline examples in bash, Python and TypeScript print raw JSON for a small list of models with an auth header, and hf_enrich_models.sh reads model IDs from stdin, fetches metadata per ID and emits one JSON object per line for streaming pipelines. Composition uses jq, for example piping a baseline model list into the enrich script and sorting by downloads to keep the top 10.

When to use - and when NOT to

Use it when the user wants a tool or script, or a task, where data from the Hugging Face API would help, particularly when combining API calls or when the work will recur. Use it only when the task clearly matches the API's scope, and verify commands, API behavior, pricing, quotas and credentials against current official documentation. Generated examples do not replace environment-specific tests, security review or user approval for destructive or costly actions.

Inputs and outputs

The main API endpoints on huggingface.co are /api/datasets, /api/models, /api/spaces, /api/collections, /api/daily_papers, /api/notifications, /api/settings, /api/whoami-v2, /api/trending and /oauth/userinfo. The API is documented as OpenAPI at the .well-known/openapi.json path, but that file is too large to read directly, so query it with jq. For example, this lists all 160 endpoints:

curl -s "https://huggingface.co/.well-known/openapi.json" | jq '.paths | keys | sort'

A similar jq query on .paths["/api/models"] shows the model search endpoint details. Query endpoints with small result limits to see the data shape.

The hf CLI (which replaces the deprecated huggingface-cli) offers commands including auth, buckets, cache, collections, datasets, discussions, download, endpoints, env, extensions, jobs, models, papers, repos, skills, spaces, sync, upload, upload-large-folder, version and webhooks. Outputs are executable scripts with --help, plus usage examples, typically emitting JSON or NDJSON for further processing.

Integrations

It works with the Hugging Face Hub API, the hf CLI, curl, jq, arXiv references and shell, Python and TypeScript runtimes.

Who it's for

It suits developers and data practitioners who want small, composable, authenticated scripts for exploring and enriching Hugging Face Hub data, repeatedly and in pipelines.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.