Skip to content

sb-dev/openquant / .agents/skills/durable-objects

durable-objects

Verified

Build, debug, or review Cloudflare Durable Objects code for persistent state and coordination.

FileKindSize
SKILL.mdskill md6.1 KB
references/rules.mdmarkdown2.8 KB
references/skill-feedback.mdmarkdown2.7 KB
references/testing.mdmarkdown2.5 KB
references/workers.mdmarkdown7.8 KB

references/testing.md

View on GitHub
# Testing Durable Objects

Use Cloudflare’s Vitest integration to exercise Durable Objects in the Workers runtime. Before changing an existing suite, inspect its installed Vitest/Cloudflare packages, configuration, and test scripts. Follow the matching API or migration guide; adding a test does not by itself require migrating the suite.

Fetch the relevant current documentation before writing setup or test code:

| Task | Documentation |
|------|---------------|
| Install compatible packages, configure Vitest and Wrangler, generate test types, run tests | [Write your first test](https://developers.cloudflare.com/workers/testing/vitest-integration/write-your-first-test/index.md) |
| Migrate an existing pool-based suite | [Migrate to Vitest plugin](https://developers.cloudflare.com/workers/testing/vitest-integration/migration-guides/migrate-to-vitest-plugin/index.md) |
| Configure bindings, runtime options, or multiple Workers | [Vitest configuration](https://developers.cloudflare.com/workers/testing/vitest-integration/configuration/index.md) |
| Test RPC, Worker HTTP routes, instance separation, SQLite storage, and alarms | [Testing Durable Objects](https://developers.cloudflare.com/durable-objects/examples/testing-with-durable-objects/index.md) |
| Inspect internals, enumerate instances, or trigger scheduled alarms with test helpers | [Test APIs](https://developers.cloudflare.com/workers/testing/vitest-integration/test-apis/index.md) |
| Choose state cleanup and concurrency behavior | [Isolation and concurrency](https://developers.cloudflare.com/workers/testing/vitest-integration/isolation-and-concurrency/index.md) |

Choose tests around the behavior being changed:

- Use RPC tests for object behavior and HTTP integration tests for Worker routing and response contracts.
- Verify that one object retains state across calls and different object identities remain independent. Inspect SQLite state when persistence itself is the contract under test; repeated calls alone do not prove recovery after restart.
- For alarms, verify the scheduled work’s effects and any rescheduling or cancellation, using the documented helper to avoid waiting for wall-clock time.
- Check the installed integration’s isolation model before reusing object names. Use separate identities or explicit cleanup where state is shared between tests.

Keep package versions, imports, configuration, helper signatures, and runnable examples in the linked documentation rather than copying them into this reference.
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 319kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 319kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 319kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 196kUpdated Claude CodeCodexVerifiedInstall