cloudflare-workers:test-setup

cloudflare-workers:test-setup is a command for coding agents 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

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 commands/secondsky/claude-skills/workers-test-setup
Clone the repo
git clone --depth 1 https://github.com/secondsky/claude-skills

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

README.md
[![agentmods](https://agentmods.dev/badge/commands/secondsky/claude-skills/workers-test-setup.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.svg" alt="Measured on agentmods" 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. 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.00037 $0.02166
Opus 5 $0.00018 $0.01083
Sonnet 5 $0.00007 $0.00433
Haiku 4.5 $0.00004 $0.00217

Measured yesterday against content hash 6a796f103a75, 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: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 yesterday.

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. yesterday 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 (214 stars, last pushed yesterday), licensed MIT. It adds 37 tokens to every session and 2,166 once invoked, about $0.0002 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.