hugging-face-tool-builder

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.

31,392 stars
Complexity: easy

About this skill

This skill instructs an AI agent to act as a specialized tool builder for the Hugging Face ecosystem. Its primary function is to create reusable command-line scripts and utilities that leverage the Hugging Face API. The agent is guided to enable advanced processing by allowing chaining, piping, and intermediate data manipulation within the generated scripts. It can directly access the Hugging Face API or utilize the `hf` command-line tool. A key requirement for the generated scripts is the inclusion of a `--help` argument for user guidance, ensuring user-friendliness and adherence to common CLI standards. This skill transforms the AI agent into a powerful programmatic interface for Hugging Face models, datasets, and Spaces, enabling complex, automated machine learning workflows.

Best use case

Automating complex Hugging Face API interactions for machine learning tasks. Programmatically creating data pipelines for model inference, fine-tuning, or dataset processing. Developing custom command-line interface (CLI) tools that leverage Hugging Face resources. Facilitating sophisticated AI workflows by generating interconnected scripts capable of chaining and piping.

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.

Well-structured, robust, and reusable command-line scripts or utilities that effectively interact with the Hugging Face API. These generated scripts will be designed for chaining, piping, and intermediate processing, and will consistently include a `--help` argument, making them ready for immediate execution by a user or another automated system.

Practical example

Example input

Generate a Python CLI script that takes text input (from stdin or an argument) and performs sentiment analysis using a specified Hugging Face model. The script should output the result as JSON and be designed for piping. Ensure it has a `--help` flag for usage instructions.

Example output

```python
#!/usr/bin/env python3
import argparse
from transformers import pipeline
import json
import sys

def main():
    parser = argparse.ArgumentParser(description="Perform sentiment analysis using Hugging Face and output to JSON.")
    parser.add_argument("--text", type=str, help="Input text for sentiment analysis. If not provided, reads from stdin.")
    parser.add_argument("--model", type=str, default="cardiffnlp/twitter-roberta-base-sentiment",
                        help="Hugging Face sentiment analysis model to use.")
    parser.add_argument("--output_file", type=str, help="Output JSON file. If not provided, prints to stdout.")
    parser.add_argument("--help", action="help", default=argparse.SUPPRESS,
                        help="Show this help message and exit.")
    args = parser.parse_args()

    input_text = args.text if args.text else sys.stdin.read().strip()

    if not input_text:
        print("Error: No input text provided.", file=sys.stderr)
        sys.exit(1)

    try:
        sentiment_pipeline = pipeline("sentiment-analysis", model=args.model)
        result = sentiment_pipeline(input_text)
        output_data = {"input_text": input_text, "sentiment_result": result}

        if args.output_file:
            with open(args.output_file, 'w') as f:
                json.dump(output_data, f, indent=2)
            print(f"Sentiment analysis result saved to {args.output_file}", file=sys.stderr)
        else:
            json.dump(output_data, sys.stdout, indent=2)

    except Exception as e:
        print(f"An error occurred: {e}", file=sys.stderr)
        sys.exit(1)

if __name__ == "__main__":
    main()
```

When to use this skill

  • When an AI agent needs to programmatically interact with Hugging Face models, datasets, or Spaces in a structured, repeatable manner.
  • When generating custom command-line tools for specific machine learning tasks that require interaction with Hugging Face resources.
  • When building data processing pipelines where Hugging Face components are involved, and modular, script-based operations are desired.
  • When an AI agent needs to automate repetitive tasks involving the Hugging Face API, such as batch inference, dataset manipulation, or model deployment orchestration.

When not to use this skill

  • When simple, one-off Hugging Face API calls are sufficient and do not necessitate the generation of reusable scripts.
  • When the task does not involve Hugging Face resources or API interactions.
  • When pre-existing tools or libraries already fulfill the exact scripting requirement without the need for AI-driven generation, potentially offering a more direct solution.
  • For tasks that require real-time, low-latency API calls where script overhead would be detrimental.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/hugging-face-tool-builder/SKILL.md --create-dirs "https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/plugins/antigravity-awesome-skills-claude/skills/hugging-face-tool-builder/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/hugging-face-tool-builder/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How hugging-face-tool-builder Compares

Feature / Agenthugging-face-tool-builderStandard Approach
Platform SupportClaudeLimited / Varies
Context Awareness High Baseline
Installation ComplexityeasyN/A

Frequently Asked Questions

What does this skill do?

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.

Which AI agents support this skill?

This skill is designed for Claude.

How difficult is it to install?

The installation complexity is rated as easy. You can find the installation instructions above.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Hugging Face API Tool Builder

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.

## When to Use

- You need reusable CLI scripts around the Hugging Face API or `hf` command line tool.
- You want shell-friendly utilities that support chaining, piping, and intermediate processing.
- You are automating repeated Hub tasks and need a composable interface instead of ad hoc API calls.

## Script Rules

Make sure to follow these rules:
 - Scripts must take a `--help` command line argument to describe their inputs and outputs
 - Non-destructive scripts should be tested before handing over to the User
 - Shell scripts are preferred, but use Python or TSX if complexity or user need requires it.
 - IMPORTANT: Use the `HF_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.
 - Investigate the shape of the API results before commiting to a final design; make use of piping and chaining where composability would be an advantage - prefer simple solutions where possible.
 - Share usage examples once complete.

Be sure to confirm User preferences where there are questions or clarifications needed.

## Sample Scripts

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` — bash
- `references/baseline_hf_api.py` — python
- `references/baseline_hf_api.tsx` — typescript executable

Composable 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})'`

## High Level Endpoints

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
```

## Accessing the API

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

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

Model Search Endpoint Details

```bash
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.

## Using the HF command line tool

The `hf` command line tool gives you further access to Hugging Face repository content and infrastructure. 

```bash
❯ 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.

Related Skills

mcp-builder-ms

31392
from sickn33/antigravity-awesome-skills

Use this skill when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

Developer ToolsClaude

n8n-expression-syntax

31392
from sickn33/antigravity-awesome-skills

Validate n8n expression syntax and fix common errors. Use when writing n8n expressions, using {{}} syntax, accessing $json/$node variables, troubleshooting expression errors, or working with webhook data in workflows.

Developer ToolsClaude

mermaid-expert

31392
from sickn33/antigravity-awesome-skills

Create Mermaid diagrams for flowcharts, sequences, ERDs, and architectures. Masters syntax for all diagram types and styling.

Developer ToolsClaude

makepad-deployment

31392
from sickn33/antigravity-awesome-skills

CRITICAL: Use for Makepad packaging and deployment. Triggers on: deploy, package, APK, IPA, 打包, 部署, cargo-packager, cargo-makepad, WASM, Android, iOS, distribution, installer, .deb, .dmg, .nsis, GitHub Actions, CI, action, marketplace

Developer ToolsClaude

macos-menubar-tuist-app

31392
from sickn33/antigravity-awesome-skills

Build, refactor, or review SwiftUI macOS menubar apps that use Tuist.

Developer ToolsClaude

kaizen

31392
from sickn33/antigravity-awesome-skills

Guide for continuous improvement, error proofing, and standardization. Use this skill when the user wants to improve code quality, refactor, or discuss process improvements.

Developer ToolsClaude

issues

31392
from sickn33/antigravity-awesome-skills

Interact with GitHub issues - create, list, and view issues.

Developer ToolsClaude

git-pushing

31392
from sickn33/antigravity-awesome-skills

Stage all changes, create a conventional commit, and push to the remote branch. Use when explicitly asks to push changes ("push this", "commit and push"), mentions saving work to remote ("save to github", "push to remote"), or completes a feature and wants to share it.

Developer ToolsClaude

git-hooks-automation

31392
from sickn33/antigravity-awesome-skills

Master Git hooks setup with Husky, lint-staged, pre-commit framework, and commitlint. Automate code quality gates, formatting, linting, and commit message enforcement before code reaches CI.

Developer ToolsClaude

gh-review-requests

31392
from sickn33/antigravity-awesome-skills

Fetch unread GitHub notifications for open PRs where review is requested from a specified team or opened by a team member. Use when asked to "find PRs I need to review", "show my review requests", "what needs my review", "fetch GitHub review requests", or "check team review queue".

Developer ToolsClaude

fp-types-ref

31392
from sickn33/antigravity-awesome-skills

Quick reference for fp-ts types. Use when user asks which type to use, needs Option/Either/Task decision help, or wants fp-ts imports.

Developer ToolsClaude

fp-taskeither-ref

31392
from sickn33/antigravity-awesome-skills

Quick reference for TaskEither. Use when user needs async error handling, API calls, or Promise-based operations that can fail.

Developer ToolsClaude