cloudflare-workers:test-setup

cloudflare-workers:test-setup is a command for Claude Code from secondsky/claude-skills. It costs 37 tokens per session (2,166 once invoked), scanned A, original, MIT.

An interactive setup wizard for testing Cloudflare Workers with Vitest, a JavaScript and TypeScript testing tool. It configures test support and mocks services such as databases, storage, queues, and AI bindings.

In plain words
What is it for?
Use it to create unit tests, integration tests, test configuration, service mocks, and example tests for an existing Workers project.
Why use it?
It removes the manual work of deciding how to test a Worker and how to imitate the Cloudflare services it uses during tests.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the AskUserQuestion tool.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { Env } from '../src/index';.

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

Good fit Use it to create unit tests, integration tests, test configuration, service mocks, and example tests for an existing Workers project.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/secondsky/claude-skills
agentmods
npx agentmods add commands/secondsky/claude-skills/workers-test-setup

Made for: Claude Code.

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

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:test-setup

README.md
[![agentmods](https://agentmods.dev/badge/commands/secondsky/claude-skills/workers-test-setup/github.svg)](https://agentmods.dev/commands/secondsky/claude-skills/workers-test-setup)
Your own site
<a href="https://agentmods.dev/commands/secondsky/claude-skills/workers-test-setup"><img src="https://agentmods.dev/badge/commands/secondsky/claude-skills/workers-test-setup/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-workers:test-setup

Your own site · 80×15
<a href="https://agentmods.dev/commands/secondsky/claude-skills/workers-test-setup"><img src="https://agentmods.dev/badge/commands/secondsky/claude-skills/workers-test-setup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 37 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,166 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00037 $0.02166
Opus 5.5 $0.00015 $0.00866
Sonnet 5.5 $0.00007 $0.00433
Haiku 4.5 $0.00004 $0.00217

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

Security

Grade A, and why

cloudflare-workers:test-setup 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 1mo 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.

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/commands/workers-test-setup.md · 340 lines

How it starts

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

Workers Test Setup Command

Set up comprehensive testing for Cloudflare Workers using Vitest and @cloudflare/vitest-pool-workers.

Execution Workflow

Phase 1: Detection - Analyze Current Setup

Read the project to understand its current state:

  1. Check if package.json exists
  2. Check if vitest.config.ts or vitest.config.js exists
  3. Check if wrangler.jsonc or wrangler.toml exists
  4. Detect bindings used in the Worker (D1, KV, R2, DO, Queues, AI)
  5. Check if any tests already exist (**/*.test.ts, **/*.spec.ts)

Store findings for later phases.

Phase 2: User Preferences - Ask Questions

Use AskUserQuestion to gather preferences:

Question 1: "What type of tests do you want to set up?"

  • Options:
    • Unit tests only (fast, isolated function testing)
    • Integration tests only (full request/response testing)
    • Both unit and integration tests (Recommended)

Question 2: "Which bindings do you need to mock?"

  • MultiSelect: true
  • Options (based on detection):
    • D1 (SQLite database)
    • KV (key-value storage)
    • R2 (object storage)
    • Durable Objects (stateful coordination)
    • Queues (message queues)
    • Workers AI (AI inference)
    • Vectorize (vector database)
    • None (no bindings used)

Question 3: "Do you want code coverage reporting?"

  • Options:
    • Yes, with coverage thresholds (Recommended)
    • Yes, without thresholds
    • No

Phase 3: Validation - Check Prerequisites

Before proceeding, validate:

  1. Node.js/Bun installed: Run node --version or bun --version

  2. package.json exists:

    • If not, abort with error: "No package.json found. Run npm init or bun init first."
  3. Wrangler configured:

    • If no wrangler.jsonc/toml, warn: "No wrangler config found. Tests may need manual binding configuration."
  4. No existing vitest.config:

    • If exists, ask: "vitest.config already exists. Overwrite?"
    • If user says no, abort gracefully

Read the full file on GitHub · 340 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. 1mo ago First seen · 340 lines · 37 tokens per session scan A 6a796f103a75

Subscribe to this mod's changes

cloudflare-workers:test-setup is a command published in the GitHub repository secondsky/claude-skills (231 stars, last pushed today), licensed MIT. It adds 37 tokens to every session and 2,166 once invoked, about $0.0001 per session on Opus 5.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.