transformers-js
Skill by huggingface
Runs machine learning models directly in JavaScript through a single pipeline() function. It is for developers who want text, vision, audio, and multimodal inference in browsers, Node.js, Bun, or Deno without a Python server.
Install transformers-js
Built from the published package, never by AI.
git clone --depth 1 https://github.com/huggingface/transformers.js /tmp/transformers.js && mkdir -p ~/.claude/skills && cp -r /tmp/transformers.js/.ai/skills/transformers-js ~/.claude/skills/transformers-jsRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/huggingface/transformers.js /tmp/transformers.js && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/transformers.js/.ai/skills/transformers-js ~/.gemini/antigravity-cli/skills/transformers-jsAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
transformers.js is a skill built on the @huggingface/transformers library. It runs ML inference in JavaScript, without a Python server. The main entry point is pipeline(task, model?, options?), and when no model is passed, the task's default model is used. The source lists about two dozen tasks across text, audio, and vision, including classification, speech recognition, text-to-speech, object detection, and embeddings.
The library runs in browsers and in Node.js, Bun, and Deno, with WebGPU or WASM execution. Models are downloaded from the Hugging Face Hub and must include ONNX weights. The skill tells the assistant to verify that a model has ONNX files before recommending it, and it covers dtype options, device selection, caching, and disposing of pipelines. It is for JavaScript developers who need on-device or server-side model inference.
Written from the project's SKILL.md and checked against it.
What it can do
- Text pipelinesRuns text classification, NER, question answering, summarization, translation, and text generation.
- Audio pipelinesRuns speech recognition, text-to-audio, and audio classification tasks.
- Vision pipelinesRuns image classification, object detection, segmentation, depth estimation, and background removal.
- Feature extractionCreates embeddings with the feature-extraction task, also called embeddings.
- Model verificationChecks whether a Hub model ships ONNX weights using ModelRegistry.get_available_dtypes.
- Quantization optionsSelects dtype values such as fp32, fp16, q8, q4, and q4f16 to trade size for accuracy.
- WebGPU device optionSets device to webgpu to run on the GPU when the runtime and hardware support it.
- Cache and environment settingsConfigures model sources, Node.js disk caching, browser caching, and logging through env.
- Memory cleanupCalls pipe.dispose() to release model weights and backend sessions when work is done.
What you need
- Node.js 20+, or Bun or Deno
- A modern browser with ES modules, if running in the browser
- Network access to the Hugging Face Hub, unless models are shipped locally
- WebGPU runtime and hardware support, if using WebGPU
Try asking
- Use transformers.js to classify the sentiment of this review text.
- Write a Node.js script that transcribes an audio file with transformers.js.
- Check whether a Hub model has ONNX files before using it with transformers.js.
Good to know
- Models must include ONNX weights to load.
- Model downloads need network access unless models are shipped locally.
- WebGPU needs runtime and hardware support; WASM is the fallback.
- A disposed pipeline must not be reused; create a new one instead.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .ai/skills/transformers-js/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md10 KB -
references/CONFIGURATION.md10 KB -
references/PIPELINE_OPTIONS.md20 KB -
references/TASKS.md38 KB
Alternatives to transformers-js
All alternatives →Aligns a Qwen Code feature with a Codex or Claude Code reference agent. It runs both under the same scenario, captures HTTP and terminal traces, and compares them until behavior matches.
Searches, views, creates, updates, and deletes the user's Google Contacts from an AI assistant. It is for people who want to manage their address book through conversation. A one-time Google connect is required before it returns data.
Guides an AI assistant on error handling choices. It covers when to use Result, Option, ? propagation, unwrap, expect and panic, plus anyhow and thiserror.
Caveman is an agent skill that makes an AI assistant reply in a terse style. It cuts filler and keeps technical facts, code, commands and errors exact. It is built for users who want shorter, cheaper replies.
docs-sync audits or updates English SDK documentation against the requested implementation scope. It is for maintainers who want docs to match main branch features, configuration options, and defaults.
Guides an AI assistant through setting up and running monorepos with pnpm workspaces, Turborepo and Nx. Aimed at developers who need faster builds, shared code and managed dependencies across multiple packages.
Compare with agent-reproduce-align, google_contacts or m06-error-handling
transformers-js: common questions
Can transformers.js run in the browser?
Yes. The source says it runs in browsers as well as Node.js, Bun, and Deno, with a modern browser that supports ES modules.
What happens if a model has no ONNX files?
The library cannot load the model without ONNX weights. The source says to check for an onnx/ directory on the Hub or use ModelRegistry.get_available_dtypes before suggesting a model.
Does it need a GPU?
No. The default is CPU with WASM. WebGPU is optional and requires runtime and hardware support.
How do I install transformers-js?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is transformers-js free?
The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.
Is transformers-js safe to use?
It scores 91 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to transformers-js?
Similar skills: agent-reproduce-align, google_contacts, m06-error-handling, caveman.
