/caddis-extras:streamlit-devfrom caddis-extras
Build production Streamlit dashboards: caching, components, theming. Use for any Streamlit page, component, chart or UI feature.
Ships in caddis-extras. 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.
Invoke this skill when:
Every Streamlit page MUST follow this structure:
"""Page Title - Brief description."""
import streamlit as st
# Page config MUST be the first Streamlit call
st.set_page_config(page_title="PageName", page_icon="icon", layout="wide")
# If using a shared header/navigation component:
# from components.header import render_header
# render_header(current_page="PageName")
# --- Page content below ---
st.set_page_config() MUST be the first Streamlit commandlayout="wide" for dashboardsBRAND_PRIMARY = "<BRAND_PRIMARY>" # Primary accent color
BRAND_DARK = "<BRAND_DARK>" # Headings, dark text
BRAND_LIGHT = "<BRAND_LIGHT>" # Page/card backgrounds
GRAY_500 = "#6C757D" # Secondary text
GRAY_100 = "#E9ECEF" # Borders, dividers
SUCCESS = "#22C55E" # Positive indicators
WARNING = "#F59E0B" # Warning indicators
ERROR = "#EF4444" # Error/negative indicators
<BRAND_LIGHT>)<BRAND_DARK>)<BRAND_PRIMARY>)# NEVER pass title directly to px functions
fig = px.pie(data, names="cat", values="count")
fig.update_layout(title="Chart Title", height=300)
import plotly.express as px
CHART_COLORS = ["<BRAND_PRIMARY>", "<BRAND_DARK>", "#6B7280", "#9CA3AF", "#D1D5DB"]
def create_chart(df, x, y, chart_type="bar", title=None):
if chart_type == "bar":
fig = px.bar(df, x=x, y=y, color_discrete_sequence=CHART_COLORS)
elif chart_type == "line":
fig = px.line(df, x=x, y=y, color_discrete_sequence=CHART_COLORS)
elif chart_type == "pie":
fig = px.pie(df, names=x, values=y, color_discrete_sequence=CHART_COLORS)
fig.update_layout(
title=title if title and title.strip() else "",
template="plotly_white",
font_family="Inter, sans-serif",
title_font_size=18,
legend_title_text="",
hovermode="x unified",
)
return fig
st.plotly_chart(fig, use_container_width=True)
from datetime import timedelta
@st.cache_data(ttl=timedelta(minutes=15), show_spinner="Loading data...")
def load_orders() -> pd.DataFrame:
return repo.get_all_orders()
@st.cache_resource
def get_repository():
return OrdersRepository()
| Decorator | Use For | Returns |
|---|---|---|
@st.cache_data | DataFrames, lists, dicts | Serialized copy |
@st.cache_resource | Connections, models, adapters | Same object ref |
def render_kpi_row(kpis: list[dict]):
cols = st.columns(len(kpis))
for col, kpi in zip(cols, kpis):
with col:
st.metric(label=kpi["label"], value=kpi["value"], delta=kpi.get("delta"))
st.dataframe(
df, use_container_width=True, hide_index=True,
column_config={
"id": st.column_config.TextColumn("ID", width="small"),
"created_at": st.column_config.DatetimeColumn("Created", format="DD/MM/YYYY HH:mm"),
}
)
def paginate_df(df, page, per_page):
start = (page - 1) * per_page
return df.iloc[start:start + per_page]
total_pages = (len(df) - 1) // per_page + 1
page = st.number_input(f"Page (of {total_pages})", 1, total_pages, 1)
st.dataframe(paginate_df(df, page, per_page))
def init_session_state():
defaults = {"authenticated": False, "selected_filters": {}, "page_number": 1}
for key, value in defaults.items():
if key not in st.session_state:
st.session_state[key] = value
def on_filter_change():
st.session_state.page_number = 1
st.selectbox("Category", options=categories, key="filter", on_change=on_filter_change)
with st.form("order_form", clear_on_submit=True):
customer_id = st.text_input("Customer ID*")
description = st.text_area("Description*", max_chars=2000)
priority = st.slider("Priority", 1, 5, 3)
if st.form_submit_button("Submit", type="primary"):
if not customer_id or not description:
st.error("Please fill in all required fields")
else:
save_order(customer_id, description, priority)
st.success("Submitted!")
try:
data = load_data()
render_dashboard(data)
except ConnectionError:
st.error("Unable to connect to database. Please try again later.")
except Exception:
st.error("An unexpected error occurred. Please contact support.")
if df.empty:
st.info("No data found for the selected filters.")
return
st.dataframest.session_state and callbacksst.fragment -- for widgets that shouldn't rerun the whole pageStreamlit wraps all st.markdown(unsafe_allow_html=True) in 20-30 nested <div> containers, breaking CSS position: fixed/absolute. Do NOT attempt CSS-only solutions for floating elements.
| Approach | Use For | Limitations |
|---|---|---|
st.markdown(unsafe_allow_html=True) | Inline styling, cards, badges | Wrapped in nested divs; no DOM control |
st.html() | Self-contained HTML snippets | Sandboxed iframe; no access to parent DOM |
components.declare_component() | Floating UI, chat widgets, FABs, toasts, modals | Requires HTML/JS file; bi-directional via setComponentValue |
Pattern: Use declare_component() with height=0 to create an invisible iframe, then inject elements into window.parent.document.body from the component's JavaScript.
CSS
position: fixedandz-indexescalation will never work reliably in Streamlit due to its DOM wrapping architecture.
st.set_page_config() is the first Streamlit callupdate_layout(title=...) not title= in px callWhat SKILL.md sets; muted values are Claude Code's defaults
81 skills in this plugin
/adopt-rbacPointer to the org's RBAC adoption skill. Use for "add RBAC to this app" or "adopt rbac-kit"./agent-md-refactorRefactor bloated agent instruction files (AGENTS.md, .cursorrules, .github/ files) into linked, progressively disclosed docs./agent-orchestrationBlueprint for orchestrating the agent pipeline from spec to planning, implementation, testing and debugging, plus when a second model is worth it, the intent→model map and cost guardrails.npx claudepluginhub saajunaid/caddis-plugin --plugin caddis-extras