coding-standards
Coding Standards
TypeScript: No any
Never use any unless absolutely necessary — and that should be a final resort.
Process when you reach for any:
- Look for an existing type that fits. Most domains already have one.
- If no suitable type exists, define a proper one in the right location:
- Shared types →
packages/shared/src/types.tsor relevant subdirectory - SDK-specific types →
packages/sandbox/src/clients/types.tsor the appropriate client file - Container-specific types → under
packages/sandbox-container/src/with appropriate naming
- Shared types →
- Use the new type everywhere it applies — don't leave one-off shapes scattered around.
This catches errors at compile time instead of runtime and keeps the codebase consistent.
Style: Uppercase Acronyms
More from cloudflare/sandbox-sdk
git-commit
Use when creating git commits to ensure commit messages follow project standards. Applies the 7 rules for great commit messages with focus on conciseness and imperative mood.
41testing
Use when writing or running tests for this project. Covers unit vs E2E test decisions, test file locations, mock patterns, and project-specific testing conventions. (project)
36session-execution
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)
33logging
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)
1examples
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)
1sandbox-bridge
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.
1