ワンクリックで
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)
// 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)
Use when you need to exercise a real, running Sandbox deployment via HTTP — for example to validate SDK changes against a live container, reproduce a user-reported issue, or experiment with the API (including FUSE bucket mounts) without spinning up `wrangler dev`. Documents the Sandbox bridge worker reachable via `SANDBOX_WORKER_URL` + `SANDBOX_API_KEY` when the host injects them.
Use when creating a changeset, preparing a release, or bumping versions. Covers which packages to reference, how to write user-facing changeset descriptions, the release automation flow, and the npm/Docker version sync requirement. (project)
Use when navigating the codebase for the first time, adding a new client method, adding a new container handler/service, or understanding how a request flows from Worker through the Sandbox DO into the container. Covers the three-layer architecture, client pattern, container runtime structure, and monorepo layout. (project)
Use when working in the examples/ directory, running an example with wrangler dev, adding a new example, or answering questions about EXPOSE directives and the local Docker dev loop. (project)
Use when adding logs, debugging, or working with the Logger across the SDK and container runtime. Covers the constructor-injection pattern, child loggers, env-var configuration, and test mocking. (project)
Use when working on or reviewing session execution, command handling, shell state, FIFO-based streaming, or stdout/stderr separation. Relevant for session.ts, command handlers, exec/execStream, or anything involving shell process management. (project)
| name | coding-standards |
| description | 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) |
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/)