Agent skill · software engineering · secondsky
cloudflare-workers-runtime-apis
Cloudflare Workers Runtime APIs including Fetch, Streams, Crypto, Cache, WebSockets, and Encoding. Use for HTTP requests, streaming, encryption, caching, real-time connections, or encountering API compatibility, response handling, stream processing errors.
Why this skill is useful
Provides specific patterns and error handling for Cloudflare Workers APIs that the AI wouldn't reliably generate on its own.
What it needs
About 4k tokens when loaded. Last updated 2026-08-06. 204 stars on the source repository.
What this skill does
Cloudflare Workers Runtime APIs Master the Workers runtime APIs: Fetch, Streams, Crypto, Cache, WebSockets, and text encoding. Quick Reference API Purpose Common Use ----- --------- ------------ Fetch HTTP requests External APIs, proxying Streams Data streaming Large files, real-time Crypto Cryptography Hashing, signing, encryption Cache Response caching Performance optimization WebSockets Real-time connections Chat, live updates Encoding Text encoding UTF-8, Base64 Quick Start: Fetch API Critical Rules 1. Always set timeouts for external requests - Workers have a 30s limit, external APIs can hang 2. Clone responses before reading body - Body can only be read once 3. Use streaming for large payloads - Don't buffer entire response in memory 4. Cache external API responses - Reduce latency and API costs 5. Handle Crypto operations in try/catch - Invalid inputs throw errors 6. WebSocket hibernation for cost - Use Durable Objects with hibernation Top 10 Errors Prevented Error Symptom Prevention ------- --------- ------------ Body already read TypeError: Body has already been consumed Clone response before reading Fetch timeout Request hangs, worker times out Use AbortController with timeout Invalid JSON SyntaxError: Unexpected token Check content-type before parsing Stream locked TypeError: ReadableStream is locked Don't read stream multiple times Crypto key error DOMException: Invalid keyData Validate key format and algorithm Cache miss Returns undefined instead of response Check cache before returning WebSocket close Connection drops unexpectedly Handle close event, implement reconnect Encoding error TypeError: Invalid code point Use TextEncoder/TextDecoder properly CORS blocked Browser rejects response Add proper CORS headers Request size 413 Request Entity Too Large Stream large uploads Fetch API Patterns With Timeout With Retry Streams API Transform Stream Stream Large Response Crypto API Hashing HMAC Signing Cache API WebSockets (Durable Objects) When to Load Refe …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills secondsky/cloudflare-workers-runtime-apis