cloudflare-workers-testing

cloudflare-workers-testing is a skill for Claude Code, Codex from secondsky/claude-skills. It costs 57 tokens per session (5,502 once invoked), scanned A, original, MIT.

A guide to testing Cloudflare Workers with Vitest and the Workers testing pool. It covers unit tests, which check small pieces of code, and integration tests, which check how parts work together, including simulated D1, KV, R2, and Durable Object storage.

In plain words
What is it for?
Use it to configure tests, mock Workers storage and services, test request handling, and run the same checks in CI/CD.
Why use it?
It makes it possible to test Workers-specific behavior locally and catch binding, execution, coverage, and runtime problems before deployment.

Skill for Claude CodeCodex

Part of the cloudflare-workers plugin — 10 skills, 5 commands, 3 agents shipped together

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/secondsky/claude-skills/cloudflare-workers-testing
Any agent
npx skills add secondsky/claude-skills --skill cloudflare-workers-testing
Clone the repo
git clone --depth 1 https://github.com/secondsky/claude-skills

Made for: Claude Code, Codex.

Or install cloudflare-workers, the plugin that ships this one along with the rest of its 10 skills, 5 commands, 3 agents.

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-workers-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/secondsky/claude-skills/cloudflare-workers-testing.svg)](https://agentmods.dev/skills/secondsky/claude-skills/cloudflare-workers-testing)
Your own site
<a href="https://agentmods.dev/skills/secondsky/claude-skills/cloudflare-workers-testing"><img src="https://agentmods.dev/badge/skills/secondsky/claude-skills/cloudflare-workers-testing.svg" alt="Measured on agentmods" height="20"></a>
Per session 57 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,502 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00057 $0.05502
Opus 5 $0.00028 $0.02751
Sonnet 5 $0.00011 $0.01100
Haiku 4.5 $0.00006 $0.00550

Measured yesterday against content hash 3dc319e7c7c5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cloudflare-workers-testing scanned grade A with 1 finding 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 yesterday.

The scan reads SKILL.md. This mod also ships 5 executable files (scripts/run-tests.sh, scripts/setup-vitest.sh, templates/basic-test.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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

const response = await worker.fetch(request, env, ctx);
plugins/cloudflare-workers/skills/cloudflare-workers-testing/SKILL.md · 815 lines

How it starts

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

Cloudflare Workers Testing with Vitest

Status: ✅ Production Ready | Last Verified: 2025-01-27 Vitest: ^2.0.0 | @cloudflare/vitest-pool-workers: 0.7.2 | Miniflare: Latest

Table of Contents


What Is Workers Testing?

Testing Cloudflare Workers with Vitest and @cloudflare/vitest-pool-workers enables writing unit and integration tests that run in a real Workers environment with full binding support (D1, KV, R2, Durable Objects, Queues, AI). Tests execute in Miniflare for local development and can run in CI/CD with actual Workers runtime behavior.

Key capabilities: Binding mocks, execution context testing, edge runtime simulation, coverage tracking, fast test execution.


New in 2025

@cloudflare/vitest-pool-workers 0.7.2 (January 2025):

  • BREAKING: Miniflare v3 → requires Node.js 20+
  • NEW: cloudflare:test module for env/ctx access
  • IMPROVED: Faster isolated storage for bindings
  • FIXED: Worker-to-worker service bindings now work correctly
  • ADDED: Support for Vectorize and Workers AI bindings

Migration from older versions:

# Update dependencies
bun add -D vitest@^2.1.8 @cloudflare/vitest-pool-workers@^0.7.2

# Update vitest.config.ts (new pool configuration format)
export default defineWorkersConfig({
  test: {
    poolOptions: {
      workers: {
        wrangler: { configPath: './wrangler.jsonc' },
        miniflare: { compatibilityDate: '2025-01-27' }
      }
    }
  }
});

Quick Start (5 Minutes)

1. Install Dependencies

bun add -D vitest @cloudflare/vitest-pool-workers

Read the full file on GitHub · 815 lines

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. yesterday First seen · 815 lines · 57 tokens per session scan A 3dc319e7c7c5

Subscribe to this mod's changes

cloudflare-workers-testing is a skill published in the GitHub repository secondsky/claude-skills (214 stars, last pushed 2d ago), licensed MIT. It adds 57 tokens to every session and 5,502 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.