cloudflare
Cloudflare Workers, KV, D1, R2, Pages, and Wrangler CLI. Use when deploying to the edge, configuring Workers, managing storage bindings, or setting up Cloudflare Pages.
What this skill does
# Cloudflare
## Overview
Cloudflare Workers is a serverless edge compute platform that runs JavaScript, TypeScript, and WebAssembly on Cloudflare's global network. Workers use the ES modules format with `fetch`, `scheduled`, and `queue` event handlers, and access platform services (KV, D1, R2, Durable Objects) through environment bindings.
**When to use:** Edge-first APIs, low-latency global apps, serverless functions, static site hosting with Pages, key-value caching, relational data at the edge, object storage without egress fees.
**When NOT to use:** Long-running compute exceeding CPU time limits, workloads requiring persistent TCP connections, applications needing full Node.js API compatibility, large monolithic applications better suited to containers.
## Quick Reference
| Pattern | API / Config | Key Points |
| --------------------- | ---------------------------------------------------- | -------------------------------------------- |
| Fetch handler | `export default { fetch(request, env, ctx) }` | Entry point for HTTP requests |
| Scheduled handler | `export default { scheduled(controller, env, ctx) }` | Cron triggers via `[triggers]` in config |
| Environment variables | `env.VAR_NAME` | Set in wrangler.toml or dashboard |
| KV read/write | `env.KV.get(key)` / `env.KV.put(key, value)` | Eventually consistent, 25 MiB max value |
| D1 query | `env.DB.prepare(sql).bind(...params).all()` | SQLite at the edge, prepared statements |
| D1 batch | `env.DB.batch([stmt1, stmt2])` | Atomic transaction, single round trip |
| R2 upload | `env.BUCKET.put(key, body)` | S3-compatible, no egress fees |
| R2 download | `env.BUCKET.get(key)` | Returns `R2ObjectBody` with `ReadableStream` |
| Durable Objects | `env.DO.get(id)` then `stub.fetch(request)` | Single-instance stateful coordination |
| DO storage | `this.ctx.storage.sql.exec(query)` | SQLite backend recommended for new DOs |
| Pages deploy | `wrangler pages deploy <dir>` | Static + Functions, auto-generated routes |
| Worker deploy | `wrangler deploy` | Reads wrangler.toml for config |
| Dev server | `wrangler dev` | Local development with bindings |
| Secrets | `wrangler secret put SECRET_NAME` | Encrypted, not in wrangler.toml |
| Static assets | `assets: { directory: "./dist" }` | Served without invoking Worker by default |
| Workflows | `export class MyWorkflow extends WorkflowEntrypoint` | Durable multi-step execution engine |
| Hyperdrive | `env.HYPERDRIVE.connectionString` | Connection pooling for external PostgreSQL |
| Queues produce | `env.QUEUE.send(message)` | Async message passing between Workers |
| Config format | `wrangler.jsonc` (recommended for new projects) | JSON with comments; preferred over TOML |
## Common Mistakes
| Mistake | Correct Pattern |
| ----------------------------------------- | ------------------------------------------------------------- |
| Accessing bindings as globals | Access via `env` parameter in module format |
| Storing secrets in wrangler.toml | Use `wrangler secret put` for encrypted values |
| Using KV for strong consistency | Use D1 or Durable Objects for consistent reads |
| Not binding parameters in D1 queries | Always use `.prepare().bind()` to prevent SQL injection |
| Exceeding KV value size (25 MiB) | Use R2 for objects larger than 25 MiB |
| Forgetting `await` on storage operations | KV, D1, R2 methods are all async |
| Using `fetch()` without passing `signal` | Pass `request.signal` for automatic cancellation |
| Creating D1 database in Worker code | Create with `wrangler d1 create`, bind in config |
| Missing `compatibility_date` in config | Always set to avoid breaking changes |
| Returning non-Response from fetch handler | Must return a `Response` object |
| Using `wrangler.toml` for new projects | Use `wrangler.jsonc` for new projects; has better IDE support |
| Using KV for relational queries | Use D1 for SQL queries; KV is key-value only |
## Delegation
- **Architecture review**: Use `Task` agent to evaluate edge vs origin patterns
- **Code review**: Delegate to `code-reviewer` agent
- **Storage selection**: Use `Explore` agent to compare KV vs D1 vs R2 vs DO
## References
- [Workers syntax, fetch handler, scheduled events, and bindings](references/workers.md)
- [KV, D1, R2, and Durable Objects storage APIs](references/storage.md)
- [Cloudflare Pages, functions, routes, and build configuration](references/pages.md)
- [Wrangler CLI, configuration, dev server, deploy, and secrets](references/wrangler.md)
Related 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.