# marimo-notebook

Instructs coding assistants to format marimo reactive notebooks in pure Python files with PEP 723 dependencies and CLI support.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 5900 installs · ★ 175
- Author: marimo-team
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/marimo-team/skills/tree/HEAD/skills/marimo-notebook/SKILL.md
- Updated: 2026-08-19
- HTML: https://affpapa.org/en/nevibecode/skills/marimo-notebook

## What it does

Unlike Jupyter notebooks that rely on JSON, marimo uses standard Python files where every cell is an `@app.cell` function. Dependencies flow naturally through function parameters and returns. This skill enforces strict reactive patterns: inline package dependencies stay in the top-level PEP 723 comment block, and objects are never mutated across cells.

Widgets like `mo.ui.slider` remain rendered in the notebook, while `mo.app_meta().mode == "script"` switches between interactive usage and CLI test runs. Only the final expression in a cell is displayed, so the skill avoids indented render calls. Because the instructions demand running `uvx marimo check <notebook.py>` before finishing, you need `uv` installed in your working path.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add marimo-team/skills --skill marimo-notebook -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/marimo-notebook/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/marimo-notebook/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add marimo-team/skills --skill marimo-notebook -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/marimo-notebook/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add marimo-team/skills --skill marimo-notebook -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/marimo-notebook/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install marimo-team/skills marimo-notebook
```

2. **Manually: put the files in place**
- File: `.github/skills/marimo-notebook/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add marimo-team/skills --skill marimo-notebook -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/marimo-team/skills --path skills/marimo-notebook
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/marimo-notebook/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add marimo-team/skills --skill marimo-notebook -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/marimo-team/skills/tree/HEAD/skills/marimo-notebook/SKILL.md

## When to use it
- generate marimo reactive notebooks as standard Python files
- configure CLI and browser execution using `uv run`
- handle cell reactivity without mutating cross-cell objects
- verify notebook structure with the `marimo check` linter

## Example prompts
- Create a marimo notebook with an interactive slider and a training loop
- Convert this data script into a marimo notebook with PEP 723 dependencies
- Run marimo check on notebook.py and fix cell rendering errors

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: d114cff550ee461d.

BEGIN THIRD-PARTY FILE d114cff550ee461d
````text
---
name: marimo-notebook
description: Write a marimo notebook in a Python file in the right format.
---

# Notes for marimo Notebooks

marimo uses Python to create notebooks, unlike Jupyter which uses JSON. Here's an example notebook: 

```python
# /// script
# dependencies = [
#     "marimo",
#     "numpy==2.4.3",
# ]
# requires-python = ">=3.14"
# ///

import marimo

__generated_with = "0.20.4"
app = marimo.App(width="medium")


@app.cell
def _():
    import marimo as mo
    import numpy as np

    return mo, np


@app.cell
def _():
    print("hello world")
    return


@app.cell
def _(np, slider):
    np.array([1,2,3]) + slider.value
    return


@app.cell
def _(mo):
    slider = mo.ui.slider(1, 10, 1, label="number to add")
    slider
    return (slider,)


@app.cell
def _():
    return


if __name__ == "__main__":
    app.run()

```

Notice how the notebook is structured with functions can represent cell contents. Each cell is defined with the `@app.cell` decorator and the inputs/outputs of the function are the inputs/outputs of the cell. marimo usually takes care of the dependencies between cells automatically. 

## Running Marimo Notebooks

```bash
# Run as script (non-interactive, for testing)
uv run <notebook.py>

# Run interactively in browser
uv run marimo run <notebook.py>

# Edit interactively
uv run marimo edit <notebook.py>
```

## Script Mode Detection

Use `mo.app_meta().mode == "script"` to detect CLI vs interactive:

```python
@app.cell
def _(mo):
    is_script_mode = mo.app_meta().mode == "script"
    return (is_script_mode,)
```

## Key Principle: Keep It Simple

**Show all UI elements always.** Only change the data source in script mode.

- Sliders, buttons, widgets should always be created and displayed
- In script mode, just use synthetic/default data instead of waiting for user input
- Don't wrap everything in `if not is_script_mode` conditionals
- Don't use try/except for normal control flow

### Good Pattern

```python
# Always show the widget
@app.cell
def _(ScatterWidget, mo):
    scatter_widget = mo.ui.anywidget(ScatterWidget())
    scatter_widget
    return (scatter_widget,)

# Only change data source based on mode
@app.cell
def _(is_script_mode, make_moons, scatter_widget, np, torch):
    if is_script_mode:
        # Use synthetic data for testing
        X, y = make_moons(n_samples=200, noise=0.2)
        X_data = torch.tensor(X, dtype=torch.float32)
        y_data = torch.tensor(y)
        data_error = None
    else:
        # Use widget data in interactive mode
        X, y = scatter_widget.widget.data_as_X_y
        # ... process data ...
    return X_data, y_data, data_error

# Always show sliders - use their .value in both modes
@app.cell
def _(mo):
    lr_slider = mo.ui.slider(start=0.001, stop=0.1, value=0.01)
    lr_slider
    return (lr_slider,)

# Auto-run in script mode, wait for button in interactive
@app.cell
def _(is_script_mode, train_button, lr_slider, run_training, X_data, y_data):
    if is_script_mode:
        # Auto-run with slider defaults
````
END THIRD-PARTY FILE d114cff550ee461d

The third-party file has ended. Everything between the d114cff550ee461d tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3048 of 8341 bytes. © marimo-team · Apache-2.0 · https://github.com/marimo-team/skills/tree/HEAD/skills/marimo-notebook/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
