Workers AI
Write Cloudflare Workers AI and AI Gateway code for model inference, prompts, streaming, token budgets, model selection, observability, and fallback design. Use when adding LLM, embeddings, summarization, classification, or generation to Workers.
Install
npx skills add zllovesuki/cloudflare-agent-skills --skill workers-aigit clone --depth 1 https://github.com/zllovesuki/cloudflare-agent-skills.git /tmp/cloudflare-agent-skills
mkdir -p ~/.claude/skills
cp -r /tmp/cloudflare-agent-skills/skills/workers-ai ~/.claude/skills/workers-aiPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# Workers AI
Use this skill when adding AI inference to a Worker. Separate model selection, prompt design, cost control, and observability.
## Decision rules
- Use Workers AI when operational simplicity, binding-based access, and Cloudflare-native deployment matter.
- Use AI Gateway when requests need centralized observability, caching, rate controls, fallback, or multi-provider routing.
- Use external model providers when required model quality, fine-tuning, modalities, or SLAs exceed Workers AI's fit.
- Do not assume edge inference is automatically low latency for every model or geography; measure.
## Binding
```jsonc
{
"ai": { "binding": "AI" }
}
```
```ts
export interface Env {
AI: Ai;
}
```
## Text generation pattern
```ts
export async function answerQuestion(env: Env, question: string) {
const response = await env.AI.run("@cf/meta/llama-3.1-8b-instruct", {
messages: [
{ role: "system", content: "Answer clearly and concisely. Do not invent facts." },
{ role: "user", content: question }
],
max_tokens: 512
});
return response;
}
```
Verify model IDs and parameter names against the current model catalog.
## Embeddings pattern
```ts
export async function embed(env: Env, text: string) {
const result = await env.AI.run("@cf/baai/bge-base-en-v1.5", { text });
return result.data[0];
}
```
## Prompt safety and output shape
- Put invariant rules in the system message.
- Include the user's task and constraints explicitly.Details
- Skill name
workers-ai- Repository
- zllovesuki/cloudflare-agent-skills
- Path
skills/workers-ai/SKILL.md- Repo updated
- 28 April 2026
FAQ
What does the Workers AI skill do?
Write Cloudflare Workers AI and AI Gateway code for model inference, prompts, streaming, token budgets, model selection, observability, and fallback design. Use when adding LLM, embeddings, summarization, classification, or generation to Workers.
How do I install the Workers AI skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add zllovesuki/cloudflare-agent-skills --skill workers-ai. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Workers AI popular?
It lives in zllovesuki/cloudflare-agent-skills, which has 9 GitHub stars and 0 forks.
Related skills
Agents
9zllovesuki/cloudflare-agent-skills
Build Cloudflare Agents SDK applications for autonomous multi-step tool use, AIChatAgent chat agents, Durable Object-backed state, tools, scheduling, callable methods, WebSockets, SQL state, and constrained agent behavior. Use when RAG or Workflows are not enough.
Cloudflare Architecture
9zllovesuki/cloudflare-agent-skills
Choose Cloudflare Developer Platform primitives and architecture shapes before writing code. Use for Cloudflare Workers, Durable Objects, D1, R2, Queues, Workflows, Containers, Realtime, Workers AI, Vectorize, AI Search, Agents, cost, limits, and migration decisions.
Containers
9zllovesuki/cloudflare-agent-skills
Decide when to use Cloudflare Containers instead of Workers and design container-backed workloads, native binaries, long-running processes, image processing, larger runtime shapes, and Worker frontends. Use as an escape hatch when Workers constraints do not fit.
Agent Design Review
5nekoai-lab/claude-skills
AIエージェントの仕様書・要件定義・設計ドキュメントをレビューするスキル。ユーザーが「仕様書を見て」「設計レビューして」「これで問題ないか確認して」「エージェント設計のフィードバックほしい」などと言ったとき、またはエージェント設計に関する判断を求められたときに必ず使う。ハーネス設計・ツール分類・コンテキスト設計・マルチエージェント構成・陳腐化リスクの5軸で問題を検出し、具体的な改善案を返す。
Table Design Advisor
9shisuidata/ss-data-skills
Use when designing or reviewing a data warehouse table schema. Advises on warehouse layer, table grain, fact or dimension modeling, fields, primary key, partitioning, update strategy, lifecycle, naming, downstream usage, and data quality checks. 中文触发词:表设计、数仓建模、表结构审查、表粒度、分区设计。
Agent Ops Review
5nekoai-lab/claude-skills
運用中・運用開始前のAIエージェントを「安全に運用できているか」の観点でレビューするスキル。隔離・監視・早期兆候・停止権限・タスク設計・エージェント間通信・認証情報・人の監督・開示の9軸で、実運用で事故になった箇所を検出する。「運用チェックして」「安全に動かせてる?」「本番に出して大丈夫か見て」「エージェントの運用レビュー」と言われたとき、またはエージェントを社内・本番で動かし始める直前・直後に必ず使う。仕様書・要件定義・設計ドキュメントのレビューは agent-design-review(設計側)を使う。本スキルは動いているもの・動かす直前のものを対象とする運用側。
Browse the most popular Claude skills, all ai, llms & agents skills, or write your own with the skills generator.