preview-app
Skill17 starsChanged 32 days agoMITView on GitHub
Run an app locally against live Snowflake so the user can see it in the browser, wiring up secrets.toml first if missing. Use when the user says "preview my app", "run my app", "let me see it in the browser", or after /build-app scaffolds an app.
- Installs packages
In this repository9 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- releaseSkill
- build-appSkill
- migrate-appSkill
- onboardSkill
- review-appSkill
- ship-appSkill
- sql-reviewSkill
- validate-appSkill
The file
Files
/preview-app
Repo overlay: if
.streamsnow/overlays/preview-app.mdexists in this repo, read it first — committed, repo-specific additions/overrides (_shared/overlays.md). Outside Claude Code, also read _shared/other-agents.md.
Launch apps/<slug> locally against live Snowflake and open it in the browser — the "see it
before you ship it" step, ahead of /validate-app and /ship-app. streamsnow preview owns the whole
lifecycle — detached launch, health polling, log capture, classified failures, teardown — so never
hand-roll streamlit run + nohup + PID bookkeeping. This skill owns the interactive UX: slug
confirmation, safe secrets provisioning, URL surfacing, triage.
Lifecycle verbs
streamsnow preview start <slug>(barestreamsnow preview <slug>is shorthand forstart) — verifies the entrypoint and port, launchesstreamlit rundetached with output to a log, then polls the health endpoint until it answers or the timeout expires.--port N(0: any free),--json,--review-capture DIR(/sql-review),--restart-if-stale(Gotchas). Exit 0 = serving; exit 1 = log tail classified (missingsecrets.toml, bad account identifier, missing package, port collision, session-outside-Snowflake) into an actionable hint — read it before improvising.streamsnow preview status <slug>— running/not-running, live health probe,staleif serving old code; a crashed preview's state is cleaned up silently, so it never wedges the nextstart.streamsnow preview logs <slug> [--lines N]: tail the log (kept afterstop); acause:line names a known failure.streamsnow preview stop <slug>— graceful kill, state removed; idempotent.
"Healthy" means serving, not "queries succeeded" — the health endpoint answers before the
first script run finishes; data errors surface in the browser and in logs, not in start.
Steps
- Resolve the slug. Named → use it; fresh from a
/build-appscaffold → that app; otherwise listapps/*/and ask. Confirmapps/<slug>/exists. - Verify prereqs once per session with
streamsnow doctor; anything missing → offer/onboardrather than launching into a broken environment. - Ensure a connection exists. The default
snowconnection (doctor'ssnow-connectioncheck) is whatst.connection("snowflake")reads; missing → hand the user thesnow connection add … --defaultline fromstreamsnow configure. Only when an app needs a different role or warehouse: copysecrets.toml.exampleand fill[connections.snowflake]from config (streamsnow config-get <path>), show the values and confirm before writing, never commit. - Pin the query role to one whose data reads match the CI role's (the viewer role with its opt-in data grants uncommented, or a developer role with the same reads), never a broad personal role: it hides missing grants, and the app ships with empty KPIs.
- Launch:
streamsnow preview start <slug>. Success prints the URL — open it verbatim, at the root (see Gotchas). Failure → relay the classified hint; only fall back tostreamsnow preview logs <slug>triage when the classifier had no match. - Report and invite click-through: give the URL, ask the user to open every page, confirm
queries return real data and charts render. Tell them
streamsnow preview stop <slug>ends it.
Gotchas
- Always open the root URL. Deep-linking a page serves that file standalone (legacy auto-pages
mode), skipping
st.set_page_configand branding — symptom: narrow layout, missing sidebar logo, raw file-stem names in a flat menu. - Warehouse-runtime apps: a
get_active_sessiontraceback locally is the runtime's signature, not a code bug — see _shared/runtime-decision.md; point at the app's commented local-parity fallback (revert before the PR) or verify in Snowsight. - A SQL or shared-module (
pages/_*.py) edit not showing, or anImportError? Imported modules and cached SQL outlive reruns:streamsnow preview start <slug> --restart-if-stale. - Don't run deploys locally —
deploy-setup/deploy-sqlfeed the CI workflow; preview is the only local-run path..streamsnow/(preview state + logs) belongs in.gitignore.
Troubleshooting
- Auth failures → recheck the
snowconnection (orsecrets.toml) against config: account identifier (myorg-myaccount), not hostname,externalbrowserfor SSO, never a password;streamsnow configureif config is stale. - Import errors in the log → stale
<repo>/.venv(the launcher prefers it);uv pip install -e apps/<slug>, relaunch. - A cryptic Snowflake error → _shared/deploy-error-translator.md maps common signatures to causes; its role/warehouse/grant diagnoses apply locally too.
Optional smoke walkthrough
For a hands-off pass, enumerate the pages with streamsnow nav <slug> (one JSON object per page:
title, path, group; --json-array for one payload) and drive Playwright across each per
_shared/playwright-walkthrough.md: advisory, silent skip
without the CLI. The nav list is the loop input; never guess page URLs from filenames.
Done when
The app serves at the reported root URL with live data, queried as a role whose data reads match
the CI role's, with no startup errors. Next step: /validate-app, then /ship-app. On "stop the
preview", run streamsnow preview stop <slug> and confirm.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

