cloudflare-workers
Rapid development with Cloudflare Workers - build and deploy serverless applications on Cloudflare's global network. Use when building APIs, full-stack web apps, edge functions, background jobs, or real-time applications. Triggers on phrases like "cloudflare workers", "wrangler", "edge computing", "serverless cloudflare", "workers bindings", or files like wrangler.toml, worker.ts, worker.js.
What this skill does
# Cloudflare Workers
## Overview
Cloudflare Workers is a serverless execution environment that runs JavaScript, TypeScript, Python, and Rust code on Cloudflare's global network. Workers execute in milliseconds, scale automatically, and integrate with Cloudflare's storage and compute products through bindings.
**Key Benefits:**
- **Zero cold starts** - Workers run in V8 isolates, not containers
- **Global deployment** - Code runs in 300+ cities worldwide
- **Rich ecosystem** - Bindings to D1, KV, R2, Durable Objects, Queues, Containers, Workflows, and more
- **Full-stack capable** - Build APIs and serve static assets in one project
- **Standards-based** - Uses Web APIs (fetch, crypto, streams, WebSockets)
## When to Use This Skill
Use Cloudflare Workers for:
- **APIs and backends** - RESTful APIs, GraphQL, tRPC, WebSocket servers
- **Full-stack applications** - React, Next.js, Remix, Astro, Vue, Svelte with static assets
- **Edge middleware** - Authentication, rate limiting, A/B testing, routing
- **Background processing** - Scheduled jobs (cron), queue consumers, webhooks
- **Data transformation** - ETL pipelines, real-time data processing
- **AI applications** - RAG systems, chatbots, image generation with Workers AI
- **Durable workflows** - Multi-step long-running tasks with automatic retries (Workflows)
- **Container workloads** - Run Docker containers alongside Workers (Containers)
- **MCP servers** - Host remote Model Context Protocol servers
- **Proxy and gateway** - API gateways, content transformation, protocol translation
## Quick Start Workflow
### 1. Install Wrangler CLI
```bash
npm install -g wrangler
# Login to Cloudflare
wrangler login
```
### 2. Create a New Worker
```bash
# Using C3 (create-cloudflare) - recommended
npm create cloudflare@latest my-worker
# Or create manually
wrangler init my-worker
cd my-worker
```
### 3. Write Your Worker
**Basic HTTP API (TypeScript):**
```typescript
export default {
async fetch(request: Request, env: Env): Promise<Response> {
const url = new URL(request.url);
if (url.pathname === "/api/hello") {
return Response.json({ message: "Hello from Workers!" });
}
return new Response("Not found", { status: 404 });
},
};
```
**With environment variables and KV:**
```typescript
interface Env {
MY_VAR: string;
MY_KV: KVNamespace;
}
export default {
async fetch(request: Request, env: Env): Promise<Response> {
// Access environment variable
const greeting = env.MY_VAR;
// Read from KV
const value = await env.MY_KV.get("my-key");
return Response.json({ greeting, value });
},
};
```
### 4. Develop Locally
```bash
# Start local development server with hot reload
wrangler dev
# Access at http://localhost:8787
```
### 5. Deploy to Production
```bash
# Deploy to workers.dev subdomain
wrangler deploy
# Deploy to custom domain (configure in wrangler.toml)
wrangler deploy
```
## Core Concepts
### Workers Runtime
Workers use the V8 JavaScript engine with Web Standard APIs:
- **Execution model**: Isolates (not containers) - instant cold starts
- **CPU time limit**: 10ms (Free), 30s (Paid) per request
- **Memory limit**: 128 MB per isolate
- **Languages**: JavaScript, TypeScript, Python, Rust
- **APIs**: fetch, crypto, streams, WebSockets, WebAssembly
**Supported APIs:**
- Fetch API (HTTP requests)
- URL API (URL parsing)
- Web Crypto (encryption, hashing)
- Streams API (data streaming)
- WebSockets (real-time communication)
- Cache API (edge caching)
- HTML Rewriter (HTML transformation)
### Handlers
Workers respond to events through handlers:
**Fetch Handler** (HTTP requests):
```typescript
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext) {
return new Response("Hello!");
},
};
```
**Scheduled Handler** (cron jobs):
```typescript
export default {
async scheduled(event: ScheduledEvent, env: Env, ctx: ExecutionContext) {
// Runs on schedule defined in wrangler.toml
await env.MY_KV.put("last-run", new Date().toISOString());
},
};
```
**Queue Handler** (message processing):
```typescript
export default {
async queue(batch: MessageBatch<any>, env: Env, ctx: ExecutionContext) {
for (const message of batch.messages) {
await processMessage(message.body);
message.ack();
}
},
};
```
### Bindings
Bindings connect your Worker to Cloudflare resources. Configure in `wrangler.toml`:
**KV (Key-Value Storage):**
```toml
[[kv_namespaces]]
binding = "MY_KV"
id = "your-kv-namespace-id"
```
```typescript
// Usage
await env.MY_KV.put("key", "value");
const value = await env.MY_KV.get("key");
```
**D1 (SQL Database):**
```toml
[[d1_databases]]
binding = "DB"
database_name = "my-database"
database_id = "your-database-id"
```
```typescript
// Usage
const result = await env.DB.prepare(
"SELECT * FROM users WHERE id = ?"
).bind(userId).all();
```
**R2 (Object Storage):**
```toml
[[r2_buckets]]
binding = "MY_BUCKET"
bucket_name = "my-bucket"
```
```typescript
// Usage
await env.MY_BUCKET.put("file.txt", "contents");
const object = await env.MY_BUCKET.get("file.txt");
const text = await object?.text();
```
**Environment Variables (non-secret only):**
```toml
[vars]
GREETING = "hello"
ENVIRONMENT = "development"
```
**Secrets** (sensitive data — never put in wrangler.toml):
```bash
# Set via CLI; the value is encrypted server-side and never written to disk locally
wrangler secret put MY_API_KEY
```
### Context (ctx)
The `ctx` parameter provides control over request lifecycle:
```typescript
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext) {
// Run tasks after response is sent
ctx.waitUntil(
env.MY_KV.put("request-count", String(Date.now()))
);
// Pass through to origin on exception
ctx.passThroughOnException();
return new Response("OK");
},
};
```
### Top-level Environment Access
Since March 2025, you can import `env` at the module level instead of passing it through handlers:
```typescript
import { env } from "cloudflare:workers";
// Access bindings outside of handlers
const apiClient = new ApiClient({ apiKey: env.API_KEY });
export default {
async fetch(request: Request): Promise<Response> {
// env is also available here without the parameter
const data = await env.MY_KV.get("config");
return Response.json({ data });
},
};
```
This eliminates prop-drilling `env` through function signatures and enables module-level initialization.
## Rapid Development Patterns
### Wrangler Configuration
**Essential `wrangler.toml`:**
```toml
name = "my-worker"
main = "src/index.ts"
compatibility_date = "2025-09-01"
# Custom domain
routes = [
{ pattern = "api.example.com/*", zone_name = "example.com" }
]
# Or workers.dev subdomain
workers_dev = true
# Environment variables
[vars]
ENVIRONMENT = "production"
# Bindings
[[kv_namespaces]]
binding = "CACHE"
id = "your-kv-id"
[[d1_databases]]
binding = "DB"
database_name = "production-db"
database_id = "your-db-id"
[[r2_buckets]]
binding = "ASSETS"
bucket_name = "my-assets"
# Cron triggers
[triggers]
crons = ["0 0 * * *"] # Daily at midnight
```
### Environment Management
Use environments for staging/production:
```toml
[env.staging]
vars = { ENVIRONMENT = "staging" }
[env.staging.d1_databases]
binding = "DB"
database_name = "staging-db"
database_id = "staging-db-id"
[env.production]
vars = { ENVIRONMENT = "production" }
[env.production.d1_databases]
binding = "DB"
database_name = "production-db"
database_id = "production-db-id"
```
```bash
# Deploy to staging
wrangler deploy --env staging
# Deploy to production
wrangler deploy --env production
```
### Common Patterns
**JSON API with Error Handling:**
```typescript
export default {
async fetch(request: Request, env: Env): Promise<Response> {
try {
const url = new URL(request.url);
if (url.pathname === "/api/users" && request.method === "GET") {
const userRelated in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.