app-ai-binding
Skill5.4k starsChanged 3 months agoMITView on GitHub
Build AI features in generated apps using the platform-provided Workers AI binding. Load this skill for chatbots, summarization, classification, embeddings, semantic search, image understanding, transcription, translation, or other model inference.
- Reads credentials
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 2 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Use only AI.run(model, inputs, options?).
- Very specific: line 33
Keep AI calls in the server-side App class.
- Very specific: line 39
Use @cf/meta/llama-4-scout-17b-16e-instruct with either prompt or messages:
- Very specific: line 50
Use @cf/baai/bge-base-en-v1.5.
- Very specific: line 60
Use @cf/microsoft/resnet-50 with image bytes converted to a number array:
- Very specific: line 69
Use @cf/openai/whisper with audio bytes:
- Distinctive: line 82
Never return canned, random, mock, placeholder, or hard-coded content as a fallback for an AI response.
- Very specific: line 83
Never catch an AI.run() error and continue with an apparently successful response.
- Very specific: line 84
Never return 200 with fields such as fallbackUsed after inference fails.
- Distinctive: line 86
Do not retry rate-limit failures in a loop.
- Very specific: line 108
Use non-streaming calls for preview-compatible code.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Generated apps can call Workers AI from the App Durable Object through this.env.AI. The platform provides this binding automatically in Dynamic Worker previews and native Cloudflare deployments. Do not add an ai section to the generated app's wrangler.json.
Use only AI.run(model, inputs, options?). Preview uses a restricted proxy with this method, while deployed Workers receive the native Workers AI binding. Methods such as AI.gateway(), AI.models(), AI.autorag(), and AI.toMarkdown() are not portable between preview and deployment.
Type and usage
import { DurableObject } from "cloudflare:workers";
interface Env {
AI: Ai;
}
export class App extends DurableObject<Env> {
async fetch(request: Request): Promise<Response> {
const { prompt } = await request.json<{ prompt: string }>();
const result = await this.env.AI.run("@cf/meta/llama-4-scout-17b-16e-instruct", {
messages: [
{ role: "system", content: "Answer clearly and concisely." },
{ role: "user", content: prompt },
],
});
return Response.json(result);
}
}Keep AI calls in the server-side App class. Browser code should call an app API route; it must never receive model credentials or call the binding directly.
Common tasks
Text generation
Use @cf/meta/llama-4-scout-17b-16e-instruct with either prompt or messages:
const result = await this.env.AI.run("@cf/meta/llama-4-scout-17b-16e-instruct", {
messages: [{ role: "user", content: userPrompt }],
max_tokens: 512,
});Embeddings
Use @cf/baai/bge-base-en-v1.5. The response contains embedding vectors in data:
const result = await this.env.AI.run("@cf/baai/bge-base-en-v1.5", {
text: ["first document", "second document"],
});Image classification
Use @cf/microsoft/resnet-50 with image bytes converted to a number array:
const image = [...new Uint8Array(await request.arrayBuffer())];
const result = await this.env.AI.run("@cf/microsoft/resnet-50", { image });Speech transcription
Use @cf/openai/whisper with audio bytes:
const audio = [...new Uint8Array(await request.arrayBuffer())];
const result = await this.env.AI.run("@cf/openai/whisper", { audio });Model input and output shapes differ. Keep model-specific parsing close to the call and validate user input before inference. Use only active model IDs from the current Workers AI model catalog; never generate code with a deprecated model.
Limits and errors
Dynamic Worker previews enforce a per-app AI call limit. AI features must fail transparently when inference is unavailable.
- Never return canned, random, mock, placeholder, or hard-coded content as a fallback for an AI response.
- Never catch an
AI.run()error and continue with an apparently successful response. - Never return
200with fields such asfallbackUsedafter inference fails. - Return a non-2xx JSON response containing a safe, useful error message. The frontend must display that error to the user.
- Do not retry rate-limit failures in a loop.
try {
const result = await this.env.AI.run("@cf/meta/llama-4-scout-17b-16e-instruct", {
messages: [{ role: "user", content: userPrompt }],
});
return Response.json(result);
} catch (error) {
const message = error instanceof Error ? error.message : "AI inference failed";
return Response.json({ error: "AI inference failed", details: message }, { status: 503 });
}Frontend callers must inspect both the HTTP status and error body:
const response = await fetch("./api/chat", requestOptions);
const body = await response.json<{ content?: string; error?: string; details?: string }>();
if (!response.ok) throw new Error(body.details || body.error || "AI request failed");Use non-streaming calls for preview-compatible code. Native Workers AI deployments support { stream: true }, but streaming across the preview proxy is not guaranteed.
Trending
More talk lately.about the whole repository
Who's talking about cloudflare/vibesdk
- A Hacker News story“VibeSDK: Open-source vibe coding platform”Hacker News · Sep 23, 2025 · 3 points
- A Hacker News story“VibeSDK/Cloudflare”Hacker News · Nov 19, 2025 · 2 points
- @u11g.com“Build your own vibe-coding platform on Cloudflare's stack - open source and powerful! …”Bluesky · Dec 20, 2025 · 1 likes
- A Hacker News story“Zero Lines of code. 1 AI prompt. 1 deployed website”Hacker News · Dec 9, 2025 · 1 points
- @github-trending-js.bsky.social“🔥 Hot Repo! 🔥 (100+ new stars) 📦 cloudflare / vibesdk ⭐ 3,516 (+149) 🗒 TypeScript An open-source vibe …”Bluesky · Dec 8, 2025 · 1 likes
The biggest 5 of 18 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 18
Talked about on GitHub, Hacker News and Bluesky (18 times).
On GitHub · 10
- Oct 28, 2026Scope digest 2026-10-28: 16 changes across 9 bounty programs — abdulsalam-create/bounty-watch0 reactions
- Oct 21, 2026docs: add Cloudflare vibesdk as a main reference — developmentconexus-ops/conexus0 reactions
- Sep 26, 2026wiki: bulk update 2026-09-26 — wikicommit/ai-driven-dev-wiki0 reactions
- Sep 26, 2026wiki: bulk update 2026-09-26 — wikicommit/ai-driven-dev-wiki0 reactions
- Sep 26, 2026wiki: bulk update 2026-09-26 — wikicommit/ai-driven-dev-wiki0 reactions
5 more on GitHub
- Sep 26, 2026[Candidate] cloudflare/vibesdk/worker/agents/think/skills/frontend-design-landing-page - frontend-design-landing-page — ProSkillsMD/proskills0 reactions · 2 comments
- Sep 26, 2026[Candidate] cloudflare/vibesdk/worker/agents/think/skills/frontend-design - frontend-design — ProSkillsMD/proskills0 reactions · 1 comment
- Sep 26, 2026[Candidate] cloudflare/vibesdk/worker/agents/think/skills/app-file-structure - cloudflare-bundler-apps — ProSkillsMD/proskills0 reactions · 1 comment
- Sep 12, 2026Architecture review: Cloudflare first-party VibeSDK and Workers for Platforms patterns — Midtown-Technology-Group/Wrangnarok0 reactions · 2 comments
- Sep 12, 2026Study Cloudflare-native FOSS platforms for reusable architecture and cost patterns — Midtown-Technology-Group/Wrangnarok0 reactions · 1 comment
On Hacker News · 5
- Sep 23, 2025VibeSDK: Open-source vibe coding platform3 points
- Nov 19, 2025VibeSDK/Cloudflare2 points
- Dec 9, 2025Zero Lines of code. 1 AI prompt. 1 deployed website1 point
- Nov 20, 2025Cloudflare Vibe SDK1 point
- Sep 30, 2025Vibesdk: Cloudflare's open source AI-coding app toolkit1 point
On Bluesky · 3
- Dec 20, 2025Build your own vibe-coding platform on Cloudflare's stack - open source and powerful! https://github.com/cloudflare/vibesdk — @u11g.com1 likes and repost
- Dec 8, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 cloudflare / vibesdk ⭐ 3,516 (+149) 🗒 TypeScript An open-source vibe coding platform that helps you… — @github-trending-js.bsky.social1 likes and repost
- Dec 8, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 cloudflare / vibesdk ⭐ 3,516 (+149) 🗒 TypeScript An open-source vibe coding platform that helps you… — @github-trending.bsky.social1 likes and repost
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- cloudflare-bundler-appsSkill
- frontend-design-landing-pageSkill
- frontend-design-saasSkill
- frontend-designSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

