/testing:streamlit-ui-visual-verificationfrom testing
Verify Streamlit dashboard changes by opening a real browser — not just probing the HTTP server. Use when: (1) you modified a Streamlit app and want to sign off on the change, (2) a smoke test passed via curl/HTTP 200 but you haven't actually looked at the page, (3) the change touched data-source selection, tab widgets from `extra-streamlit-components`, or dropdown population wired to a backend, (4) an exit gate / PR review needs UI evidence not just import evidence. Covers the "server-up ≠ UI-works" trap, iframe-isolated widget gotcha in extra-streamlit-components, Playwright MCP fallback when the claude-in-chrome extension is disconnected, and the specific failure signature where HTTP 200 + zero tracebacks + empty dropdowns means data binding silently broke between modules and the UI layer.
Ships in testing. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Streamlit dashboards fail in a particularly deceptive way: the server stays up, the Python side throws no exceptions, HTTP probes return 200, module imports all work from the REPL — and the user-facing UI is still broken.
The failure mode is not a crash. It's a silent two-sources-of-truth drift:
You edited module code (modules/data_connector.py) and added a new feature
(e.g., a PARQUET data source enum). Unit-level smoke works.
You edited the Streamlit entry (app/main.py) at the call sites where the
module is instantiated (e.g., DataConnector(source="PARQUET", ...)).
You forgot that the user doesn't instantiate anything — they click a button
in an extra-streamlit-components tab widget. That widget is defined
somewhere ELSE in app/main.py as a fixed list like:
chosen = stx.tab_bar(data=[
stx.TabBarItemData(id="CSV", title="CSV", description="..."),
stx.TabBarItemData(id="CLICKHOUSE", title="ClickHouse", description="..."),
])
Because extra-streamlit-components renders that widget inside an
iframe, its state is isolated from the main Streamlit rerun graph. Adding
a new branch in the module layer has ZERO effect on what shows up in the
iframe. The user still sees only CSV and ClickHouse.
All server-side smoke tests pass. All imports succeed. The app "runs." The user opens it and the dropdowns are empty because PARQUET was never clicked.
This is how a Phase 1 integration can pass 8 exit-gate checks and still ship a broken UI. The fix is cheap; the lesson is expensive.
Apply this skill whenever ANY of the following are true:
extra-streamlit-components (stx.tab_bar, stx.CookieManager, etc.) — these render in iframes with isolated stateThere are four levels of verification, each strictly weaker than the next. Never claim "done" below Level 4 for UI-facing work.
| Level | What it proves | What it misses |
|---|---|---|
| L1 — Imports | Python module API is syntactically/type-wise intact | Whether the app calls the module at all |
| L2 — Direct call | Module returns correct data when called directly | Whether the UI ever triggers that call path |
| L3 — HTTP probe | Tornado is listening, Streamlit booted | Whether React rendered, widgets populated, events wired |
| L4 — Visual check | The user-visible UI shows the expected state | Nothing (this IS the ground truth the user sees) |
L3 is the trap. curl localhost:8501 returning 200 tells you absolutely
nothing about whether the tab bar has a PARQUET button. Stop treating HTTP
probes as "smoke tests passed."
The tool of choice is Playwright MCP
(mcp__plugin_playwright_playwright__browser_*). It works regardless of whether
the claude-in-chrome extension is connected.
Minimum viable visual check:
1. mcp__plugin_playwright_playwright__browser_navigate → http://localhost:8501
2. mcp__plugin_playwright_playwright__browser_wait_for → text="DataConnector" or a stable element
3. mcp__plugin_playwright_playwright__browser_snapshot → accessibility tree
4. mcp__plugin_playwright_playwright__browser_take_screenshot → filename: feature-YYYYMMDD.png
5. mcp__plugin_playwright_playwright__browser_console_messages → assert no red errors
Do NOT merely take a screenshot and move on. Inspect the accessibility tree
from browser_snapshot for explicit content:
st.error / st.exception renderedIf any assertion fails, the work is NOT done. This is a hard gate, not a soft soft heuristic.
extra-streamlit-components tab_bar, cookie_manager, etc. render in iframes.
That has two consequences:
Adding a module-level enum does not auto-add a tab_bar item. You must
find the stx.tab_bar(data=[...]) call and append a new TabBarItemData
explicitly. Grep for tab_bar, TabBarItemData, import extra_streamlit_components.
Playwright may need to enter the iframe context. If browser_snapshot
doesn't show the tab contents, use browser_evaluate with a script that
enumerates document.querySelectorAll('iframe') and reads their
contentDocument, or click the iframe frame directly.
When dispatching a teammate to modify a Streamlit dashboard, include this in the brief verbatim:
Mandatory visual verification before marking task complete:
- Launch the app:
uv run streamlit run app/main.py --server.headless true --server.port 8501(run_in_background=true)- Use Playwright MCP to navigate to
http://localhost:8501- Take a snapshot and assert the NEW feature is visible in the rendered UI, not just in the module API
- Take a screenshot with a descriptive filename and commit it to
.claude/evidence/(or paste the image in your SendMessage reply)- Kill the streamlit process when done (
kill <pid>orpkill -f "streamlit run")Do NOT report completion based on HTTP 200, import success, or module-level smoke tests alone. Those are necessary but insufficient. If you cannot produce a screenshot showing the feature working, the task is not done — say so explicitly and ask for help.
Watch for the extra-streamlit-components iframe gotcha: if the app uses
stx.tab_baror similar widgets, the UI option list is defined in a fixeddata=[...]argument. Adding a new enum in a module does NOT automatically add a tab. Grepapp/main.pyfortab_barandTabBarItemDataand edit the widget definition directly.
After applying this skill, you should be able to answer yes to all of:
Scenario (real incident, 2026-04-08): Phase 1 integration of
nautilus_trader_streamlit. Task 1.6 was "add PARQUET data source to the
dashboard so it can read a NautilusTrader ParquetDataCatalog."
What the teammate did:
modules/parquet_data.py with a full catalog reader ✓PARQUET branch to DataConnector in modules/data_connector.py ✓DataConnector(csv_dir=".") with DataConnector(source=NT_DATA_SOURCE, data_dir=NT_DATA_DIR) at app/main.py:1521 and :1686 ✓What the teammate did NOT do:
stx.tab_bar(data=[...]) definition to add a PARQUET TabBarItemDataWhat the user saw when they opened the dashboard:
CSV and ClickHouse buttons (no PARQUET)What the exit gate saw:
localhost:8501 ✓DataConnector(source='PARQUET', data_dir=...) importable and returns 8 symbols ✓Root cause: extra-streamlit-components tab_bar renders in an iframe.
The module layer and the iframe widget are two sources of truth. The module
learned about PARQUET; the iframe did not. No amount of HTTP probing would
have caught this.
Correct verification that would have caught it:
Playwright MCP:
browser_navigate → http://localhost:8501
browser_snapshot → accessibility tree
Assert snapshot contains "PARQUET" text anywhere in tab_bar region
→ Would have failed. Task is not done.
st.tabs, st.selectbox, etc. are NOT iframe-isolated — they rerender from the main script. The gotcha is specific to extra-streamlit-components and other third-party widgets that use Streamlit's Component API with iframes.mcp__claude-in-chrome__* returns "extension not connected." Always have the Playwright path ready.team-mode-orchestration-verification: that one says "verify filesystem ground truth before trusting teammate self-reports." This one says "verify user-visible ground truth before trusting even the filesystem." They stack.mcp__plugin_playwright_playwright__browser_*team-mode-orchestration-verification (sibling: filesystem ground truth)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub cajias/claude-skills --plugin testing4 skills in this plugin
/claude-workflow-tdd-harnessReusable Node.js harness for unit-testing Claude Code Workflow scripts
(the `Workflow` tool's `.js` files) with `node:test`. Use when: (1) you
need to test a Workflow script's args contract / phase order / per-agent
schema shape WITHOUT actually invoking the Workflow tool (which spawns
real agents, costs tokens, is slow, and is only available in the parent
session); (2) `node --test` rejects the file with `SyntaxError:
Unexpected token 'export'` or `Illegal return statement` because the
script uses top-level `await`, top-level `return`, and injected globals
(`agent`, `phase`, `log`, `budget`, `parallel`, `pipeline`, `workflow`);
(3) you want a per-label mock-agent dispatch pattern so each `agent()`
call can return a different shape; (4) you want budget-gate /
short-circuit / phase-order tests to land before any live Workflow call.
Ships a ~110-line ESM harness (no deps) that strips `export const
meta = {...}` via brace-counting, wraps the body in `AsyncFunction`,
injects configurable mocks for all Workflow globals.
/mutation-verify-render-testsVerify that "scene-capture" / pixel-analysis tests for a graphical renderer (pygame,
canvas, matplotlib, headless GL, screenshot-diff) actually CATCH a broken render —
by mutation testing. Use when: (1) you've written or received tests that render a
frame headlessly and assert properties of the pixels (e.g. "pitch is green", "HUD
present", "sprites on screen"); (2) an agent reports "N scene tests passing" and you
need to know if they're REAL or hollow; (3) a pixel/region assertion passes but you
suspect it's satisfied by the wrong pixels (background, anti-aliasing, adjacent UI);
(4) before trusting any image-correctness test as a guard. The core technique:
temporarily break the renderer (stub the draw call) and confirm the test FAILS; then
restore and confirm it PASSES. A scene test that passes when the thing it checks is
removed is worthless.