/streamlit-to-sigma:streamlit-to-sigmafrom Streamlit → Sigma
Converts Streamlit projects into Sigma data models and workbooks via safe static Python analysis. Supports SQL-backed dataframes, controls, charts, and multipage apps.
Ships in Streamlit → Sigma. 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.
Read when SKILL.md points to them.
Static analysis is the safety boundary: never import or execute the Streamlit
app during discovery. Translate only behavior whose source/dataframe lineage
is proven. Everything else stays visible in gaps.json.
This skill uses the companion sigma-authoring skills as the source of truth
for Sigma data-model/workbook shapes. Run commands from this skill directory.
Read before converting:
Accept a project directory or a single main file. A complete Streamlit-in-Workspaces project usually contains:
snowflake.yml
pyproject.toml
streamlit_app.py
pages/*.py or app_pages/*.py
lib/*.py
.streamlit/config.toml
The analyzer follows Python artifacts listed in snowflake.yml, local page
files, and helper modules. It reads configuration and source text only.
python3 scripts/streamlit-convert.py /path/to/project \
--connection <sigma-connection-id> \
--folder <sigma-folder-id> \
--name "Project Name" \
--out-dir /tmp/project-migration
Outputs:
streamlit-ir.json — source/provenance-aware normalized contractsource-signature.json — reuse-check inputgaps.json and security.jsondm-spec.json / dm-result.jsonwb-spec.json / workbook-result.jsonlayout.xmlparity-plan.jsonThe offline workbook defaults to custom-SQL sources because those preserve source semantics without guessing server-remapped DM ids.
Dry-run is the default:
python3 scripts/migrate-streamlit.py /path/to/project \
--connection <sigma-connection-id> \
--out-dir /tmp/project-migration
Posting requires explicit gate decisions:
python3 scripts/migrate-streamlit.py /path/to/project \
--connection <sigma-connection-id> \
--name "Project Name" \
--reuse-decision custom-sql \
--ack-security \
--post
Alternative reuse decisions:
new-dm — post the generated DM, read back real ids, then build/post the
workbook from those ids.reuse --dm-id <id> — GET an existing DM and match query elements by name.custom-sql — record the deliberate no-new-DM decision and preserve each
source SQL query directly in the workbook.The orchestrator never declares completion. It writes parity-final.json with
status: not-run; Phase 6 must turn that evidence GREEN.
Set SIGMA_BASE_URL, then prefer a one-time interactive browser login:
export SIGMA_BASE_URL='https://<your-published-sigma-api-host>'
eval "$(bash scripts/browser-login.sh)"
The refresh session is stored in the OS keychain. Later orchestrator runs reuse
a valid caller/browser token, refresh a token whose known age exceeds 50
minutes, and refresh/retry once after a 401. They do not open a browser
implicitly. For unattended hosts, set SIGMA_CLIENT_ID and
SIGMA_CLIENT_SECRET; the same provider falls back to client credentials when
no browser session is available. A valid pre-minted SIGMA_API_TOKEN is also
honored.
For one project, run discovery and review:
For an estate/shortlist, use the sibling streamlit-assessment skill.
When presenting complexity or Sigma benefits, read
../streamlit-assessment/refs/migration-readout.md.
Do not convert the complexity score into a hardcoded calendar promise. Present the technical delivery class and drivers; use organization telemetry for any local duration mapping.
converter/analyzer.py performs dependency-free AST discovery:
streamlit calls and local page modulesconn.query() loader functionsDynamic f-string SQL is blocking by default. SELECT * or unresolved output
columns require schema hints before a DM can be posted.
Always inspect source-signature.json before creating a DM:
ruby scripts/find-or-pick-dm.rb \
--workbook-signature /tmp/project-migration/source-signature.json
Reuse only when connection, SQL/table paths, joins, output columns, row filters, and grain are equivalent. A model that is merely in the same business domain is not a match.
The orchestrator exits 14 if --post is requested without a recorded
--reuse-decision.
The converter emits:
Current mechanical translations include:
st.metric → KPIst.columns → proportional gridst.tabs → tabbed containerst.link_button, st.page_link, and button-wrapped
st.switch_page → public open-url / navigate actionsDo not fake unresolved bindings. Omit the affected output and add a warning/gap.
For new-dm, the orchestrator:
/v2/dataModels/spec./v2/dataModels/{id}/spec.Client placeholder ids are never trusted after DM create.
Workbook code representation is wrapped:
{
"name": "...",
"folderId": "...",
"document": {
"schemaVersion": 1,
"kind": "workbook",
"elements": [],
"pages": [],
"layout": "..."
}
}
Elements are flat. Pages are metadata only. Every element is placed exactly
once in layout. scripts/lib/code_rep.py is the shared adapter.
Layout is generated with the workbook and must be preserved on every write:
<TabbedContainer>/<Tab>The final workbook write is layout-safe and last. Never PUT a partial document. Export every page/overlay to PNG after posting.
Required evidence:
Then update parity-final.json and run:
ruby scripts/assert-phase6-ran.rb \
--workdir /tmp/project-migration \
--workbook-id <workbook-id>
Compilation/readback alone is not parity.
Discovery always scans for:
st.user and authentication librariesReview security.json. Posting exits 12 until --ack-security is supplied.
RLS/CLS application is opt-in and must be modeled through Sigma user attributes,
DM filters, and column security. Never print secret values.
Classify each component:
plugin-candidate; hand off to
sigma-plugin-authoring and require durable HTTPS hosting/registration.Plugin generation is not automatic in the current release.
Read refs/live-api-capabilities.md before
authoring Python, selected-row action values, workbook-agent integration, or
stored-procedure actions.
Do not classify every form, callback, or write as an undifferentiated gap. Assign one or more migration dispositions:
spec-native — controls, formulas, public-spec actions, overlays, or input
tables cover the behavior.warehouse-backed — generate/reuse tables, views, procedures, grants, and
connection refresh steps.manual-ui-finish — Sigma supports the feature, but workbook GET omits it or
POST/PUT rejects the UI-authored host. Name the exact manual wiring step.plugin — a hosted client-side component is justified.redesign / blocked — the architecture or source cannot be lowered safely.Additional capability-gated candidates:
python-element-candidate — reviewed code element plus a named
source.kind: code-output; only after the workspace, connection, runtime, and
output readback probes pass.workbook-agent-candidate — discover/list/run an existing workbook agent for
AI/chat behavior, or author document.agents plus a chat element when the
grounding sources and instructions are proven.Treat SNOWFLAKE.CORTEX.COMPLETE as a completion runtime, not a Cortex Agent.
If setup SQL defines an agent that application code never invokes, emit
agent-runtime-mismatch and migrate observed behavior explicitly. For a Sigma
agent redesign, attach only governed grounding tables, preserve filter context,
and validate at least one analytical query and one search/policy answer.
Probe the live API before promising action parity. A UI picker is not proof of
public-spec authorability. Conversely, an OpenAPI discriminator is not enough:
the chosen element/connection host must pass /verify, real POST/PUT, readback,
and click testing.
For bounded forms, prefer a native form or pending controls plus separate applied
controls. For durable state, prefer input-table row actions or warehouse-backed
tables/views/procedures. Require a browser-triggered sandbox write before
declaring insert-rows, update-rows, or delete-rows complete. If procedure
actions are UI-only in the target workspace, generate the warehouse contract and
a manual-ui-finish handoff rather than emitting a rejected or silently dropped
action shape.
st.form callbacks beyond native form actions or staged/applied
controls require an explicit redesignmanual-ui-finish stepThese are honest gaps, not silent drops.
QUICKSTART.md (opens in a new tab)converter/__init__.py (opens in a new tab)converter/analyzer.py (opens in a new tab)converter/api_capabilities.py (opens in a new tab)converter/data_model.py (opens in a new tab)converter/model.py (opens in a new tab)converter/workbook.py (opens in a new tab)fixtures/retail-fulfillment-control-tower/EXPECTED.md (opens in a new tab)fixtures/retail-fulfillment-control-tower/INTERACTION-VALIDATION.md (opens in a new tab)fixtures/retail-fulfillment-control-tower/app_pages/exceptions.py (opens in a new tab)fixtures/retail-fulfillment-control-tower/app_pages/executive.py (opens in a new tab)fixtures/retail-fulfillment-control-tower/app_pages/fulfillment.py (opens in a new tab)fixtures/retail-fulfillment-control-tower/app_pages/returns.py (opens in a new tab)fixtures/retail-fulfillment-control-tower/lib/data.py (opens in a new tab)fixtures/retail-fulfillment-control-tower/lib/filters.py (opens in a new tab)fixtures/retail-fulfillment-control-tower/lib/metrics.py (opens in a new tab)fixtures/retail-fulfillment-control-tower/pyproject.toml (opens in a new tab)fixtures/retail-fulfillment-control-tower/snowflake.yml (opens in a new tab)fixtures/retail-fulfillment-control-tower/source-validation.sql (opens in a new tab)fixtures/retail-fulfillment-control-tower/sql/orders.sql (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
2 skills in this plugin
npx claudepluginhub sigmacomputing/sigma-migration-skills --plugin streamlit-to-sigmaOther plugins' skills for the same job