Agent skill

Transformers JS

by waybarrios in waybarrios/opencode-power-pack

Run Hugging Face models in JavaScript or TypeScript with Transformers.js, WebGPU, or WASM across browser, Node.js, Bun, and Deno.

Apache-2.0Auto-check passedAI & LLM Engineering

Install Transformers JS

skills CLI
$ npx skills add waybarrios/opencode-power-pack --skill transformers-js -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install waybarrios/opencode-power-pack transformers-js --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/waybarrios/opencode-power-pack.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/transformers-js .claude/skills/transformers-js && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
transformers-js
GitHub stars
533
Token cost
~1.9k tokens
SKILL.md length
547 words
Files
8 (incl. references)
Skills in repo
32
Repo updated
First seen
Licence
Apache-2.0

At a glance

Run Hugging Face models in JavaScript or TypeScript with Transformers.js, WebGPU, or WASM across browser, Node.js, Bun, and Deno.

  • JS-runtime inference
  • SKILL.md covers Installation, Core Concepts, Supported Tasks and Finding and Choosing Models, plus 6 more sections
  • Calls npm; reaches huggingface.co and cdn.jsdelivr.net; needs HF_TOKEN
  • Not Python training

What it does

Transformers JS is an agent skill from waybarrios/opencode-power-pack. Run Hugging Face models in JavaScript or TypeScript with Transformers.js, WebGPU, or WASM across browser, Node.js, Bun, and Deno. Use for client-side or JS-runtime inference, not Python training.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including reference files (for example `references/CACHE.md`, `references/CONFIGURATION.md` and `references/EXAMPLES.md`).

It sits in AI & LLM Engineering, covering Model hubs and datasets. It works with Transformers, JavaScript, WebAssembly and Node.js. The repository describes itself as: 54 rigorous skills for Codex, OpenCode, and Pi: code review, security audit, feature development, frontend design, MCP tools, Hugging Face ML/training, and more. The licence is Apache-2.0.

When your agent uses it

  • JS-runtime inference
  • Not Python training

Example prompts

  • “/transformers-js”

Requirements

  • Python 3
  • Node.js

What it can do on your machine

Read from SKILL.md and the folder at commit 9dccb6d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • huggingface.co
    • cdn.jsdelivr.net

    Also links to:

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • HF_TOKEN

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Transformers JS loads about 1.9k tokens when it runs, and up to ~20k if it reads all its reference files. Until then it costs about 53 tokens; SKILL.md has 547 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~53
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~20k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from waybarrios/opencode-power-pack at commit 9dccb6d, republished under its Apache-2.0 licence (© waybarrios). 547 words, ~1,905 tokens.

Download SKILL.mdSave it as .claude/skills/transformers-js/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
name
transformers-js
description
Run Hugging Face models in JavaScript or TypeScript with Transformers.js, WebGPU, or WASM across browser, Node.js, Bun, and Deno. Use for client-side or JS-runtime inference, not Python training.
license
Apache-2.0 (modified; see UPSTREAMS.json)

Transformers.js — Machine Learning for JavaScript

Runs state-of-the-art ML models directly in JavaScript, in browsers and server-side runtimes (Node.js, Bun, Deno), with no Python server required.

Installation

bash
npm install @huggingface/transformers
javascript
// Browser (CDN)
import { pipeline } from 'https://cdn.jsdelivr.net/npm/@huggingface/transformers';

Core Concepts

Pipeline API — groups preprocessing, inference, and postprocessing. Always dispose() when done to free memory (see references/EXAMPLES.md for cleanup patterns):

javascript
import { pipeline } from '@huggingface/transformers';
const pipe = await pipeline('sentiment-analysis');
const result = await pipe('I love transformers!');
await pipe.dispose();

Model selection — pass a model ID as the second argument, e.g. pipeline('sentiment-analysis', 'Xenova/bert-base-multilingual-uncased-sentiment'). Browse compatible models at https://huggingface.co/models?library=transformers.js&sort=trending, filtered by pipeline_tag for a specific task.

Device: { device: 'webgpu' } for GPU acceleration (falls back to WASM/CPU when unsupported); omit for CPU/WASM default.

Quantization: { dtype: 'q4' } — options fp32 (largest/most accurate), fp16, q8, q4 (smallest, some accuracy loss).

Supported Tasks

One pipeline call per task, e.g. await pipeline('image-classification')('https://example.com/image.jpg'). Task IDs by category:

  • NLP: text-classification/sentiment-analysis, token-classification/ner, question-answering, fill-mask, summarization, translation, text-generation, text2text-generation, zero-shot-classification
  • Vision: image-classification, object-detection, image-segmentation, depth-estimation, zero-shot-image-classification, image-to-image
  • Audio: automatic-speech-recognition, audio-classification, text-to-speech/text-to-audio
  • Multimodal: image-to-text, document-question-answering, zero-shot-object-detection
  • Embeddings: feature-extraction (add { pooling: 'mean', normalize: true } for sentence embeddings), sentence-similarity

For streaming/chat text generation (system/user/assistant roles, TextStreamer, generation params), see references/TEXT_GENERATION.md.

Finding and Choosing Models

Filter the Hub by library=transformers.js and pipeline_tag=<task>, sort by trending/downloads/likes/modified. Consider: size (<100MB fast/browser-friendly, 100-500MB balanced, >500MB high-accuracy/Node.js), quantization (fp32/fp16/q8/q4 trade accuracy for size/speed), task compatibility (check the model card for supported tasks, I/O format, language, license), and performance metrics on the model card. Start with a smaller model, verify it has ONNX files, and pin a specific revision in production for stability.

Advanced Configuration

Environment (env) controls caching and model loading globally:

javascript
import { env, LogLevel } from '@huggingface/transformers';
env.allowRemoteModels = true;   // load from Hugging Face Hub
env.allowLocalModels = false;   // load from file system
env.localModelPath = '/models/';
env.useFSCache = true;          // Node.js disk cache
env.useBrowserCache = true;
env.cacheDir = './.cache';
env.logLevel = LogLevel.INFO;   // default WARNING
env.fetch = (url, options) => fetch(url, { ...options, headers: { ...options?.headers, Authorization: `Bearer ${HF_TOKEN}` } });

Typical patterns: development uses remote models + FS cache; production uses local-only models from a fixed path; testing disables both caches. Full option/caching reference: references/CONFIGURATION.md.

ModelRegistry (v4) inspects model assets before loading — required files, cache status, available dtypes:

javascript
import { ModelRegistry } from '@huggingface/transformers';
const files = await ModelRegistry.get_pipeline_files(task, modelId, modelOptions);
const cached = await ModelRegistry.is_pipeline_cached(task, modelId, modelOptions);
const dtypes = await ModelRegistry.get_available_dtypes(modelId);

See references/MODEL_REGISTRY.md for full API coverage.

Standalone tokenization: npm install @huggingface/tokenizers for fast tokenization without loading a full inference pipeline.

Manual tokenizer + model for finer control:

javascript
import { AutoTokenizer, AutoModel } from '@huggingface/transformers';
const tokenizer = await AutoTokenizer.from_pretrained('bert-base-uncased');
const model = await AutoModel.from_pretrained('bert-base-uncased');
const outputs = await model(await tokenizer('Hello world!'));

Batch processing: pass an array of inputs to any pipeline, e.g. classifier(['I love this!', 'This is terrible.']).

Show full SKILL.md (227 more words)Show less

Runtime Considerations

WebGPU accelerates browsers and supporting server runtimes — use it when available, fall back to WASM/CPU otherwise. WASM is the most portable backend; combine with q8/q4 quantization for smaller, faster models.

Progress tracking for large multi-file downloads — pass progress_callback to pipeline(); the callback receives {status: 'initiate'|'download'|'progress'|'progress_total'|'done'|'ready', name, file?, progress?, loaded?, total?}. Full patterns (browser UI, React, CLI, retries) in references/PIPELINE_OPTIONS.md#progress-callback.

Error Handling & Memory Management

javascript
try {
  const pipe = await pipeline('sentiment-analysis', 'model-id');
  const result = await pipe('text to analyze');
} catch (error) {
  // error.message mentions 'fetch' -> download/network issue
  // error.message mentions 'ONNX' -> model execution/compatibility issue
}

Always call pipe.dispose() when finished (app shutdown, component unmount, before loading a different model, after batch processing) — models hold 100MB-several GB of memory/GPU resources. See references/CACHE.md and references/EXAMPLES.md for cache and cleanup patterns across runtimes.

Troubleshooting

  • Model not found: verify it exists on the Hub, check spelling, confirm it has ONNX files (an onnx folder in the repo).
  • Memory issues: use a smaller/quantized model (dtype: 'q4'), reduce batch size, limit max_length.
  • WebGPU errors: check browser support (Chrome/Edge 113+), try fp16 if fp32 fails, or fall back to WASM.

Best Practices

Always dispose pipelines; prefer the pipeline API unless fine-grained control is needed; test with small inputs first; watch download sizes for web apps; show progress indicators; pin model versions in production; wrap pipeline calls in try/catch; provide fallbacks for unsupported browsers/backends; reuse loaded pipelines rather than recreating them; dispose models on SIGTERM/SIGINT in servers.

Resources

This skill: references/PIPELINE_OPTIONS.md, CONFIGURATION.md, MODEL_REGISTRY.md, CACHE.md, TEXT_GENERATION.md, MODEL_ARCHITECTURES.md, EXAMPLES.md.

Official: docs, API reference, model hub, GitHub, examples.

© waybarrios, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 7 other files (references) in skills/transformers-js of waybarrios/opencode-power-pack.

  • SKILL.md
  • 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

Open the folder on GitHubat commit 9dccb6d

Compare with similar skills

Transformers JS next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Transformers JS compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Transformers JS this skillwaybarrios/opencode-power-pack533—~1.9kAutomated safety check: PassApache-2.0
Transformers.jshuggingface/skills11k1 repos~6.2kAutomated safety check: PassApache-2.0
Hugging Face Vision Trainerhuggingface/skills11k1 repos~7.5kAutomated safety check: PassApache-2.0
Hugging Face Transformers Usagedavila7/claude-code-templates32k11 repos~1.2kAutomated safety check: PassMIT
Huggingface Spaceshuggingface/skills11k1 repos~4.4kAutomated safety check: PassApache-2.0
Transformers JSsickn33/agentic-awesome-skills47k1 repos~444Automated safety check: PassApache-2.0

Similar skills

  • Transformers.js

    huggingface/skills

    Official

    Runs pre-trained Hugging Face models in JavaScript or TypeScript with Transformers.js, in browsers or Node.js, Bun and Deno, for text, vision, audio and multimodal tasks.

    11k GitHub starsUsed in 1 repo~6.2k tokens
    AI & LLM EngineeringAuto-check passed
  • Hugging Face Vision Trainer

    huggingface/skills

    Official

    Trains and fine-tunes object detection, image classification and SAM or SAM2 segmentation models on Hugging Face Jobs cloud GPUs and saves the results to the Hub.

    11k GitHub starsUsed in 1 repo~7.5k tokens
    AI & LLM EngineeringAuto-check passed
  • Hugging Face Transformers Usage

    davila7/claude-code-templates

    Loads pre-trained Hugging Face Transformers models for text, vision and audio tasks, runs inference with pipelines and fine-tunes on custom datasets.

    32k GitHub starsUsed in 11 repos~1.2k tokens
    AI & LLM EngineeringAuto-check passed
  • Huggingface Spaces

    huggingface/skills

    Official

    Build, deploy, and maintain applications on Hugging Face Spaces — Gradio / Docker / Static SDKs, ZeroGPU and dedicated hardware, model loading, debugging, buckets, inference providers, community…

    11k GitHub starsUsed in 1 repo~4.4k tokens
    AI & LLM EngineeringAuto-check passed
  • Transformers JS

    sickn33/agentic-awesome-skills

    Use Transformers.js to run state-of-the-art machine learning models directly in JavaScript/TypeScript.

    47k GitHub starsUsed in 1 repo~444 tokens
    AI & LLM EngineeringAuto-check passed
  • Security Verification Gate

    fengshao1227/ccg-workflow

    Scans code with a bundled Node script for injection, secrets, XSS and other risky patterns, ranks findings by severity and checks that security decisions are documented.

    5.9k GitHub stars~621 tokensUpdated 23 days ago
    SecurityAuto-check: notes

More from waybarrios/opencode-power-pack

All 32 skills in this repo
  • Hf Cloud Sagemaker Iam Preflight

    waybarrios/opencode-power-pack

    Verify or select a SageMaker execution role before creating models, endpoints, or training jobs.

    533 GitHub stars~1.6k tokensUpdated 3 days ago
    Auto-check passed
  • Huggingface LLM Trainer

    waybarrios/opencode-power-pack

    Train or fine-tune language models with TRL or Unsloth on Hugging Face Jobs, including SFT, DPO, GRPO, reward models, and GGUF conversion.

    533 GitHub stars~3k tokensUpdated 3 days ago
    Auto-check passed
  • Huggingface Vision Trainer

    waybarrios/opencode-power-pack

    Train object-detection, image-classification, or SAM segmentation models on Hugging Face Jobs.

    533 GitHub stars~2.7k tokensUpdated 3 days ago
    Auto-check passed
  • Codeql

    waybarrios/opencode-power-pack

    Run CodeQL database creation and security queries, add data-extension models, or process CodeQL SARIF.

    533 GitHub starsUsed in 2 repos~3.7k tokens
    Auto-check passed
  • Semgrep

    waybarrios/opencode-power-pack

    Run Semgrep static analysis across a codebase, optionally using Semgrep Pro for cross-file taint analysis.

    533 GitHub stars~2.4k tokensUpdated 3 days ago
    Auto-check passed
  • Insecure Defaults

    waybarrios/opencode-power-pack

    Detects fail-open insecure defaults (hardcoded secrets, weak auth, permissive security) that allow apps to run insecurely in production.

    533 GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check passed

Questions about Transformers JS

What does Transformers JS do?

Run Hugging Face models in JavaScript or TypeScript with Transformers.js, WebGPU, or WASM across browser, Node.js, Bun, and Deno. Transformers JS is an agent skill from waybarrios/opencode-power-pack.js, Bun, and Deno.

When should I use Transformers JS?

Transformers JS fits situations like: JS-runtime inference; not Python training.

How do I install Transformers JS in Claude Code?

Run `npx skills add waybarrios/opencode-power-pack --skill transformers-js -a claude-code`. Or copy the skill folder (skills/transformers-js in waybarrios/opencode-power-pack) into .claude/skills/transformers-js in your project. Claude Code loads it when a task matches its description.

How do I install Transformers JS in Codex?

Run `npx skills add waybarrios/opencode-power-pack --skill transformers-js -a codex`. Or copy the skill folder (skills/transformers-js in waybarrios/opencode-power-pack) into .agents/skills/transformers-js in your project. Codex loads it when a task matches its description.

Can I use Transformers JS in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add waybarrios/opencode-power-pack --skill transformers-js -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/transformers-js, .gemini/skills/transformers-js, .github/skills/transformers-js and .opencode/skills/transformers-js in your project.

What does Transformers JS need to run?

Going by SKILL.md and its folder, Transformers JS needs the command-line tools its instructions call (npm) and credentials named HF_TOKEN. Our summary lists: Python 3; Node.js.

Does Transformers JS access the network?

SKILL.md names 3 domains. In commands or code: huggingface.co and cdn.jsdelivr.net; the agent is likely to contact these when it follows the instructions. As links in the text: github.com. This is read from the text; nothing was executed.

Is Transformers JS safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Transformers JS use?

Transformers JS is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Transformers JS use?

About 1.9k tokens (SKILL.md is roughly 7.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 18k tokens, read only when the agent opens those files.

What are the alternatives to Transformers JS?

Skills that share tags, products or a category with Transformers JS: Transformers.js (huggingface/skills, 11k stars), Hugging Face Vision Trainer (huggingface/skills, 11k stars), Hugging Face Transformers Usage (davila7/claude-code-templates, 32k stars) and Huggingface Spaces (huggingface/skills, 11k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Transformers JS?

waybarrios (a GitHub user) maintains it in waybarrios/opencode-power-pack, which has 533 GitHub stars. The repository holds 32 skills in this directory. The repository was last updated on October 6, 2026.

Source: waybarrios/opencode-power-pack on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.