Skip to content
Agentmart
Submit a tool

databricks-notebook

Databricks PySpark notebook (Python-source-format) structure and style: notebook header/cell contract, cell ordering, docstring steps, fail-fast validation…

Skill by mabrosim

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/mabrosim-databricks-notebook

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Databricks PySpark notebook (Python-source-format) structure and style: notebook header/cell contract, cell ordering, docstring steps, fail-fast validation, scheduled-job hygiene. Load when authoring or reviewing a Databricks notebook (.py file in Databricks Python-source format).

Use cases: documents

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/databricks-notebook

What's inside

Skill name
databricks-notebook
Description
Databricks PySpark notebook (Python-source-format) structure and style: notebook header/cell contract, cell ordering, docstring steps, fail-fast validation, scheduled-job hygiene. Load when authoring or reviewing a Databricks notebook (.py file in Databricks Python-source format).
License
MIT
Instructions
212 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Databricks Notebook

Structure and style rules for Databricks notebooks authored as `.py` files in
Databricks Python-source format. Builds on `python-style.instructions.md`; two
rules below deliberately override its general anti-patterns for this narrow
context — each says so explicitly.

Spark/Delta version pairs and portable DataFrame rules follow the
[PySpark skill](../pyspark/SKILL.md).

## Load Patterns and Solutions

Read the following files for named, ready-to-use implementations with when/replaces/gotchas:

- `../../catalogs/pyspark-patterns.md`
- `../../catalogs/pyspark-solutions.md`

---

## Header and Cell Contract

Use when authoring or reviewing any `.py` file intended to run as a Databricks notebook.

- Line 1 must be exactly `# Databricks notebook source` — no blank line before or after.
- Delimit every cell with exactly `# COMMAND ----------` — no extra dashes or spaces.
- Treat both as non-negotiable: either violation breaks round-trip sync with the
  Databricks workspace UI.

```python
# Databricks notebook source
# MAGIC %md
# MAGIC ## Notebook: <Title>
# MAGIC
# MAGIC <one-paragraph purpose>

# COMMAND ----------

<one logical step of code per cell>
```

---

## Cell Ordering

Use when structuring a new pipeline notebook or reordering cells during review.

- Order cells: doc (`%md`) -> imports (stdlib -> pyspark -> local modules) ->
  job-parameter cell -> optional `spark.conf.set(...)` -> table and path constants
  -> one-transformation-step-per-cell logic, ending in the write cell.
- Imports come first because parameter parsing needs them; constants follow
  parameters because they may depend on them (environment, run date).
- Set Spark config only for a measured need; see `shuffle-partition-tuning` in
  [pyspark-patterns.md](../../catalogs/pyspark-patterns.md).
- Do not interleave imports or config throughout the notebook.
- Do not put all logic in one mega-cell.

---

## Parameters and Data Access

Canonical owner of Databricks table and file-access rules in this pack.
Use when a notebook reads inputs, writes outputs, or depends on run context;
the [PySpark skill](../pyspark/SKILL.md#core-rules) links here for Databricks access.

- Read job or task parameters once, in the parameter cell, with empty defaults
  and explicit validation; see `dbutils-widgets-parameterized-notebook` in
  [pyspark-patterns.md](../../catalogs/pyspark-patterns.md).
- Address tables by Unity Catalog three-level name (`catalog.schema.table`) and
  files by `/Volumes/<catalog>/<schema>/<volume>/...` or a cloud URI governed by
  an external location.
- Do not use DBFS mounts, `dbfs:/` paths, or `/dbfs/` FUSE paths in new code.
- Import shared logic from workspace `.py` modules; do not chain notebooks with
  `%run` for code reuse.

---

## Living Docstring Steps List

Use when a notebook has more than ~3 transformation steps.

- The opening `%md` cell states the notebook's title, a one-paragraph purpose, and
  a numbered Steps list.
- Update the Steps list whenever a step is added, removed, or reordered — treat it
  as a required review-diff item, not optional prose.
- For business-rule-heavy notebooks, add an `## Algorithm Description` section
  explaining the rule in plain language, independent of the code.

```python
# MAGIC %md
# MAGIC ## Notebook: <Title>
# MAGIC
# MAGIC <what this notebook does, one paragraph>
# MAGIC
# MAGIC **Steps:**
# MAGIC 1. Read <input> from <source>; filter to <condition>.
# MAGIC 2. Join with <other input> on <key>.
```

---

## Fail-Fast Validation

Use after a join, dedup, or override step whose failure mode is "silently
drops or duplicates rows."

- Gate data-quality invariants with `assert <condition>, "<message>"` immediately
  after the risky step.
- Do not use `try/except` to catch-and-continue in an unattended batch job.
- Override note: this deliberately overrides `python-style.instructions.md`'s
  general "no bare `assert` for runtime validation" rule — a scheduled notebook
  with no human watching it run should fail loudly and immediately at the exact
  step where an invariant breaks, rather than produce silently wrong output.
  Do not apply this override to interactive/user-facing code paths.

```python
assert not overrides.isEmpty(), f"No overrides for partition dt={latest_partition}"
assert (
    movement.groupBy("movement_id").count().filter("count > 1").isEmpty()
), "Duplicate movement_id"

From mabrosim/aet-content-pack, MIT.

More from mabrosim/aet-content-pack

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Oct 12, 2026 (16 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from mabrosim

Cite this page

databricks-notebook skill. Agent Mart. https://agentmart.dev/skills/mabrosim-databricks-notebook (last updated 2026-10-24)