From dakesan-marimo-cc
This skill should be used when working with marimo reactive notebooks for data science and analytics. Triggers include: - Creating new marimo notebooks - Converting Jupyter notebooks to marimo - Editing existing marimo notebooks - Implementing reactive patterns and UI components - Building interactive data visualizations with marimo
npx claudepluginhub joshuarweaver/cascade-data-analytics --plugin dakesan-marimo-ccThis skill uses the workspace's default tool permissions.
This skill provides specialized guidance for creating data science notebooks using marimo's reactive programming model. Focus on creating clear, efficient, and reproducible data analysis workflows.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
This skill provides specialized guidance for creating data science notebooks using marimo's reactive programming model. Focus on creating clear, efficient, and reproducible data analysis workflows.
Marimo is a reactive notebook that differs from traditional notebooks in key ways:
import marimo as moMarimo's reactivity means:
.value attributeplt.gca() as the last expression instead of plt.show().value attribute (e.g., slider.value)mo.hstack(), mo.vstack(), and mo.tabs()vega_datasets for common example datasets_df = mo.sql(query)mo.sql()vega_datasets for common example datasetsCommon issues and solutions:
mo.ui.altair_chart(altair_chart)mo.ui.button(value=None, kind='primary')mo.ui.run_button(label=None, tooltip=None, kind='primary')mo.ui.checkbox(label='', value=False)mo.ui.date(value=None, label=None, full_width=False)mo.ui.dropdown(options, value=None, label=None, full_width=False)mo.ui.file(label='', multiple=False, full_width=False)mo.ui.number(value=None, label=None, full_width=False)mo.ui.radio(options, value=None, label=None, full_width=False)mo.ui.refresh(options: List[str], default_interval: str)mo.ui.slider(start, stop, value=None, label=None, full_width=False, step=None)mo.ui.range_slider(start, stop, value=None, label=None, full_width=False, step=None)mo.ui.table(data, columns=None, on_select=None, sortable=True, filterable=True)mo.ui.text(value='', label=None, full_width=False)mo.ui.text_area(value='', label=None, full_width=False)mo.ui.data_explorer(df)mo.ui.dataframe(df)mo.ui.plotly(plotly_figure)mo.ui.tabs(elements: dict[str, mo.ui.Element])mo.ui.array(elements: list[mo.ui.Element])mo.ui.form(element: mo.ui.Element, label='', bordered=True)mo.md(text) - display markdownmo.stop(predicate, output=None) - stop execution conditionallymo.Html(html) - display HTMLmo.image(image) - display an imagemo.hstack(elements) - stack elements horizontallymo.vstack(elements) - stack elements verticallymo.tabs(elements) - create a tabbed interface# Cell 1
import marimo as mo
import matplotlib.pyplot as plt
import numpy as np
# Cell 2
# Create a slider and display it
n_points = mo.ui.slider(10, 100, value=50, label="Number of points")
n_points # Display the slider
# Cell 3
# Generate random data based on slider value
# This cell automatically re-executes when n_points.value changes
x = np.random.rand(n_points.value)
y = np.random.rand(n_points.value)
plt.figure(figsize=(8, 6))
plt.scatter(x, y, alpha=0.7)
plt.title(f"Scatter plot with {n_points.value} points")
plt.xlabel("X axis")
plt.ylabel("Y axis")
plt.gca() # Return the current axes to display the plot
# Cell 1
import marimo as mo
import pandas as pd
from vega_datasets import data
# Cell 2
# Load and display dataset with interactive explorer
cars_df = data.cars()
mo.ui.data_explorer(cars_df)
# Cell 1
import marimo as mo
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Cell 2
# Load dataset
iris = sns.load_dataset('iris')
# Cell 3
# Create UI elements
species_selector = mo.ui.dropdown(
options=["All"] + iris["species"].unique().tolist(),
value="All",
label="Species"
)
x_feature = mo.ui.dropdown(
options=iris.select_dtypes('number').columns.tolist(),
value="sepal_length",
label="X Feature"
)
y_feature = mo.ui.dropdown(
options=iris.select_dtypes('number').columns.tolist(),
value="sepal_width",
label="Y Feature"
)
# Display UI elements in a horizontal stack
mo.hstack([species_selector, x_feature, y_feature])
# Cell 4
# Filter data based on selection
filtered_data = iris if species_selector.value == "All" else iris[iris["species"] == species_selector.value]
# Create visualization based on UI selections
plt.figure(figsize=(10, 6))
sns.scatterplot(
data=filtered_data,
x=x_feature.value,
y=y_feature.value,
hue="species"
)
plt.title(f"{y_feature.value} vs {x_feature.value}")
plt.gca()
# Cell 1
import marimo as mo
import altair as alt
import pandas as pd
# Cell 2
# Load dataset
cars_df = pd.read_csv('https://raw.githubusercontent.com/vega/vega-datasets/master/data/cars.json')
_chart = alt.Chart(cars_df).mark_point().encode(
x='Horsepower',
y='Miles_per_Gallon',
color='Origin',
)
chart = mo.ui.altair_chart(_chart)
chart
# Cell 3
# Display the selection
chart.value
# Cell 1
import marimo as mo
# Cell 2
first_button = mo.ui.run_button(label="Option 1")
second_button = mo.ui.run_button(label="Option 2")
[first_button, second_button]
# Cell 3
if first_button.value:
print("You chose option 1!")
elif second_button.value:
print("You chose option 2!")
else:
print("Click a button!")
# Cell 1
import marimo as mo
# Cell 2
# Load dataset
cars_df = pd.read_csv('https://raw.githubusercontent.com/vega/vega-datasets/master/data/cars.json')
# Cell 3
_df = mo.sql("SELECT * from cars_df WHERE Miles_per_Gallon > 20")
# Cell 1
import marimo as mo
# Cell 2
mo.md(r"""
The quadratic function $f$ is defined as
$$f(x) = x^2.$$
""")