# AGENTS.md — AWS CDK Blocks (contributor guide) > **CDK Blocks** is an Infrastructure-from-Code TypeScript monorepo. One `cdk-blocks/` directory defines an entire backend; each **Building Block (BB)** bundles a CDK construct + an AWS-runtime SDK client + a local mock behind one strongly-typed API. Frontends import the backend's types directly — no client generation step. Everything runs locally with no AWS account; deploy with `cdk deploy`. ## How to work here You're an engineer working **on CDK Blocks itself** — the framework and its Building Blocks. (If the task is building an app *with* CDK Blocks, this is the wrong doc → run `npm create @aws-cdk-blocks/blocks-app@latest my-app`.) You serve the project, its users, and its maintainers — not only the request in front of you. - **Default to making the change** — implement it, don't just describe it. - **Definition of done = the "Before you open a PR" checklist passes** (build, lint, tests, changeset, docs). - **Stay inside Building Blocks** for anything they cover; reach for the escape hatch (raw CDK construct / AWS SDK / `RawRoute`) only when no BB fits. - **Stop and ask** before any breaking change — changed return types, narrowed unions, removed exports, a changed export map, or a changed on-disk format — and surface it for maintainer review. - If a task isn't covered here, **say so** rather than guessing — your operator may have pointed you at the wrong tool. --- ## 🚦 Core rules (these gate a PR) 1. CDK synth must run with **`--conditions=cdk`**. Without it, BBs load their mocks and synth produces no infrastructure. 2. Persist application state **only through Building Blocks** — no local files, in-memory arrays, or ad-hoc databases. Without this → state vanishes on deploy (Lambda is stateless) or diverges between local dev and AWS. 3. Inject BB config with **`registerConfig()`**, never `handler.addEnvironment()` (Lambda env has a ~4 KB cap). 4. Call BB data methods **only inside request/job handlers** — never at module top level or during synth (the CDK class stubs them with `synthGuard` to throw). 5. **Never attach `Error.cause` enumerably** — it leaks SDK metadata (`$metadata`, ARNs) when an error is serialized to the client. 6. Errors cross the wire by **`name`, not `code`** — match with `isBlocksError(e, SomeErrors.Foo)` (works the same server- and client-side). A named error's `name` only survives the RPC serializer when the error is **branded** as an intentional BB error: throw it through `blocksError()`, or stamp a hand-built named `Error` with `brandBlocksError()` (both from `@aws-cdk-blocks/core`). An unbranded named `Error` collapses to a nameless `500` — that is deliberate, so a raw driver/SDK class name (`PostgresError`) never leaks. 7. **`get()`-style reads return `null`** for not-found — throw only for violated preconditions (e.g. a failed conditional write). Without this → callers need try/catch for normal control flow, and missing-item checks become invisible. 8. Keep customer-facing code cast-free: **no `as any` / `: any` / `@ts-ignore`** (a cast usually means a public type is wrong — fix the type). 9. Every API method is a public, internet-reachable RPC endpoint with no auth by default — **gate inside each method** with `await auth.requireAuth(context)`. 10. Every change to a published package **ships a changeset** covering all changed packages (its text becomes the public changelog). 11. Keep docs **runnable** — every README/JSDoc snippet, command, package name, and relative link is correct at HEAD; a dead link in a published `packages/*/README.md` is a defect. Without this → users copy-paste broken code and lose trust in the framework. 12. **No root `/` route**, and a route wildcard must be the last path segment. Violating this → API Gateway rejects the route or swallows all traffic into one handler. 13. Naming: **AWS CDK Blocks** on first mention on a customer-facing surface (docs, app UI, CLI output), **CDK Blocks** after that and everywhere else, including code comments. No article ("built with CDK Blocks"; "a CDK Blocks app" is fine). "Block" in a block's name or as a common noun or identifier (**Auth Block**, **KVStore Block**, "blocks on one cluster") is not the product name. --- ## Architecture in 60 seconds **Conditional exports** swap the implementation per environment. Every BB `package.json`: ```jsonc "type": "module", "exports": { ".": { "browser": "./dist/index.browser.js", // browser stub "cdk": { "types": "./dist/index.cdk.d.ts", "default": "./dist/index.cdk.js" }, "aws-runtime": "./dist/index.aws.js", // Lambda runtime (--conditions=aws-runtime) "types": "./dist/index.mock.d.ts", // ← types resolve to the MOCK "default": "./dist/index.mock.js" // ← local dev + tests }} ``` - `Scope` is the namespace + registration bus; BBs **extend** it (never wrap it) — that's how infra discovery, IAM propagation, and `fullId` computation work. - `BlocksStack` / `BlocksBackend` anchor the infra; `ApiNamespace` turns an app's module of methods into a JSON-RPC endpoint at `POST /cdk-blocks/api`. A BB doesn't auto-expose RPC — the app wraps the methods it wants to call. - **Resource names are derived, not handed off.** Each layer computes the same deterministic name from `fullId` independently: the CDK layer provisions a resource named `fullId.substring(0,255)`; the runtime and mock layers call `registerSdkIdentifiers(this.fullId, {...})` in their constructor and resolve it with `getSdkIdentifiers(this)` **at call time** (a same-process registry, so co-located BBs can find each other). The mock uses a `mock-`-prefixed name and persists to disk. Extra (non-name) config is the only thing the CDK layer pushes to the runtime, via `registerConfig()`. - Some BBs return **live client objects, not data** (e.g. a realtime channel). They use the **Transferable** pattern: the server value serializes (`toJSON()` → `{__blocks: …}`) and re-hydrates into a live client object via client middleware. `bb-realtime` is the canonical end-to-end example. ### Core API & glossary | Symbol | From | What it is | |---|---|---| | `Scope` | `@aws-cdk-blocks/core` (runtime/mock) **or** `@aws-cdk-blocks/core/cdk` (CDK) | base class every BB extends (CDK layers extend its subclass `BuildingBlockScope`, which also declares the block's VPC needs) | | `ScopeParent` | `@aws-cdk-blocks/core` (always) | the parent argument type | | `ApiNamespace`, `ApiError`, `isBlocksError` | `@aws-cdk-blocks/core` | RPC wrapper · HTTP-mapped error · typed-error guard | | `registerSdkIdentifiers`, `getSdkIdentifiers` | `@aws-cdk-blocks/core` | register (in mock/runtime ctor) / resolve (at call time) a BB's resource names | | `registerConfig`, `synthGuard` | `@aws-cdk-blocks/core/cdk` | inject Lambda config at synth · `(): never` stub for runtime-only methods | | `scope.registerClientMiddleware(pkg)` | `Scope` method (codegen) | registers the client-plugin **package specifier** that hydrates a Transferable into a live client object — the plugin does the hydration, this just registers it | | `getMockDataDir` | `@aws-cdk-blocks/core/bb-utils` | mock persistence dir → `.cdk-blocks/local/data/{fullId}/` | | `auth.requireAuth(context)` | `Auth` (`@aws-cdk-blocks/bb-auth`) | gate a method; returns the user or throws 401 | | `RawRoute` | `@aws-cdk-blocks/core` | escape hatch for a raw HTTP route when JSON-RPC isn't enough | | `fullId` | — | a BB instance's unique scoped id (drives resource + mock-data naming) | | reference object | — | the lightweight handle `fromExisting()` returns (e.g. `{ tableName }`), passed into a constructor — not a constructed BB | | Transferable | — | a server value that serializes (`toJSON()` → `{__blocks: …}`) and re-hydrates into a live client object via client middleware. Canonical example: `bb-realtime` | --- ## How an app consumes a BB (the mental model authoring serves) ```ts // cdk-blocks/index.ts — define backend + the API surface const scope = new Scope('app'); const notes = new KVStore(scope, 'notes'); const auth = new Auth(scope, 'auth'); export const authApi = auth.createApi(); // BB-authored state machine export const api = new ApiNamespace(scope, 'api', (context) => ({ async addNote(text: string) { const user = await auth.requireAuth(context); // gate: methods are public by default await notes.put(`${user.userId}:${crypto.randomUUID()}`, text); }, })); // cdk-blocks/index.handler.ts — Lambda entry (lazy import so config loads first) export const handler = createLambdaHandler(() => import('./index.js')); // frontend — typed import of the backend, no codegen import { api } from 'cdk-blocks'; await api.addNote('hello'); ``` > A method that returns a live client object (rather than plain data) returns a Transferable — see `bb-realtime`, where `getChannel()` hands the client a channel it `subscribe()`s to (server-side `publish`/`subscribe`; client-side hydration via the registered client middleware). --- ## 🧱 Authoring a NEW Building Block **Reference, don't clone.** `packages/bb-kv-store/` is the canonical reference for the file structure and the conditional-export layering (`index.mock/aws/cdk/browser.ts` + `types.ts`/`errors.ts`/`version.ts`, the `Scope` / `BuildingBlockScope` subclasses, `synthGuard` stubs) — read it to learn the *shape*, not to copy wholesale. Its data model is a DynamoDB key/value table; **that does not generalize.** Pick the closest-shaped BB and understand every line you carry over: | Your BB is… | Reference | Note | |---|---|---| | key/value, documents, or single-table | `bb-kv-store` | the typical file skeleton below | | relational / SQL | `bb-database` (`Database`, `DatabaseCluster`) | `migrationsPath` + ordered `.sql` | | auth, or composed from other BBs | `bb-auth` | composes `KVStore` (`sessions`) + `AppSetting` (`session-secret`) in every layer (see `index.cdk.ts`, `sessions.ts`); a base class + injected engines (`auth-base.ts`, `engines/`); exposes `createApi()`. A new sign-in method is an `Auth` option, not a new auth BB | | background work (SQS + event source) | `bb-async-job` | `submit()` + a job handler | | WebSocket / returns a live client object | `bb-realtime` | client hydration (Transferable) + server APIs; `index.ts`/middleware; `Symbol.for` shared per-stack infra | | object storage | `bb-file-bucket` | `scan({prefix})` is valid here (S3 scopes natively) | > **Two references, two purposes.** Use `bb-kv-store` to learn the **typical file layout & layering**. Use `bb-realtime` to learn the **full client↔server surface** — it's the one BB that demonstrates client-side hydration end-to-end: a server method returns a Transferable (a channel handle) that serializes via `toJSON()` and re-hydrates into a live client object through a registered client middleware, alongside server-side `publish`/`subscribe`. The data BBs only exercise the server/data side. **Don't copy `bb-realtime`'s layout** for a simple BB — it's atypical (a single `index.ts` as its `default`/`types` entry with no `index.mock.ts`, middleware files, shared per-stack infra). > > Not every BB fits the four-file skeleton — `bb-realtime` uses a single `index.ts` as its `default`/`types` entry (no `index.mock.ts`), plus middleware files — don't force the skeleton onto them. And **never copy a reference's package.json verbatim** — regenerate `files[]` and the `test` glob from your actual `src/` (reference scripts can be stale — e.g. one currently names a non-existent test file and omits a real one). **Standard file shape** (`bb-kv-store`): ``` packages/bb-{name}/ README.md # authoritative user doc (runnable snippets, "When to use / When not") DESIGN.md # internals + mock↔AWS differences (shipped per-BB convention) API.md # GENERATED by api-extractor from the aws-runtime entry (dist/index.aws.d.ts) — never hand-edit package.json tsconfig.json api-extractor.json src/ version.ts # GENERATED (prebuild) — BB_NAME, BB_VERSION types.ts # TYPES ONLY — `import type` only; no const/function/class errors.ts # XxxErrors as-const + blocksError() (brand via core's brandBlocksError so the name crosses the wire) validation.ts # caller-input checks, imported and called by BOTH index.mock.ts and index.aws.ts index.mock.ts # default + types entry index.aws.ts # aws-runtime entry index.cdk.ts # cdk entry index.browser.ts # browser stub: re-exports types + error constants; methods are server-side (throw) index.test.ts parity.test.ts index.cdk.test.ts # parity.test.ts: same cases, mock vs AWS with the SDK stubbed ``` **The non-obvious bits of the three layers:** ```ts // index.mock.ts — local dev + tests; persists to disk; self-registers a mock name super(id, { parent: scope, bbName: BB_NAME, bbVersion: BB_VERSION }); registerSdkIdentifiers(this.fullId, { tableName: `mock-${this.fullId}` }); this.file = join(getMockDataDir(this), 'store.json'); // .cdk-blocks/local/data/{fullId}/ // index.aws.ts — real SDK client; registers in ctor, resolves at call time readonly bbName = BB_NAME; constructor(...) { super(...); registerSdkIdentifiers(this.fullId, { tableName: /* derived */ }); this.client = new DynamoDBClient({ customUserAgent: this.buildUserAgentChain() }); } async get(key: string): Promise { const { tableName } = getSdkIdentifiers(this); // ← call time, never the ctor /* GetItem; return null when absent */ } // index.cdk.ts — provisions infra; does NOT register identifiers (it derives the same name) import { BuildingBlockScope, registerConfig, synthGuard } from '@aws-cdk-blocks/core/cdk'; static fromExisting(tableName: string): ExternalTableRef { return { __brand: 'ExternalTableRef', tableName }; } constructor(...) { super(id, { parent: scope, bbName: BB_NAME, vpc: {} }); // bbName records the block on the stack; `vpc` = VPC needs ({} if none) this.table = new Table(this, 'table', { tableName: this.fullId.substring(0, 255) /* … */ }); this.table.grantReadWriteData(this.executionRole); // grant on the SHARED execution role registerConfig(this, 'BLOCKS_THING_FLAG', '…'); // extra config only (not addEnvironment) } get(..._a: unknown[]): never { return synthGuard('Thing', 'get'); } // stub EVERY runtime method ``` > Returning a live client object? Make it a Transferable (`toJSON()` → `{__blocks: 'ns/type', …}`) and register a client plugin with `scope.registerClientMiddleware`; the mock must return a functional Transferable too. `bb-realtime` is the reference. **Checklist for a new BB:** - conditional exports across all entry points + `prebuild` version script - `types.ts` types-only - every named runtime export in `index.mock.ts` exists in the `cdk` and `aws-runtime` entries, and so does every public method of each exported class; under `cdk` each runtime-only method must throw via `synthGuard` (all enforced by `conditional-exports.test.ts` in `packages/blocks`; a method that must work at synth goes in its `SYNTH_SAFE_METHODS`); `browser` entries are intentionally narrower and are outside this full-export parity check, but every BB with `*Errors` constants needs one that re-exports them from `errors.js` (same values; also enforced by `conditional-exports.test.ts`) - mock↔AWS validation parity: caller-input validation lives in `src/validation.ts` and is called by **both** `index.mock.ts` and `index.aws.ts` at the same point in each method, throwing the same branded error; a `src/parity.test.ts` runs one table of cases against the mock and the AWS entry (SDK stubbed) and asserts the same named error or success, plus the captured SDK input on success. Enforced by `mock-aws-parity.test.ts` in `packages/blocks` (see [validation parity](docs/reference/building-block-structure.md#mock-and-aws-validation-parity)); never validate on only one side - ship `README.md` + `DESIGN.md` via `package.json` `"files"` - register in the umbrella `packages/blocks` exactly like an existing BB (add dependency + a catalog/README row + re-export from its `index.ts` **and** `index.cdk.ts`, and its `*Errors` constants from `index.browser.ts`) - add to the root `workspaces` - add an instance + test to `test-apps/comprehensive` (zero casts) - needs a step before `cdk deploy` (a guard, host-side migrations)? Declare it in the block's `package.json` as `"aws-blocks": { "predeploy": { "module": "./dist/predeploy.js", "stages": ["production"] } }` and export `predeploy(context)` from that module; core's `deploy` and `sandbox` scripts discover and run it (`context.synth()` gives the templates). Never add block-specific code to `packages/core/src/scripts`. - `npx changeset add`. --- ## Quick Start by Task ### Implementing a New Building Block **→ Start here:** Read `CONTRIBUTING.md` for the full checklist, then: 1. Read `docs/design/API-DESIGN.md` for API guidelines (G1–G18) 2. Study an existing BB (e.g., `packages/bb-kv-store/`) for the file pattern 3. Read `docs/reference/building-block-structure.md` for conventions 4. Read `docs/reference/error-model.md` for how to name, brand and throw errors 5. Follow the **"Authoring a NEW Building Block"** section above ### Fixing a Bug **Always repro before you fix.** Write a failing test that demonstrates the bug — this is your red. Then make it green. Never fix a bug without a test that would have caught it. **Prefer e2e over unit for repros.** An e2e test in `test-apps/comprehensive/test/` exercises the same path a customer would hit. Use unit tests only for purely internal logic. 1. `npm install` at root 2. `npm run build` 3. **Write a failing test first** — reproduce the bug in `test-apps/comprehensive/test/` (preferred) or `packages//src/*.test.ts` (if purely internal). Confirm it fails. 4. Fix the code in `packages/bb-*/` 5. Confirm your test now passes: `npm run test:e2e:local` (e2e) or `cd packages/ && npm test` (unit) 6. Run full integration tests: `npm run test:e2e:local` from root 7. Verify no regressions in related packages ### Understanding Architecture 1. `docs/reference/ARCHITECTURE-LAYERS.md` — the four-export layer model 2. `docs/reference/building-block-structure.md` — file conventions 3. Root `README.md` — how conditional exports work ### Discovering Building Block Documentation When working in a CDK Blocks application (not this monorepo), Building Block documentation ships in `aws-cdk-blocks`, and `npm run docs` prints it for the installed version: `npm run docs` lists all Building Blocks with their package names, and `npm run docs ...` prints their docs (`npm run docs -- --help` for more). Use `npm run docs:search ` to search or `npm run docs:api ` for signatures. Structured tasks print text on a terminal and JSON when piped; use `npm run -s docs KVStore` in pipelines to suppress npm’s banner. --- ## Conventions | Area | Rule | |---|---| | Linter/formatter | **Biome** (not ESLint/Prettier): tabs (width 4), 120 cols, single quotes, trailing commas everywhere, semicolons always. `biome check` = lint + format + import-sort. | | Modules | **ESM everywhere**; relative imports carry the `.js` extension. `strict: true`, ES2022, `moduleResolution: bundler`. | | Naming | BB class `PascalCase`, no "BB" prefix (`KVStore`). pkg `@aws-cdk-blocks/bb-{kebab}`. errors `{Class}Errors`. The **`BLOCKS_` env prefix is framework-reserved** — not for example app code. Auth identifiers lead with `Auth` (`Auth`, `AuthOptions`, `AuthErrors`; packages `bb-auth`, `auth-common` — D-004), and there is one auth BB: add a sign-in method as an `Auth` option rather than a new block (D-023). | | Schema validation | When a BB accepts a user-provided validation schema, type it as **`StandardSchemaV1`** (Zod/Valibot/ArkType) — don't pull a schema lib into the BB's runtime deps (it's the consumer's choice); if your own tests use `zod`, keep it a `devDependency`. (A BB may take a schema lib as a real `dependency` only for its *own* internal needs, e.g. `bb-agent`.) Validate via `schema['~standard'].validate(value)`, before conditional checks. | | Tests | **`node:test` + `node:assert`** (not Jest/Vitest), run on compiled `dist/`. Reset `.cdk-blocks/local/data` between tests. Mock tests can't catch AWS-path serialization bugs — serialization/behavior changes also need a sandbox e2e. | | Async | `async/await` only; prefer **`Array.fromAsync()`** over `for await` push-loops. | | Synth annotations | A **warning** (`Annotations.addWarningV2`, always with a stable id) is about the app: something its own configuration or deploy target makes wrong or risky. A tradeoff that comes from a preset or a block's defaults is an **info** (`addInfoV2`). An app scaffolded from a template and left unchanged synthesizes with **no warning**; `scripts/ci/template-synth-warnings.mjs` checks every template in production, sandbox and preview mode (E2E Templates and the daily canary) and lists the few warnings a template is meant to show. Never acknowledge an annotation in a template to pass that check. See D-033 in `docs/DECISIONS.md`. | --- ## ⚠️ E2E Tests Are Customer DX — No Type Casts The e2e tests in `test-apps/comprehensive/` represent exactly what a customer would write. They exist to validate the end-to-end type-safe DX, so **never use `as any`, `: any`, or other type casts** in test code that represents customer usage. **What represents customer code:** API calls, their return values, callback parameters, and any chaining or destructuring of results. If a customer would write it, the test should compile without casts. **What doesn't:** Test infrastructure like fetch spies, cookie jars, server lifecycle, and deploy scripts. Casts in plumbing code are fine. If a test won't compile without a cast, the Building Block's public types are wrong — fix the types at the source, not in the test. --- ## ⚠️ Docstrings Are Sacred **Never remove, truncate, or rewrite existing JSDoc/docstrings** on exported functions, types, classes, or interfaces. These are the primary documentation surface for customers and agents working in IDEs — they show on hover and in autocomplete. When modifying a function: - **Preserve** all existing docstring content (usage examples, parameter descriptions, best practices, scaling notes) - **Add** to docstrings if the behavior changes - **Update** references if names change - **Never** strip a docstring down to a one-liner summary If you must rewrite a file from scratch, diff the docstrings against the previous version before committing. --- ## ⚠️ Running Long-Lived Processes (dev server, sandbox) **Never run `npm run dev`, `npm run sandbox`, or any blocking server directly in a shell command.** These processes don't exit — they will hang the agent indefinitely. ### Required pattern: tmux + polling ```bash # 1. Start in a background tmux session tmux new-session -d -s dev 'cd test-apps/comprehensive && npm run dev' # 2. Poll every few seconds until ready for i in $(seq 1 30); do sleep 3 OUTPUT=$(tmux capture-pane -t dev -p) echo "$OUTPUT" | grep -q "local server running" && echo "READY" && break echo "... waiting ($i)" done # 3. Do your work (run tests, curl endpoints, etc.) # 4. Kill the session when done tmux kill-session -t dev ``` ### Sandbox lifecycle Sandbox deploys take 2–3 minutes (CDK CloudFormation). Use the same tmux + polling pattern. **If you deployed a sandbox and are done with it, always run `npm run destroy` (from the test app directory) before finishing.** Leaving sandboxes running wastes AWS resources. --- ## Local dev, deploy & stages | Command | Purpose | |---|---| | `npm run build` · `npm test` (`test:unit`) | TS project-reference build · unit tests on `dist/` | | `npm run build:force` | Clean + rebuild (use after refactors) | | `npm run test:e2e:local` / `test:e2e:sandbox` | e2e against the dev server / a real AWS sandbox | | `npm run lint` / `lint:deps` | Biome / undeclared-dependency check (blocking) | | `npm run check:api` | API Extractor reports | | `npm run update:api` | Regenerate API reports (after intentional API changes) | | `npx changeset add` | required for any published-package change | - Node **22** (`.nvmrc`). Mock data → `.cdk-blocks/local/data/{fullId}/`. - Stages: a transient **sandbox** vs **production**. Spin a sandbox via the scripts in `aws-cdk-blocks/scripts` (`startSandbox`/`startDevServer`); run `test:e2e:sandbox` to validate the real AWS path; tear it down (`npm run destroy`) when done. --- ## ✅ Before you open a PR - [ ] `npm run build && npm run lint:deps && npm test && npm run test:e2e:local` pass locally - [ ] Changeset added (covers every changed published package), changelog-appropriate wording - [ ] README / DESIGN / JSDoc updated **in this PR**; snippets, commands, links verified at HEAD - [ ] Conditional-export parity holds; new runtime methods have `synthGuard` stubs - [ ] New behavior or security change ships a test (sandbox e2e if serialization changed) - [ ] Breaking change? → flag for maintainer review (see "How to work here"); prefer a backward-compatible fallback CI runs build, lint, the undeclared-dependency check, unit + e2e tests, and a changeset check. --- ## API design principles (beyond the Core rules) - **Options objects, not positional params** — adding an options field is non-breaking; a positional argument is not. Avoid overloads (vary behavior with options). - **Method names signal cost** — `get`/`put`/`delete`; expose `*Batch` only when the service has a native batch API; `query` is indexed, `scan` is full-table. - Use `AsyncIterable` for **unbounded result sets**; be **async by default** for anything touching storage/network. - **Return client-safe values** — plain JSON-serializable data, or a Transferable for live client objects (`bb-realtime`); never return a `Scope` subclass from an `ApiNamespace` method. - **Don't leak AWS primitives** (ARNs, SDK types, service IDs) in public signatures — the CDK entry may use CDK types. - `fromExisting()` returns a **reference object** (a constructor input), not a constructed BB. - **The constructor is the only side effect** — register/provision there; methods are pure runtime ops. - **Document every public method** (one-liner, params, returns, throwable errors, an example); keep README and JSDoc in sync. For the full set of guidelines (G1–G18) with rationale, examples, and the BB design document template, see [`docs/design/API-DESIGN.md`](docs/design/API-DESIGN.md). --- ## Reviewing a PR Check correctness/security, mock↔aws↔cdk↔browser consistency + conditional-export parity, doc accuracy (verify snippets/links at HEAD), and test coverage. Label **Blocking** / **Suggestion** / **Nit**, cite a location with a concrete fix, and reserve change-requests for substance (correctness, security, broken backward-compat, behavior change without a test) — not style. ## Where to look - `packages/bb-kv-store/` — reference for the typical file layout & layering (its *data model* is KV-specific). - `packages/bb-realtime/` — reference for the full client↔server surface + the Transferable client-hydration pattern. - Each BB's `README.md` — the authoritative API doc for that block. - `docs/` — architecture and design background - `packages/hosting/README.md` — SPA/SSR frontend hosting - `packages/bb-database/README.md` — DB migrations - `native/*` — Kotlin/Swift/Dart client codegen - per-template `AGENTS.md` (via `npm create @aws-cdk-blocks/blocks-app@latest my-app`) — building an app *with* CDK Blocks.