agentleFS
swyxioswyxio/skills/agents-sdk/SKILL.md

agents-sdk

Skill176 starsChanged 7 months agoMITView on GitHub

Build or debug stateful applications that specifically use Cloudflare's `agents` package, including Agent classes, routing, callable methods, synchronized state, scheduling, AIChatAgent, durable execution, or Agents SDK client hooks. Do not trigger for generic AI-agent design, the OpenAI Agents SDK, or ordinary Durable Object work that does not use the Cloudflare Agents SDK.

We split this skill into the rules it gives an agent

8 rules. 0 are common, 6 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 31 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use current Cloudflare documentation and the installed agents package as the contract.

    line 8
  2. Distinctive:

    Read the project's package version, Wrangler configuration, Agent exports, routing entrypoint, and generated binding types.

    line 14
  3. Distinctive:

    Treat persisted Agent state, connection state, scheduled work, and client UI state as separate surfaces.

    line 27
  4. Distinctive:

    Use stable operation identities for work that may be retried or resumed.

    line 31
  5. Very specific:

    Keep routing and client naming consistent.

    line 36
  6. Distinctive:

    Treat experimental integrations as version-specific.

    line 38
  7. Distinctive:

    Read current first-party docs before relying on limits, package names, configuration fields, or experimental availability.

    line 54
  8. Distinctive:

    Run the narrow type, route, and state tests for the changed seam.

    line 59

“Common” is measured: kept by at least 6 in 10 of the 31 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Cloudflare Agents SDK

Use current Cloudflare documentation and the installed agents package as the contract. APIs in this SDK evolve quickly; do not trust remembered signatures or examples without checking the relevant version.

Inspect first

  1. Read the project's package version, Wrangler configuration, Agent exports, routing entrypoint, and generated binding types.
  2. Retrieve the current docs for the feature being changed.
  3. Inspect installed exports and .d.ts files before adding casts or adapters.
  4. Identify the Agent instance name and who is authorized to select it. Instance naming is a state-partition and access-control decision, not just a URL detail.

Agents require Durable Objects. Verify the exact class export, binding, and lifecycle declaration used by the target environment. Do not copy a migration or configuration example without checking the current lifecycle model.

Preserve the runtime contract

  • Treat persisted Agent state, connection state, scheduled work, and client UI state as separate surfaces.
  • Validate client-originated state and callable methods at the server boundary; a callable method is not authorization by itself.
  • Use stable operation identities for work that may be retried or resumed.
  • Distinguish ordinary request work from SDK durable-execution primitives. Use the latter only when work must survive Durable Object eviction or restart.
  • Expect the Agent constructor and in-memory state to be recreated. Persist anything required after eviction.
  • Keep routing and client naming consistent. Test the actual route through routeAgentRequest or the project's custom router.
  • Treat experimental integrations as version-specific. Pin and test the seam rather than spreading preview types through domain code.

Load only the relevant reference

NeedReference
State, SQL, schedules, or alarmsstate-scheduling.md
Callable RPC, streaming, or timeoutscallable.md
Routing, bindings, or project setuprouting.md, configuration.md
React/browser clients or chat streamingclient-sdk.md, streaming-chat.md
Server-driven turns or approval flowsserver-driven-messages.md, human-in-the-loop.md
Workflows, fibers, queues, or retriesworkflows.md, durable-execution.md, queue-retries.md
MCP, email, webhooks, push, or observabilitymcp.md, email.md, webhooks-push.md, observability.md
Preview featuresthink.md, voice.md, codemode.md, browse-the-web.md

Read current first-party docs before relying on limits, package names, configuration fields, or experimental availability.

Verify proportionally

Run the narrow type, route, and state tests for the changed seam. For connection or recovery behavior, test disconnect/reconnect and a recreated Agent instance. For scheduled or durable work, prove that duplicate delivery converges and that the persisted result—not an in-memory flag—defines completion.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.