tdd
Test-driven development with vertical tracer-bullet slices. Use when building test-first, red-green-refactor, or when the user mentions TDD.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Test-driven development with vertical tracer-bullet slices. Use when building test-first, red-green-refactor, or when the user mentions TDD.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Gate Alpine.js UI on Persist hydration (Alpine.plugin + useHydrated / $hydrated). Use when wiring HydrationSignal into Alpine data components.
Gate Angular UI on Persist hydration with useHydrated (readonly Signal). Call inside an injection context; use when avoiding flash of default state on async backends.
Gate Lit element UI on Persist hydration with HydrationController. Use when wiring HydrationSignal into a ReactiveControllerHost; not a hook.
Persist with React Native AsyncStorage via @stainless-code/persist/backends/async-storage. Use for RN string-wire JSON state; always gate with useHydrated.
Compress a string-wire StateStorage with @stainless-code/persist/backends/compressed (gzip/deflate). Backend wrapper — compose with createStorage; stack compress-then-encrypt.
Cross-tab sync for backends without storage events via @stainless-code/persist/transport/crosstab (createBroadcastCrossTab). Wrap storage + pass crossTabEventTarget; call close() on teardown.
| name | tdd |
| description | Test-driven development with vertical tracer-bullet slices. Use when building test-first, red-green-refactor, or when the user mentions TDD. |
Vertical RED→GREEN cycles — one behavior per loop, not horizontal "all tests then all code". Aligns with tracer-bullets and verify-after-each-step.
docs/architecture.md § Test matrix:
bun test <co-located *.test.ts> — src/** unit tests (core, codecs, backends, TanStack adapters, useHydrated SSR/snapshot contracts). No DOM.bun run test:dom — tests-dom/**/*.test.tsx (vitest + jsdom + @testing-library/react) for useHydrated rerender / unmount / useSyncExternalStore reactivity.src/core/persist-core.ts → src/core/persist-core.test.ts).verify-after-each-step.StateStorage), never inside persist-core or a codec. See PATTERNS.md.Confirm behaviors to test (not implementation steps) with the user. Prefer deep modules — small public surface (persistSource, createStorage, a codec factory), complex internals.
RED: one test for first behavior → bun test <file> (or test:dom for hydration rerenders)
GREEN: minimal code to pass → re-run
For each behavior: RED → GREEN → run affected tests. One test at a time; no speculative features.
After GREEN — look for duplication, long methods, shallow modules, feature envy. Run bun test <file> after each step. Never refactor while RED. For production polish on a completed slice, harden-pr lite may run in parallel with tracer-bullet commits.
[ ] Test describes behavior, not implementation
[ ] Test uses the public seam only (persistSource / createStorage / a codec / useHydrated)
[ ] Test would survive an internal refactor
[ ] Code is minimal for this test
[ ] bun test (or test:dom) passes on touched file(s)
PATTERNS.mdtracer-bullets · Verify: verify-after-each-step