Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/secondsky/claude-skills/cloudflare-workers-runtime-apisnpx skills add secondsky/claude-skills --skill cloudflare-workers-runtime-apisgit clone --depth 1 https://github.com/secondsky/claude-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/secondsky/claude-skills/cloudflare-workers-runtime-apis)<a href="https://agentmods.dev/skills/secondsky/claude-skills/cloudflare-workers-runtime-apis"><img src="https://agentmods.dev/badge/skills/secondsky/claude-skills/cloudflare-workers-runtime-apis.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00054 | $0.02122 |
| Opus 5 | $0.00027 | $0.01061 |
| Sonnet 5 | $0.00011 | $0.00424 |
| Haiku 4.5 | $0.00005 | $0.00212 |
Grade B, and why
cloudflare-workers-runtime-apis scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Sends data to an external URLmediumData exfiltration
A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.
const postResponse = await fetch('https://api.example.com/users', { method: 'POST', Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
async fetch(request: Request, env: Env): Promise<Response> { How it starts
The opening of the file, as written. The whole thing — 291 lines — stays where its author put it; the contents beside it link to each section on GitHub.
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
export default {
async fetch(request: Request, env: Env): Promise<Response> {
// Basic fetch
const response = await fetch('https://api.example.com/data');
// With options
const postResponse = await fetch('https://api.example.com/users', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${env.API_KEY}`,
},
body: JSON.stringify({ name: 'John' }),
});
// Clone for multiple reads
const clone = response.clone();
const json = await response.json();
const text = await clone.text();
return Response.json(json);
}
};
Critical Rules
- Always set timeouts for external requests - Workers have a 30s limit, external APIs can hang
- Clone responses before reading body - Body can only be read once
- Use streaming for large payloads - Don't buffer entire response in memory
- Cache external API responses - Reduce latency and API costs
- Handle Crypto operations in try/catch - Invalid inputs throw errors
- 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 |
What ships with it
10 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- references/cache-api.md 6.9 KB
- references/crypto-api.md 8.7 KB
- references/encoding-api.md 7.4 KB
- references/fetch-api.md 8.5 KB
- references/streams-api.md 8.9 KB
- references/websockets.md 8.7 KB
- templates/crypto-operations.ts 9.7 KB runs code
- templates/fetch-patterns.ts 8.6 KB runs code
- templates/stream-processing.ts 8.8 KB runs code
- templates/websocket-handler.ts 8.6 KB runs code
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 291 lines · 54 tokens per session scan B f4a3c1bed4b3
cloudflare-workers-runtime-apis is a skill published in the GitHub repository secondsky/claude-skills (214 stars, last pushed 3d ago), licensed MIT. It adds 54 tokens to every session and 2,122 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it B with 2 findings (sends data to an external url, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
remember
Record why something is the way it is — a decision and its reasoning, a lesson that cost time, or a standing constraint. Use when the reasoning behind a choice would be expensive to reconstruct later.
milestone
Record a change that reshaped the repository — what moved, why it was worth doing, and which areas it touched. Use after a migration, a rewrite, or a decision that changed how part of the system works.
resume
Write down where this stretch of work stopped, so the next session continues instead of restarting. Use at the end of a working session, or when handing the repository to someone else.
bootstrap
Set up chamnan in this repository for the first time — build the architecture index, measure how well the code describes itself, fill in missing file comments, and record a baseline. Run once per repo.
capture
Write down a procedure worth keeping — a multi-step process, a trap that cost real time, or something that has now come up three times. Use it the moment you finish such a task, while the details are still exact.
promote
Turn a scratch script into a permanent tool this repo keeps. Use when a check, report, or analysis has proved worth running more than once.