designing-real-world-ai-agents-workshop: Skill for Claude Code

.agents/skills/developing-with-streamlit/skills/optimizing-streamlit-performance/SKILL.md

optimizing-streamlit-performance is a skill for Claude Code, Codex from iusztinpaul/designing-real-world-ai-agents-workshop. It costs 41 tokens per session (2,090 once invoked), scanned A, original, MIT.

A guide to making Streamlit, a Python framework for interactive web apps, run faster and rerun less often. It covers caching, partial reruns called fragments, and choosing between static and dynamic widgets.

In plain words
What is it for?
Use it to cache data and shared resources, clean up connections when they expire, reduce unnecessary reruns, and improve slow Streamlit apps.
Why use it?
It helps avoid repeating expensive data loads, model loads, or calculations every time a user interacts with the app.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

This is iusztinpaul/designing-real-world-ai-agents-workshop's own configuration. It tells Claude Code and Codex how to work on designing-real-world-ai-agents-workshop itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything designing-real-world-ai-agents-workshop configures →

Reuse

Borrowing it

Nothing to install: this file belongs to iusztinpaul/designing-real-world-ai-agents-workshop. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/iusztinpaul/designing-real-world-ai-agents-workshop/main/.agents/skills/developing-with-streamlit/skills/optimizing-streamlit-performance/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/iusztinpaul/designing-real-world-ai-agents-workshop

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for optimizing-streamlit-performance

README.md
[![agentmods](https://agentmods.dev/badge/skills/iusztinpaul/designing-real-world-ai-agents-workshop/optimizing-streamlit-performance/github.svg)](https://agentmods.dev/skills/iusztinpaul/designing-real-world-ai-agents-workshop/optimizing-streamlit-performance)
Your own site
<a href="https://agentmods.dev/skills/iusztinpaul/designing-real-world-ai-agents-workshop/optimizing-streamlit-performance"><img src="https://agentmods.dev/badge/skills/iusztinpaul/designing-real-world-ai-agents-workshop/optimizing-streamlit-performance/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for optimizing-streamlit-performance

Your own site · 80×15
<a href="https://agentmods.dev/skills/iusztinpaul/designing-real-world-ai-agents-workshop/optimizing-streamlit-performance"><img src="https://agentmods.dev/badge/skills/iusztinpaul/designing-real-world-ai-agents-workshop/optimizing-streamlit-performance.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,090 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00041 $0.02090
Opus 5 $0.00020 $0.01045
Sonnet 5 $0.00008 $0.00418
Haiku 4.5 $0.00004 $0.00209

Measured 12d ago against content hash 9bf83cac55a3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

optimizing-streamlit-performance scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

results[index] = requests.get(url).json() # No st.* calls!
.agents/skills/developing-with-streamlit/skills/optimizing-streamlit-performance/SKILL.md · 323 lines

How it starts

The opening of the file, as written. The whole thing — 323 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Streamlit performance

Performance is the biggest win. Without caching and fragments, your app reruns everything on every interaction.

Caching

@st.cache_data for data

Use for any function that loads or computes data.

# BAD: Recomputes on every rerun
def load_data(path):
    return pd.read_csv(path)

# GOOD: Cached
@st.cache_data
def load_data(path):
    return pd.read_csv(path)

@st.cache_resource for connections

Use for connections, API clients, ML models—objects that can't be serialized.

@st.cache_resource
def get_connection():
    return st.connection("snowflake")

@st.cache_resource
def load_model():
    return torch.load("model.pt")

Critical warning: Never mutate @st.cache_resource returns—changes affect all users:

# BAD: Mutating shared resource
@st.cache_resource
def get_config():
    return {"setting": "default"}

config = get_config()
config["setting"] = "custom"  # Affects ALL users!

# GOOD: Copy before modifying
config = get_config().copy()
config["setting"] = "custom"

Cleanup with on_release: Clean up resources when evicted from cache:

def cleanup_connection(conn):
    conn.close()

@st.cache_resource(on_release=cleanup_connection)
def get_database():
    return create_connection()

TTL for fresh data

@st.cache_data(ttl="5m")  # 5 minutes
def get_metrics():
    return api.fetch()

@st.cache_data(ttl="1h")  # 1 hour
def load_reference_data():
    return pd.read_csv("large_reference.csv")

Guidelines:

  • Real-time dashboards → ttl="1m" or less
  • Metrics/reports → ttl="5m" to ttl="15m"
  • Reference data → ttl="1h" or more
  • Static data → No TTL

Prevent unbounded cache growth

Important: Caches without ttl or max_entries can grow indefinitely and cause memory issues. For any cached function that stores changing objects (user-specific data, parameterized queries), set limits:

# BAD: Unbounded cache - memory will grow indefinitely
@st.cache_data
def get_user_data(user_id):
    return fetch_user(user_id)

# GOOD: Bounded cache with TTL
@st.cache_data(ttl="1h")
def get_user_data(user_id):
    return fetch_user(user_id)

# GOOD: Bounded cache with max entries
@st.cache_data(max_entries=100)
def get_user_data(user_id):
    return fetch_user(user_id)

Read the full file on GitHub · 323 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 323 lines · 41 tokens per session scan A 9bf83cac55a3

Subscribe to this mod's changes

optimizing-streamlit-performance is a skill published in the GitHub repository iusztinpaul/designing-real-world-ai-agents-workshop (505 stars, last pushed 3mo ago), licensed MIT. It adds 41 tokens to every session and 2,090 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

top-design

Create award-winning, immersive web experiences at the level of Awwwards-featured agencies. Use when the user mentions "Awwwards quality", "make my site stunning", "scroll animations", "parallax storytelling", "cinematic web design", "portfolio site", or "brand experience". Also trigger when elevating a standard…

wondelai/skills · 113 tokens

web-typography

Select, pair, and implement typefaces for web projects. Use when the user mentions "font pairing", "which typeface", "line height", "responsive typography", "web font loading", "type hierarchy", "variable fonts", "FOUT/FOIT", "typographic scale", or "the text is hard to read". Also trigger when choosing between system…

wondelai/skills · 128 tokens

figma-implement-design

Translate Figma nodes into production-ready code with 1:1 visual fidelity using the Figma MCP workflow (design context, screenshots, assets, and project-convention translation). Trigger when the user provides Figma URLs or node IDs, or asks to implement designs or components that must match Figma specs. Requires a…

foryourhealth111-pixel/Vibe-Skills · 76 tokens

netlify-deploy

Deploy web projects to Netlify using the Netlify CLI (npx netlify). Use when the user asks to deploy, host, publish, or link a site/repo on Netlify, including preview and production deploys.

foryourhealth111-pixel/Vibe-Skills · 51 tokens

refactoring-ui

Audit and fix visual hierarchy, spacing, color, and depth in web UIs. Use when the user mentions "my UI looks off" (or amateur/unprofessional), "fix the design", "Tailwind styling", "color palette", "visual hierarchy", "design system", "spacing scale", or "component styling". Also trigger when building consistent…

wondelai/skills · 132 tokens

html-artifact

Generate rich self-contained HTML artifacts instead of markdown. Auto-detects artifact shape (spec, code-review, prototype, report, editor, data-viz, diagram, deck) and loads shape-specific patterns. Bundles Birchline design system with 4 theme presets. Use for "make HTML", "as HTML", "HTML artifact", or auto-injected…

notque/vexjoy-agent · 89 tokens