diagnosing-bugs
Diagnose hard bugs and regressions. Use when the user says diagnose or debug this, or reports something broken, throwing, failing, or slow.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Diagnose hard bugs and regressions. Use when the user says diagnose or debug this, or reports something broken, throwing, failing, or slow.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Alpine.js adapter for @stainless-code/alpine-layers; plugin magics, x-layer-outlet, layerStack data, and JS hooks for typed layer stacks
Angular adapter for @stainless-code/angular-layers (signals + DI + imperative renderStack); use when wiring provideLayerClient, renderStack/useStackHandles, useLayerGroup, useMutationFlow, or createStackHook
UI-agnostic layer stack engine for @stainless-code/layers. Use for opening layers imperatively from anywhere, ordered named stacks, typed await or fire-and-forget calls, lifecycle control, blockers, validation, singleton updates, serial or nested layers, multi-stack orchestration, or building a library/framework adapter.
Lit adapter for @stainless-code/lit-layers; open UI from anywhere and manage ordered, named stacks with typed or fire-and-forget `open` via Reactive Controllers and custom elements
Preact adapter for @stainless-code/preact-layers — use for awaitable confirm flows, singleton toasts, nested drawers, stack subscriptions, and custom layer hosts
React adapter for @stainless-code/react-layers; open UI from anywhere and manage ordered, named stacks with typed or fire-and-forget `open`
| name | diagnosing-bugs |
| description | Diagnose hard bugs and regressions. Use when the user says diagnose or debug this, or reports something broken, throwing, failing, or slow. |
A discipline for hard bugs. Skip phases only when explicitly justified.
When exploring, read docs/architecture.md (core/adapter seam + layer lifecycle) for module vocabulary before forming hypotheses.
Feedback loops (prefer in order):
bun test — co-located packages/*/src/**/*.test.ts at the core + adapter-binding seam (fastest; no DOM)bun run test:dom — packages/*/tests-dom/** for real-renderer reactivity, outlet/render surfaces, and ergonomic wrappers per adapterLayerClient / LayerStack and drive open / dismiss / scope / gcTime without any framework to reproduce phase / queue / cache paths without a real rendererdismiss/dismissAll ordering replayed through the isolated harnessThis is the skill. Spend disproportionate effort here. A tight pass/fail signal for this bug beats staring at code.
Done when you can name one command that is red-capable, deterministic, fast, and agent-runnable (bun test <file> or bun run test:dom -- <pattern>). No red-capable command → no Phase 2.
Run the loop; shrink to the smallest scenario that still goes red. Every remaining element must be load-bearing — one stack, one layer, one open/dismiss sequence, one selector.
Done when: minimal repro documented; non-load-bearing steps removed.
Generate 3–5 ranked, falsifiable hypotheses. Show the list to the user before testing. Bias toward the seams: snapshot referential-stability across notifyManager.batch, AbortController cancel-on-dismiss racing loadFn, scope-queue drain ordering on dismissAll, gcTime cache restore on re-open, selector identity causing useSyncExternalStore loops.
Done when: user has seen ranked list before any fix attempt.
One variable at a time. Tag debug logs [DEBUG-xxxx] for cleanup. Perf bugs (snapshot rebuild churn, scope-queue thrash, gcTime cache miss storms): measure first, then bisect.
Done when: one hypothesis confirmed or all falsified with evidence.
Regression test before the fix when a correct seam exists — co-locate under packages/*/src/ (bun test) or packages/<fw>/tests-dom/ (test:dom) per the test matrix in docs/architecture.md. If no seam exists to test through, document that as an architectural finding (a shallow module worth deepening behind a smaller interface) and track it in docs/roadmap.md.
Done when: loop is green; regression test added or gap documented.
Remove [DEBUG-...] logs, delete throwaway harnesses, state the winning hypothesis in the commit message. If prevention needs an architecture change, record specifics in docs/roadmap.md.
Done when: no debug sediment; commit message states root cause.
tracer-bullets · verify-after-each-step · harden-pr (lite on the fix commit)docs/architecture.md — seam model, layer lifecycle, test matrix