What problem does it solve?
Streamlit apps often rerun entire scripts on every interaction and can become slow or memory-heavy when loading large datasets, models, or expensive computations. This Skill helps developers eliminate unnecessary recomputation, control cache growth, and isolate UI pieces so apps remain responsive under real-world usage.
Core Features & Use Cases
- Caching best practices: Guidance for using st.cache_data for serializable data and st.cache_resource for connections and models, including TTLs, max_entries, and anti-patterns to avoid shared-mutable state.
- Fragmentation and batching: Use @st.fragment, run_every, and st.form to isolate reruns, auto-refresh metrics safely, and batch user inputs to prevent full-app reruns.
- Conditional rendering and large data handling: Techniques to avoid loading heavy content in hidden containers, sample or stream very large datasets, and prefer pre-computation or DB-backed queries for massive workloads.
- Use Case: Convert a slow analytics dashboard that reloads on every widget change into a responsive app by caching the expensive data loads, isolating live metrics in fragments, and batching filter inputs in forms.
Quick Start
Analyze my Streamlit app and recommend specific places to apply st.cache_data, st.cache_resource, fragments, forms, conditional rendering, and cache TTL/max_entries settings to reduce reruns and memory growth.