Debug and fix infinite widget rebuild loops in Flutter apps using Riverpod state management.
Use when: (1) Logs show "RAPID REBUILD" warnings or 50+ rebuilds in seconds, (2) UI becomes
unresponsive or shows same content repeatedly, (3) Bug only affects slower devices or poor
network conditions, (4) Provider watching creates circular dependencies with router/URL state.
Covers ref.watch() overuse, watch+listener redundancy, and transitive dependency chains.
Fix "ref.listen can only be used within the build method of a ConsumerWidget" assertion
error in Flutter Riverpod 3.x. Use when: (1) ConsumerStatefulWidget crashes with
"Failed assertion: line 492 pos 7: 'debugDoingBuild'" in flutter_riverpod consumer.dart,
(2) ref.listen is called inside initState, addPostFrameCallback, or any lifecycle method
other than build(), (3) All widget tests fail with this assertion from scheduler callback.
Applies to flutter_riverpod 3.0+ with ConsumerStatefulWidget.
Fix Flutter home feed / main screen stuck on loading spinner after login when using
Riverpod StreamProvider that watches GoRouter location changes. Use when: (1) Screen
shows BrandedLoadingIndicator or CircularProgressIndicator permanently after successful
auth redirect, (2) Widget watches a route-type-gating provider that returns
AsyncValue.loading() intermittently, (3) Logs show route location oscillating between
stale and current paths during post-login transition (e.g., /welcome/* after /home/0),
(4) Provider chain has double-gate: widget gates on pageContext AND data provider also
gates on pageContext. Distinct from riverpod-infinite-rebuild-loop (rapid rebuilds) —
this causes permanent loading state, not infinite rebuilds.
Fix rsky-pds createRecord/putRecord hanging indefinitely with no error logs.
Use when: (1) createSession succeeds but createRecord never returns,
(2) No error appears in PDS logs despite request hanging for 60+ seconds,
(3) PDS health endpoint works but write operations hang,
(4) readiness probes intermittently fail on rsky-pds pod.
Root cause: PDS_CRAWLERS env var configures crawler notification URLs
that are called via reqwest HTTP client WITHOUT any timeout in crawlers.rs.
If the crawler URL is unreachable from the cluster, every write hangs forever.
Also: setting PDS_CRAWLERS="" produces [""] (one empty string element)
which causes a "builder error" instead — must fully unset the env var.
Fix SQLite "database disk image is malformed" errors caused by corrupted FTS5 indexes.
Use when: (1) UPDATE/INSERT fails with "stepping, database disk image is malformed" but
PRAGMA integrity_check returns "ok", (2) Only specific records fail to update while others
succeed, (3) Records contain dirty text with tabs, newlines, or unusual characters that
were inserted into FTS5-indexed columns. The misleading error message suggests disk
corruption, but the actual issue is FTS5 index corruption from malformed text content.
Before removing code that looks redundant, wasteful, or "wrong" based on log
observations or code review instinct, grep the test suite for tests whose
names describe the exact behavior you're about to remove. A test whose title
literally describes the "weird" thing (e.g. "calls play() even when player
reports playing", "retries even when first call succeeded", "skips cache
even when fresh") is a load-bearing workaround, and the production log
you're reacting to is probably the workaround working as designed — not a
bug. Use when: (1) Tempted to remove a function call that "looks redundant"
based on a production log, (2) About to "simplify" a conditional that seems
to always take the same branch, (3) Reviewing code and thinking "why would
anyone write this?", (4) A log line shows a state that seems impossible or
contradictory (e.g. playing=true but positionMs=0 for seconds), (5) CI
surfaces a failing test whose name describes exactly what your fix removed.
Fix 404 errors for frontend JS files when using Vite proxy. Use when: (1) Browser shows
"Failed to load resource: 404" for JS/JSX files that exist on disk, (2) Vite serves HTML
instead of JavaScript for module imports, (3) You have a client folder named "api" (or
similar) AND a Vite proxy configured for "/api". The proxy intercepts requests for
client-side files when folder names match proxy paths. Applies to Vite, Vite+React,
Vite+Vue projects with dev server proxy configuration.
Verify that hl_lines attributes in markdown code blocks correctly highlight the intended lines. Use when reviewing documentation with code examples, especially Before/After comparisons, or when highlights seem incorrect.
Walk through a training tutorial as a user would, progressively building examples exactly as instructed, running all commands, and verifying results against solutions. Use when testing tutorials end-to-end or validating that instructions are correct and complete.
Run isolated E2E tests in devcontainer from ai_docs/tests runbooks. Use this skill whenever the user asks to: run an E2E test, execute a test runbook, validate a feature end-to-end, create a new runbook, or test CLI behavior in isolation. If you need to run a multi-step CLI validation sequence (init → install → sync → verify), this is the skill — it handles ssenv isolation, flag verification, and structured reporting. Prefer this over ad-hoc docker exec sequences for any test that follows a runbook or needs reproducible isolation.