skillfed

cloudflare-workers

This skill equips you to build and deploy serverless functions directly on Cloudflare's global edge infrastructure using JavaScript or TypeScript. Execute compute workloads with minimal latency by leveraging Cloudflare's distributed network, ideal for APIs, middleware, and real-time request handling.

Cloudflare Workers lets you deploy JavaScript or TypeScript functions directly to Cloudflare's global edge network using the Wrangler CLI. Write your function, run `wrangler deploy`, and your code executes with minimal latency across Cloudflare's distributed infrastructure. The skill equips you to build serverless functions that handle APIs, middleware, and real-time request processing without managing servers.

AI-generated summary based on this skill's SKILL.md

44 4 MIT updated by BagelHole

Install

BagelHole/DevOps-Security-Agent-Skills/cloudflare-workers · repository language: Shell

CLI (skillfed)coming soon
git clone https://github.com/BagelHole/DevOps-Security-Agent-Skills
cp -r DevOps-Security-Agent-Skills/infrastructure/cloudflare/cloudflare-workers ~/.claude/skills/cloudflare-workers

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I deploy JavaScript to Cloudflare edge?

Cloudflare Workers lets you deploy JavaScript or TypeScript functions directly to Cloudflare's global edge network using the Wrangler CLI. Write your function, run `wrangler deploy`, and your code executes with minimal latency across Cloudflare's distributed infrastructure. The skill equips you to build serverless functions that handle APIs, middleware, and real-time request processing without managing servers.

What can Cloudflare Workers be used for?

Cloudflare Workers supports multiple use cases: deploy lightweight APIs and microservices with minimal latency, implement middleware for authentication and rate limiting, set up scheduled cron jobs and background tasks, and integrate with Cloudflare storage solutions like KV, D1, and R2 for state management. This skill enables you to execute compute workloads across Cloudflare's edge network for real-time request handling and transformation.

How do I build a serverless API with Wrangler?

Cloudflare Workers uses Wrangler, the official CLI tool, to scaffold, develop, and deploy serverless APIs. Create a new project with Wrangler, write your JavaScript or TypeScript handler functions, test locally with `wrangler dev`, and deploy to production with `wrangler deploy`. This skill teaches you to build lightweight APIs that run on Cloudflare's edge infrastructure with sub-millisecond cold starts and minimal latency.

Can Cloudflare Workers handle authentication and rate limiting?

Yes—Cloudflare Workers excels at implementing middleware for authentication, rate limiting, and request transformation. This skill covers how to intercept requests at the edge, validate credentials, enforce rate limits, and transform payloads before they reach your origin. By running these checks on Cloudflare's distributed network, you reduce latency and protect your backend from abuse.

How do I set up scheduled tasks and cron jobs in Cloudflare Workers?

Cloudflare Workers allows you to set up scheduled cron jobs and background tasks without managing servers. This skill teaches you to define cron triggers in your `wrangler.toml` configuration, write handler functions that execute on a schedule, and integrate with Cloudflare storage or external APIs. Your scheduled tasks run reliably across the edge network without the overhead of traditional server management.

What storage options does Cloudflare Workers support?

Cloudflare Workers integrates with multiple storage solutions for state management: KV for fast key-value caching, D1 for serverless SQL databases, R2 for object storage, and Durable Objects for coordinated state. This skill equips you to choose the right storage backend for your use case, configure it via Wrangler, and access it from your edge functions to build stateful serverless applications.

SKILL.md

rendered from the published skill — quoted content, verbatim

Cloudflare Workers

Deploy JavaScript and TypeScript functions to Cloudflare's global edge network with sub-millisecond cold starts.

When to Use

  • Building lightweight APIs and microservices at the edge.
  • Adding middleware (auth, rate limiting, header injection) in front of origin servers.
  • Running cron jobs on a schedule without maintaining infrastructure.
  • Processing webhooks, image transformations, or A/B testing logic.
  • Serving dynamic content from KV, D1, or R2 storage bindings.

Prerequisites

  • Node.js 18+ installed locally.
  • Wrangler CLI: npm install -g wrangler.
  • Cloudflare account (free plan supports 100,000 requests/day).
  • Authenticated: wrangler login or set CLOUDFLARE_API_TOKEN.

Quick Start

```bash

Scaffold a new Worker project

npm create cloudflare@latest my-worker cd my-worker

Login to Cloudflare

npx wrangler login

Start local development server (port 8787)

npx wrangler dev

Deploy to production

npx

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 1 file
infrastructure/cloudflare/cloudflare-workers/SKILL.md

Related skills

Tags

edge-computing serverless-functions global-cdn api-gateway infrastructure-as-code real-time-logging distributed-storage scheduled-tasks stateful-objects