cloudflare/coding-standards
Use when writing or reviewing TypeScript in this repo. Covers the no-`any` rule and where to put new types, the uppercase-acronym style guide, and the rules for code comments (no historical context). (project)
npx skills add https://github.com/cloudflare/sandbox-sdk --skill coding-standards
anyNever use any unless absolutely necessary — and that should be a final resort.
Process when you reach for any:
packages/shared/src/types.ts or relevant subdirectorypackages/sandbox/src/clients/types.ts or the appropriate client filepackages/sandbox-container/src/ with appropriate namingThis catches errors at compile time instead of runtime and keeps the codebase consistent.
When an acronym appears inside a camelCase or PascalCase identifier, keep it fully uppercase:
| ✅ Do | ❌ Don't |
| ----------------- | ----------------- |
| SandboxRPCAPI | SandboxRpcApi |
| containerURL | containerUrl |
| parseHTTPHeader | parseHttpHeader |
| getAPIKey | getApiKey |
Applies to all acronyms: API, URL, HTTP, RPC, SSE, SSH, DNS, ID, etc.
Exception: library-provided names keep their original casing (e.g. capnweb's RpcTarget stays RpcTarget).
Write comments for future readers, not for the current conversation.
Comments should describe the current state of the code. A developer reading the code months later won't have context about bugs that were fixed, conversations that happened, or earlier implementations.
// ❌ Bad: references a bug the reader knows nothing about
// Uses character tracking to avoid the bug where indexOf('') returns wrong position
// ❌ Bad: implies something was wrong before
// Start the server with proper WebSocket typing
// ❌ Bad: "prevent" implies there was a problem to prevent
// Assign synchronously to prevent race conditions
// ✅ Good: describes what the code does now
// Returns parsed events and any remaining unparsed content
// ✅ Good: explains design rationale without historical context
// Assigned synchronously so concurrent callers share the same connection attempt
// ✅ Good: explains a non-obvious implementation choice
// Uses IIFE to ensure promise exists before any await points
If your comment contains "to avoid", "to fix", "to prevent", "instead of", or "properly" — reconsider whether you're describing current behavior or quietly referencing something that no longer exists. Rewrite to describe what the code does now and why this design was chosen.
When adding or modifying SDK methods:
packages/shared/src/errors/)Take cloudflare/coding-standards from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.