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

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.

agentmods
npx agentmods add skills/d-o-hub/github-template-ai-agents/cloudflare-worker-api
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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
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 $0.00074 $0.00565
Opus 5 $0.00037 $0.00282
Sonnet 5 $0.00015 $0.00113
Haiku 4.5 $0.00007 $0.00056

Measured 4d ago against content hash 0036391b4167, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 4d 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.

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

3 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. 4d 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.0004 per session on Opus 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.

Related

Other skills, from other repositories

design-impact-reporting

Communicate design's contribution to business and user outcomes in stakeholder language. Use when reporting results upward. For choosing the metrics in the first place, use metrics-definition (ux-strategy).

Owl-Listener/designer-skills · 44 tokens

motion-system

Define motion tokens — durations, easing vocabulary, and reduced-motion handling — for consistency product-wide. Use when standardising motion across a system. For crafting one specific animation, use animation-principles (interaction-design).

Owl-Listener/designer-skills · 48 tokens

version-control-strategy

Define version control for design files, components, and libraries — branching, naming, and release. Use when file history is chaotic. For design system contribution rules, use design-system-governance (design-systems).

Owl-Listener/designer-skills · 50 tokens

design-token-audit

Audit token usage across a product for coverage, drift, and hard-coded values. Use when tokens exist and you suspect they are being bypassed. For defining tokens in the first place, use design-token (design-systems).

Owl-Listener/designer-skills · 52 tokens

design-token

Define and organise tokens for colour, spacing, type, and elevation with naming and usage rules. Use when establishing the token layer. For auditing existing usage use design-token-audit (designer-toolkit); for multi-brand mapping use theming-system.

Owl-Listener/designer-skills · 55 tokens

api-test-suite-builder

Scans API route definitions across frameworks (Next.js App Router, Express, FastAPI, Django REST) and auto-generates comprehensive test suites covering auth, input validation, error codes, pagination, file uploads, and rate limiting. Outputs ready-to-run test files for Vitest+Supertest (Node) or Pytest+httpx (Python).

seaworld008/Commonly-used-high-value-skills · 75 tokens