When to trigger this skill
Use this skill whenever the user asks to create, refactor, clean up, lint, or productionize a Jupyter notebook (or a Jupytext notebook script) and they care about:
- Reproducibility (restart + run-all should work end-to-end)
- Per-directory environments via
pixi.toml (Pixi + pixi-kernel)
- Readable narrative (concise markdown guidance above each code cell)
- Reliable data access (DuckDB + tabular files, correct paths)
- Presentation quality (plots and markdown are visually polished)
If the task is not notebook-centric (e.g., pure library code), do not trigger.
Non‑negotiables (hard rules)
- KISS notebook: short, linear, top-to-bottom, no hidden dependencies between cells.
- Markdown-first: every code cell must be preceded by a markdown cell that:
- states intent in 1–3 sentences or bullets,
- tells what artifact/output will appear,
- notes assumptions (paths, schema, expected shapes).
- Reproducible execution gate: never claim “done” until:
- you restart the kernel (clean state) and execute all cells in order,
- you inspect outputs for correctness/sanity (not just “no exceptions”),
- you fix any warnings/errors that impact correctness.
- Paths must be correct: data files are loaded using paths anchored to the notebook/project directory (see
docs/data_loading_duckdb.md). Avoid hard-coded home directories.
- Pretty, tight plots: minimize whitespace; use a cohesive, non-default palette; label axes; include units; readable figure sizes.
Progressive disclosure (keep context lean)
The core rules live here. Load additional guidance only as needed:
- Notebook structure & markdown style:
docs/notebook_structure.md
- Pixi + Jupyter kernel setup:
docs/pixi_jupyter.md
- Data loading patterns (DuckDB + TSV/Parquet):
docs/data_loading_duckdb.md
- Plot styling rules (tight layout, palettes):
docs/plot_style.md
- Verification & “definition of done”:
docs/verification.md
Templates:
- Jupytext-first notebook template:
templates/kiss_notebook_template.py
- Minimal
pixi.toml example: templates/pixi.toml
- Optional DuckDB bootstrap:
templates/duckdb_bootstrap.sql
Automation scripts (if filesystem + Python execution is available):
- Execute notebook end-to-end:
scripts/execute_notebook.py
- Lint structure (markdown above code):
scripts/lint_notebook_structure.py
Recommended workflow (agent playbook)
Follow this sequence; do not skip the validation gate.
1) Plan the notebook (outline first)
- Create/confirm the notebook’s narrative outline:
- Title + 3-line purpose
- Environment & reproducibility notes
- Data sources (files, DBs), schema expectations
- Analysis/EDA/modeling steps
- Results + conclusions + next steps
2) Scaffold the notebook
- Use the template in
templates/kiss_notebook_template.py.
- Keep sections small; each section should have:
- a markdown heading,
- 1–3 code cells max.
3) Implement data access robustly
- Establish
PROJECT_ROOT and DATA_DIR.
- Validate file existence before reading.
- Prefer DuckDB for heavy joins/aggregations; keep pandas for presentation.
4) Create high-quality plots
- Use the plot style helper (see
docs/plot_style.md).
- No chart junk; tight margins; consistent typography.
5) Validation gate (mandatory)
- Restart kernel → run all cells.
- If you have CLI access, also run
scripts/execute_notebook.py for a clean execution.
- Check outputs:
- row counts, null rates, unique keys, value ranges,
- plot renders and labels,
- any randomness is seeded.
6) Report completion only after passing the gate
When reporting back, include:
- how you ran the notebook (restart+run-all, scripts),
- where data paths point,
- what key outputs/figures were produced,
- any caveats (e.g., external files required).
1---2name: notebook-kiss-builder-verifier-pixi-duckdb3description: Create/refactor Jupyter notebooks for AI-agent workflows with per-directory Pixi kernels (pixi.toml), narrative-first KISS structure (markdown above every code cell), robust data loading (DuckDB + TSV/Parquet), beautiful plots, and strict "run-all-cells" validation before reporting completion.4---5
6## When to trigger this skill
7Use this skill whenever the user asks to **create, refactor, clean up, lint, or productionize** a Jupyter notebook (or a Jupytext notebook script) and they care about:
8- **Reproducibility** (restart + run-all should work end-to-end)
9- **Per-directory environments** via `pixi.toml` (Pixi + pixi-kernel)
10- **Readable narrative** (concise markdown guidance above each code cell)
11- **Reliable data access** (DuckDB + tabular files, correct paths)
12- **Presentation quality** (plots and markdown are visually polished)
13
14If the task is not notebook-centric (e.g., pure library code), do **not** trigger.
15
16## Non‑negotiables (hard rules)
171. **KISS notebook**: short, linear, top-to-bottom, no hidden dependencies between cells.
182. **Markdown-first**: every code cell must be preceded by a markdown cell that:
19 - states intent in 1–3 sentences or bullets,
20 - tells what artifact/output will appear,
21 - notes assumptions (paths, schema, expected shapes).
223. **Reproducible execution gate**: never claim “done” until:
23 - you restart the kernel (clean state) and execute **all cells in order**,
24 - you inspect outputs for correctness/sanity (not just “no exceptions”),
25 - you fix any warnings/errors that impact correctness.
264. **Paths must be correct**: data files are loaded using paths anchored to the notebook/project directory (see `docs/data_loading_duckdb.md`). Avoid hard-coded home directories.
275. **Pretty, tight plots**: minimize whitespace; use a cohesive, non-default palette; label axes; include units; readable figure sizes.
28
29## Progressive disclosure (keep context lean)
30The core rules live here. Load additional guidance only as needed:
31
32- Notebook structure & markdown style: `docs/notebook_structure.md`
33- Pixi + Jupyter kernel setup: `docs/pixi_jupyter.md`
34- Data loading patterns (DuckDB + TSV/Parquet): `docs/data_loading_duckdb.md`
35- Plot styling rules (tight layout, palettes): `docs/plot_style.md`
36- Verification & “definition of done”: `docs/verification.md`
37
38Templates:
39- Jupytext-first notebook template: `templates/kiss_notebook_template.py`
40- Minimal `pixi.toml` example: `templates/pixi.toml`
41- Optional DuckDB bootstrap: `templates/duckdb_bootstrap.sql`
42
43Automation scripts (if filesystem + Python execution is available):
44- Execute notebook end-to-end: `scripts/execute_notebook.py`
45- Lint structure (markdown above code): `scripts/lint_notebook_structure.py`
46
47## Recommended workflow (agent playbook)
48Follow this sequence; do not skip the validation gate.
49
50### 1) Plan the notebook (outline first)
51- Create/confirm the notebook’s narrative outline:
52 - Title + 3-line purpose
53 - Environment & reproducibility notes
54 - Data sources (files, DBs), schema expectations
55 - Analysis/EDA/modeling steps
56 - Results + conclusions + next steps
57
58### 2) Scaffold the notebook
59- Use the template in `templates/kiss_notebook_template.py`.
60- Keep sections small; each section should have:
61 - a markdown heading,
62 - 1–3 code cells max.
63
64### 3) Implement data access robustly
65- Establish `PROJECT_ROOT` and `DATA_DIR`.
66- Validate file existence before reading.
67- Prefer DuckDB for heavy joins/aggregations; keep pandas for presentation.
68
69### 4) Create high-quality plots
70- Use the plot style helper (see `docs/plot_style.md`).
71- No chart junk; tight margins; consistent typography.
72
73### 5) Validation gate (mandatory)
74- Restart kernel → run all cells.
75- If you have CLI access, also run `scripts/execute_notebook.py` for a clean execution.
76- Check outputs:
77 - row counts, null rates, unique keys, value ranges,
78 - plot renders and labels,
79 - any randomness is seeded.
80
81### 6) Report completion only after passing the gate
82When reporting back, include:
83- how you ran the notebook (restart+run-all, scripts),
84- where data paths point,
85- what key outputs/figures were produced,
86- any caveats (e.g., external files required).