| name | adapter-correctness |
| description | Use when changing Better Auth DynamoDB adapter runtime code in src/, especially query planning, atomic operations, entity/sidecar/unique-lock serialization, injected clients, or tests for adapter semantics. |
Adapter correctness workflow
Use this skill for implementation changes under src/ or behavior-focused tests under test/.
Checklist
- Read
AGENTS.md first and identify which invariant the change touches.
- Map the change to the owning module:
src/index.ts for Better Auth factory wiring and exported API.
src/dynamodb-adapter.ts for operation semantics and DynamoDB commands.
src/where.ts for access planning and scan guards.
src/serialize.ts and src/keys.ts for storage shape, delimiter-safe key components, and hidden entity revision metadata.
src/client.ts for injected-client and AWS SDK compatibility.
- Preserve atomic command behavior for uniqueness,
consumeOne, and incrementOne; stale-write guards must use the hidden per-entity revision rather than full entity equality.
- Preserve the no-hidden-scan rule. If a query shape cannot use id equality or scalar field equality, it must throw unless
unsafeAllowScan: true is explicit.
- Add or update focused unit tests that assert command type, condition expressions, key/index names, returned Better Auth-visible entities, and race handling where relevant.
- Run
bun run verify from the repository root. Fix typecheck, lint, coverage, CRAP, and build failures rather than weakening gates.
Documentation prompts
Update README.md when the change affects options, table provisioning, storage layout, concurrency guarantees, limitations, or generic deployment usage. Update AGENTS.md if an invariant changes.