cloudflare-worker-api

cloudflare-worker-api is a skill for Claude Code, Codex from d-o-hub/github-template-ai-agents. It costs 74 tokens per session (565 once invoked), scanned A, original, MIT.

A set of patterns for building API routes and request handlers in Cloudflare Workers, a platform for running server-side JavaScript or TypeScript at Cloudflare's edge. It covers route structure, validation, authentication middleware, and response formatting.

In plain words
What is it for?
Use it to define Worker endpoints, validate inputs with Zod, check sessions, create response helpers, build signed file-access URLs, and configure CORS and rate limiting.
Why use it?
It gives API endpoints a consistent structure and helps catch invalid requests. It also keeps protected routes, public rate limits, cross-origin access, and secure file links organised.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it to define Worker endpoints, validate inputs with Zod, check sessions, create response helpers, build signed file-access URLs, and configure CORS and rate limiting.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/d-o-hub/github-template-ai-agents/cloudflare-worker-api
Install

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.

Any agent
npx skills add d-o-hub/github-template-ai-agents --skill cloudflare-worker-api
Clone the repo
git clone --depth 1 https://github.com/d-o-hub/github-template-ai-agents

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for cloudflare-worker-api

README.md
[![agentmods](https://agentmods.dev/badge/skills/d-o-hub/github-template-ai-agents/cloudflare-worker-api/github.svg)](https://agentmods.dev/skills/d-o-hub/github-template-ai-agents/cloudflare-worker-api)
Your own site
<a href="https://agentmods.dev/skills/d-o-hub/github-template-ai-agents/cloudflare-worker-api"><img src="https://agentmods.dev/badge/skills/d-o-hub/github-template-ai-agents/cloudflare-worker-api/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cloudflare-worker-api

Your own site · 80×15
<a href="https://agentmods.dev/skills/d-o-hub/github-template-ai-agents/cloudflare-worker-api"><img src="https://agentmods.dev/badge/skills/d-o-hub/github-template-ai-agents/cloudflare-worker-api.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 74 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 565 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00074 $0.00565
Opus 5.5 $0.00030 $0.00226
Sonnet 5.5 $0.00015 $0.00113
Haiku 4.5 $0.00007 $0.00056

Measured 1mo ago against content hash 0036391b4167, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

cloudflare-worker-api scanned grade A with 0 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 1mo ago.

The scan reads SKILL.md. This mod also ships 3 executable files (evals/files/middleware.ts, evals/files/routes/admin.ts, evals/files/routes/profile.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/cloudflare-worker-api/SKILL.md · 80 lines

How it starts

The opening of the file, as written. The whole thing — 80 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Cloudflare Worker API

Provide a standardized structure for Worker routes, auth middleware, and response helpers.

When to Use

  • User asks to define Cloudflare Worker routes or handlers
  • Building response helpers or typed handler patterns
  • Even if they just say "set up the worker routes" or "add an API endpoint to the worker"

Key Responsibilities

  • Define API routes and handlers.
  • Implement auth middleware and session validation.
  • Provide response helpers for consistent API responses.
  • Design signed URL endpoints for secure file access.

Interface Example

// Example route file structure
src/routes/
  access.ts
  resources.ts
  admin.ts

Constraints

  • No hardcoded secrets.
  • All routes must be typed and validated.
  • Use Zod for input validation.
  • All responses must follow consistent format.

Checklist

  • All routes have input validation with Zod.
  • Error responses follow consistent format.
  • Auth middleware applied to protected routes.
  • Rate limiting configured on public endpoints.
  • CORS headers set appropriately.

References

  • references/routing-patterns.md - Common routing patterns for Workers
  • references/response-helpers.md - Consistent response formatting

See Also

  • secure-invite-and-access — Auth endpoints and permissions
  • api-design-first — API design and OpenAPI specs

Rationalizations

Rationalization Reality
"I'll add auth later, it's just an MVP" Unauthenticated endpoints are immediately exploitable; even internal routes need auth.
"Hardcoded secrets are fine for dev" Dev credentials leak into version control; use environment bindings from day one.
"Rate limiting isn't needed for internal APIs" Compromised internal tokens turn rate-limited services into attack amplifiers.

Red Flags

  • Returning raw error stack traces in API responses
  • Skipping input validation because "the client should handle it"
  • Deploying without CORS configuration on public endpoints

Read the full file on GitHub · 80 lines

Files

What ships with it

6 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.

Changes

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.

  1. 1mo ago First seen · 80 lines · 74 tokens per session scan A 0036391b4167

Subscribe to this mod's changes

cloudflare-worker-api is a skill published in the GitHub repository d-o-hub/github-template-ai-agents (2 stars, last pushed yesterday), licensed MIT. It adds 74 tokens to every session and 565 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.