OpenParable
Skip to content
← Back to skills

Notebook Metadata

Documents
notebook-metadata

Notebook Metadata is an Agent Skill for documents published in the albumentations-team/albumentations_examples repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Ensures Jupyter notebooks have required metadata and nbformat. Use when adding, creating, or modifying .ipynb files, or when the user asks about notebook structure or validation.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/albumentations-team/albumentations_examples/blob/HEAD/.cursor/skills/notebook-metadata/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/notebook-metadata, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Notebook Metadata and nbformat

When to Apply

  • Adding or creating new Jupyter notebooks
  • Modifying notebook structure
  • User asks about notebook validation or metadata

Required Structure

Every .ipynb file must have these top-level keys:

KeyTypeNotes
metadataobjectCan be empty {} but must exist
nbformatintMust be 4 or 5
nbformat_minorintMinor version
cellslistArray of cell objects

Minimal Valid Notebook

{
  "cells": [],
  "metadata": {},
  "nbformat": 4,
  "nbformat_minor": 4
}

Validation

Run the project script:

python scripts/check_notebook_metadata.py [path]

Omit path to check current directory recursively. Pre-commit runs this automatically on staged .ipynb files.

Fixing Invalid Notebooks

If a notebook is missing fields, add them at the root level:

import json
with open("notebook.ipynb") as f:
    nb = json.load(f)
nb.setdefault("metadata", {})
nb.setdefault("nbformat", 4)
nb.setdefault("nbformat_minor", 4)
nb.setdefault("cells", [])
with open("notebook.ipynb", "w") as f:
    json.dump(nb, f, indent=1)