Workers SDK Agent Rules

Wrangler and the toolchain for Cloudflare Workers.

Overview

Workers SDK opens by forbidding copied facts that will go stale. The rest covers commands, a task-to-location table, work shared across tools, and tests, while package files hold subsystem details.

Documents

├── AGENTS.mdeach package's own AGENTS.md
├──  · imports AGENTS.md
├── .changeset
│   └── 
├── .github
│   └── PULL_REQUEST_TEMPLATE.md · unavailable at this commit
└── packages
    ├── auto-triage-bot
    │   └── 
    ├── create-cloudflare
    │   └── 
    ├── miniflare
    │   └── 
    ├── vite-plugin-cloudflare
    │   └── 
    ├── vitest-plugin
    │   └── 
    ├── workers-auth
    │   └── 
    ├── workers-utils
    │   └── 
    └── wrangler
        └── 

Techniques in this file

01 / Pointing at the source of truth

A stated policy against copying

The file refuses to copy versions, rule lists, or counts that will go stale. Later sections follow through: the root package file owns scripts, and one validation command replaces a copied list of lint rules.

Source excerpt starting at line 4.
monorepo. Prefer authoritative configuration and documentation over copyingdetails into this file: copied versions, rule lists, and counts become stale.

02

A table indexed by task, not by directory

Fourteen rows map a thing the agent might be asked to do onto the location that handles it, with a note on each. The first column is the task rather than the path, so the table is read by intent.

03

A rule about which layer a feature belongs in

Three tools share the development platform, so a feature is incomplete if only one can use it. Common behavior belongs in the shared layer; integration layers stay thin, and intentional gaps go in the pull request.

Source excerpt starting at line 61.
Workers development platform. A development feature is not complete merelybecause it works through one of them.

04 / Nested instruction files

Package files kept current in the same change

Packages have local instruction files. Read the closest one before editing, and update it in the same change if it becomes inaccurate. The root file also states which guidance belongs at each level.

05 / Hard prohibitions

One security rule with its linter

Shell commands may not be built from interpolated or concatenated untrusted input, and the custom lint rule that enforces it is named.

Ideas for your repo

  1. Put anti-drift rules beside the values they protect; identify versions, counts, and copied lists likely to rot.
  2. Index your repo map by task rather than by directory. Agents arrive with an intent, not a path.
  3. If several tools consume one platform, state which layer a feature belongs in and that one consumer is not done.
  4. Require the package instruction file to be updated in the same change that makes it wrong.
Sponsored byModem

Give your agents the whole story.

These instructions explain how to work in Workers SDK. Modem shows your agents what customers said, who is affected, and what changed.

See how Modem works