
Transformers.js ML in JavaScript
Run Hugging Face machine learning models in JavaScript for text, image, and audio tasks
- Repository
- huggingface/skills
- Stars
- 11,253
- Licence
- Apache-2.0
- Files
- 8 files
What it does
This skill teaches the agent how to use the Transformers.js library to run pretrained machine learning models directly inside JavaScript or TypeScript code, in browsers and on servers (Node.js, Bun, Deno), without a separate Python backend. When a developer asks for sentiment analysis, translation, summarization, image classification, object detection, or speech recognition in JavaScript, the agent knows the correct pipeline API calls, how to choose models from the Hugging Face Hub, how to pick CPU or WebGPU, how to use quantized dtypes, and how to free memory with dispose().
Great for
- JavaScript or TypeScript developers adding ML features to a web app without a Python server
- Developers building client-side browser features that should run models locally
- Node.js or Bun backend engineers who want to run small models in-process
Skip it if
- Training or fine-tuning models, since the skill focuses on running existing pretrained models for inference
- Python projects, where the Python transformers library is the more appropriate tool
- Large language model workloads needing heavy GPU serving, since in-browser or small-model inference has hardware and size limits
Try asking
- “Write a Node.js script that classifies customer reviews as positive or negative using Transformers.js”
- “Add client-side image classification to my React app with a Hugging Face model”
- “Set up a WebGPU speech-to-text pipeline in the browser and show how to free memory afterwards”
- “Translate English text to French in a TypeScript service using a quantized model”
Install in 3 steps
- 1
Download the skill
The ZIP contains the 8 original files, the Apache-2.0 licence and an attribution note.
transformers-js.zip - 2
Add it to your agent
Claude Code (all projects)
mkdir -p ~/.claude/skills && unzip transformers-js.zip -d ~/.claude/skills/Claude Code / Agent SDK (this project only)
mkdir -p .claude/skills && unzip transformers-js.zip -d .claude/skills/Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.
- 3
Ask for the task
No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.
Get better results
- Name a specific model ID from the Hugging Face Hub when you need predictable output, rather than relying on the task default.
- Ask the agent to include pipe.dispose() cleanup in long-running or server code to avoid memory leaks.
- Specify your runtime (browser, Node.js, Bun, or Deno) so the agent picks the correct import and device options.
What's inside
- references/CACHE.md
- references/CONFIGURATION.md
- references/EXAMPLES.md
- references/MODEL_ARCHITECTURES.md
- references/MODEL_REGISTRY.md
- references/PIPELINE_OPTIONS.md
- references/TEXT_GENERATION.md
- SKILL.md
Redistributed unmodified from huggingface/skills under the Apache-2.0 licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.