116
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill einverne/dotfiles --skill cloudflare-workers- SKILL.md32.9 KB
Overview
This skill is a practical, hands-on guide for building serverless applications with Cloudflare Workers. It focuses on developing, testing, configuring bindings, and deploying edge functions using JavaScript, TypeScript, Python, or Rust. The content emphasizes real-world workflows with Wrangler, runtime APIs, caching, and common integrations like KV, R2, and D1.
How this skill works
The skill shows how to structure Workers as ES modules or legacy service workers, implement fetch/scheduled/queue/email/tail handlers, and use Cloudflare runtime APIs (Fetch, Cache, HTMLRewriter, WebSockets, Streams, Web Crypto). It explains Wrangler CLI usage for local dev, deploys, environment management, secrets, and wrangler.toml configuration. Examples demonstrate binding patterns (KV, R2, D1, Durable Objects), caching strategies, and context utilities like ctx.waitUntil and passThroughOnException.
When to use it
- Create new edge APIs, middleware, or static asset handlers at the CDN edge
- Configure and use bindings: KV, R2, D1, Durable Objects, and environment vars
- Test and iterate locally or remotely using Wrangler dev and wrangler tail for logs
- Implement scheduled jobs, message queues, email routing, or WebSocket endpoints
- Optimize response latency with caching, streaming, and HTMLRewriter transformations
Best practices
- Prefer ES module format for new projects and keep handlers small and focused
- Use ctx.waitUntil for background tasks and ctx.passThroughOnException for graceful fallbacks
- Cache aggressively at the edge with custom cache keys and TTLs; validate cache logic in dev
- Store sensitive values with Wrangler secrets and avoid embedding credentials in code
- Monitor with wrangler tail and set up CI/CD pipelines for staged deployments and rollbacks
Example use cases
- Build a low-latency API proxy that adds authentication, caching, and response shaping
- Serve static assets from R2 with edge caching and conditional responses
- Run nightly cleanup or analytics jobs with scheduled handlers and ctx.waitUntil
- Process background messages with queue handlers and persist state in Durable Objects
- Transform HTML responses in-flight using HTMLRewriter to inject headers or remove scripts
FAQ
Choose ES modules for modern development; migrate legacy service workers only when needed.
How do I manage secrets securely?
Use wrangler secret put to store secrets per environment and avoid committing them to source control.
When should I use KV vs R2 vs D1?
Use KV for small key/value lookups, R2 for object storage and large files, and D1 for relational queries and transactional data.