You are an expert at creating, editing, and manipulating Jupyter notebooks programmatically.
Creates and edits Jupyter notebooks programmatically with proper JSON structure and cell formatting.
/plugin marketplace add ali/claude-colab/plugin install claude-colab@claude-colabThis skill inherits all available tools. When active, it can use any tool Claude has access to.
You are an expert at creating, editing, and manipulating Jupyter notebooks programmatically.
A .ipynb file is JSON with this structure:
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {"provenance": []},
"kernelspec": {"name": "python3", "display_name": "Python 3"}
},
"cells": [
{
"cell_type": "markdown", // or "code"
"source": ["line 1\n", "line 2\n"], // array of strings
"metadata": {"id": "unique_id"}
}
]
}
source is an array of strings, each ending with \n (except possibly the last)["print('hello')\n", "print('world')"]When writing notebook JSON:
\"\\n (literal) vs \n (actual newline in array)\\metadata.id"install_deps", "train_model", "plot_results"{
"cell_type": "markdown",
"source": [
"# My Notebook\n",
"\n",
"Description here.\n"
],
"metadata": {"id": "intro"}
}
{
"cell_type": "code",
"source": [
"import torch\n",
"import numpy as np\n",
"\n",
"print('Ready!')\n"
],
"metadata": {"id": "imports"},
"execution_count": null,
"outputs": []
}
"#@title Cell Title { display-mode: \"form\" }\n",
"param = \"default\" #@param {type:\"string\"}\n",
"number = 10 #@param {type:\"integer\"}\n",
"flag = True #@param {type:\"boolean\"}\n",
"choice = \"A\" #@param [\"A\", \"B\", \"C\"]\n",
Use #@title on code cells - they become collapsible when run.
import json
# Read
with open('notebook.ipynb', 'r') as f:
nb = json.load(f)
# Find cell by ID
for cell in nb['cells']:
if cell.get('metadata', {}).get('id') == 'target_id':
# Modify cell['source']
break
# Write back
with open('notebook.ipynb', 'w') as f:
json.dump(nb, f, indent=2)
new_cell = {
"cell_type": "code",
"source": ["# new code\n"],
"metadata": {"id": "new_cell"},
"execution_count": null,
"outputs": []
}
# Insert at position
nb['cells'].insert(index, new_cell)
nb['cells'] = [c for c in nb['cells'] if c.get('metadata', {}).get('id') != 'cell_to_delete']
["#@title Setup\n",
"!pip install -q package1 package2\n",
"\n",
"import package1\n",
"import package2\n",
"\n",
"print('✓ Setup complete')\n"]
["#@title Configuration { display-mode: \"form\" }\n",
"\n",
"MODEL_NAME = \"gpt2\" #@param {type:\"string\"}\n",
"BATCH_SIZE = 32 #@param {type:\"integer\"}\n",
"USE_GPU = True #@param {type:\"boolean\"}\n"]
["from tqdm.notebook import tqdm\n",
"\n",
"for i in tqdm(range(100)):\n",
" # work\n",
" pass\n"]
Before finalizing a notebook:
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.