Agent skill
dash-1-optimize-callback-performance
Sub-skill of dash: 1. Optimize Callback Performance (+3).
Install this agent skill to your Project
npx add-skill https://github.com/vamseeachanta/workspace-hub/tree/main/.claude/skills/_archive/data/analysis/dash/1-optimize-callback-performance
SKILL.md
1. Optimize Callback Performance (+3)
1. Optimize Callback Performance
# Use prevent_initial_call when appropriate
@callback(
Output("output", "children"),
Input("button", "n_clicks"),
prevent_initial_call=True
)
def handle_click(n_clicks):
return f"Clicked {n_clicks} times"
# Use State for non-triggering inputs
@callback(
Output("output", "children"),
Input("submit-btn", "n_clicks"),
State("input-field", "value") # Doesn't trigger callback
)
def submit_form(n_clicks, value):
return f"Submitted: {value}"
2. Efficient Data Loading
# Cache expensive computations
from flask_caching import Cache
cache = Cache(app.server, config={"CACHE_TYPE": "simple"})
@cache.memoize(timeout=300)
def load_data():
return pd.read_parquet("large_file.parquet")
3. Modular Callbacks
# Separate callbacks into modules
# callbacks/analytics.py
from dash import callback, Output, Input
def register_callbacks(app):
@callback(
Output("chart", "figure"),
Input("dropdown", "value")
)
def update_chart(value):
return create_figure(value)
4. Error Handling
from dash import callback, Output, Input
from dash.exceptions import PreventUpdate
@callback(
Output("output", "children"),
Input("input", "value")
)
def safe_callback(value):
if value is None:
raise PreventUpdate
try:
result = process(value)
return result
except Exception as e:
return html.Div(f"Error: {str(e)}", className="text-danger")
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
gsd-complete-milestone
Archive completed milestone and prepare for next version
gsd-reapply-patches
Reapply local modifications after a GSD update
gsd-verify-work
Validate built features through conversational UAT
gsd-thread
Manage persistent context threads for cross-session work
clinical-trial-protocol
Generate clinical trial protocols for medical devices or drugs through a modular, waypoint-based architecture with research-only and full protocol modes.
single-cell-rna-qc
Performs quality control on single-cell RNA-seq data (.h5ad or .h5 files) using scverse best practices with MAD-based filtering and comprehensive visualizations.
Didn't find tool you were looking for?