Set up a Python project so files are simultaneously marimo interactive notebooks and pytest test modules — assertions are the source of truth, cells render the results. Use when the user wants notebooks that double as tests, asks to wire up marimo with pytest, or wants executable documentation/tutorials that stay green in CI.
Ships in research-engineering-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Set up a Python project so that notebooks/*.py are simultaneously
marimo interactive notebooks and pytest test modules.
Assumes marimo is installed as a dev dependency alongside pytest.
This skill owns the notebook-as-test wiring — the test_* / @app.cell
split below. It does not redefine how marimo cells are written. That is
owned by marimo's official marimo-notebook skill. Load that skill by name and
always follow it when writing the cell bodies — it installs alongside this one
(bundled in the research-engineering-skills plugin; fetched as a sibling skill
by npx skills). Canonical upstream:
marimo-team/skills. Do not run npx skills add marimo-team/skills to reinstall it — it already ships alongside
this skill.
Apply its rules verbatim. The load-bearing ones, repeated here so they are never skipped:
# /// script … # dependencies = ["marimo", …] … # ///).if/try.mo.app_meta().mode == "script" (synthetic/default data in script mode,
widget values interactively). Don't conditionally hide widgets.mo.md(r"""$...$""") so the notebook mirrors the
paper's notation._ for a
cell-local throwaway or two, not as a habit.marimo check <notebook.py> before committing to catch the common
mistakes automatically.When marimo's guidance and the wiring below ever disagree, marimo wins on cell
style; this skill only dictates the test_* / cell split and the execution
modes.
Every notebook file has three layers:
import marimo
app = marimo.App(width="medium")
# 1. test_* functions at module level — importable, pytest-visible.
# Convention: return results so cells can reuse them for display
# without running the logic twice.
def test_something():
from mylib import thing
result = thing()
assert result == expected
return result
# 2. @app.cell functions — marimo reactive UI.
# mo is imported once in the first cell and flows as a dependency.
@app.cell
def _():
import marimo as mo
return (mo,)
@app.cell
def _(mo):
result = test_something() # assertion always runs inside the cell
return (mo.md(f"✓ result: {result}"),)
# 3. entry point — launches the notebook UI when run directly
if __name__ == "__main__":
app.run()
| command | behaviour |
|---|---|
pytest notebooks/ | finds test_* functions at module level, runs assertions |
marimo run notebooks/foo.py | interactive notebook; cells call test_* then render prose |
python notebooks/foo.py | launches the notebook UI |
from notebooks.foo import test_x | plain import, marimo never invoked |
[project.optional-dependencies]
test = ["pytest>=7", "marimo>=0.9"] # marimo is a dev dep; add your package(s) under test
[tool.pytest.ini_options]
testpaths = ["tests"] # default: fast unit tests only
# to include notebook integration tests: pytest tests/ notebooks/
test_* functions never import marimo — pure logic, no UI coupling.import marimo as mo lives in the first cell only; all subsequent
cells receive mo as a parameter via marimo's dependency injection.@app.cell returns a Cell object, not the original function, so
pytest will not accidentally treat cell functions as tests._ are fine: marimo registers each before the
name is rebound; pytest ignores underscore-prefixed names.test_* first, then display — the assertion is the
single source of truth, the cell just renders the result.tests/tutorials/ — preferred when the notebooks are tutorial-style tests
for a library. Sits inside the existing test tree alongside unit tests; since
pytest recurses into tests/, no extra testpaths config is needed.notebooks/ — alternative if docs-primary identity is preferred.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/research-engineering-skills:marimo-notebook-testsfrom research-engineering-skills
npx claudepluginhub 0x0f0f0f/research-engineering-skills --plugin research-engineering-skills16 skills in this plugin
/add-molab-badgeAdd "Open in molab" badge(s) linking to marimo notebooks. Works with READMEs, docs, websites, or any markdown/HTML target./anywidget-generatorGenerate anywidget components for marimo notebooks./auto-paper-demoMake a demo of a research paper in a marimo notebook fully automatically without extra user input./consult-referencesBefore non-trivial changes, consult the project's references/ directory — vendored repos and paper notes — to ground the work in primary sources instead of guessing. Trigger when about to design, implement, or modify code that involves an algorithm, formula, or API that's covered by a paper or reference repo in references/; when the user mentions a concept that matches a reference (e.g. "DSR", "CPCV", "GEPA", "Pareto selection"); or when the user explicitly says "check references", "consult the literature", "look up X in the repos". Also use to bootstrap references/ structure in a new project./implement-paperImplement a research paper as an interactive marimo notebook together with the user. Start by understanding what the user wants to explore, fetch the paper via alphaxiv, then build a focused notebook./implement-paper-autoImplement a research paper in a marimo notebook fully automatically without extra user input.