organizing-streamlit-code

Installation
SKILL.md

Streamlit code organization

For most simple apps, keep everything in one file—it's cleaner and more straightforward. The app file should read like a normal Python script for data processing, with a few Streamlit commands sprinkled in.

Name the main file streamlit_app.py (Streamlit's default).

When to split

Keep in one file (most apps):

  • Apps under ~1000 lines
  • One-off scripts and prototypes
  • Apps where logic is straightforward

Consider splitting when:

  • Data processing is complex (50+ lines of non-UI code)
  • Multiple pages share logic
  • You want to test business logic separately

If splitting makes sense, here's how to organize it.

Related skills

More from streamlit/agent-skills

Installs
3
GitHub Stars
186
First Seen
Mar 28, 2026