fqih/.mycc-setup/notebook-hygiene

Claude Code and agent skill by fqih/.mycc-setup

Trust tier 2
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Use when working with Jupyter notebooks (.ipynb) — strip output before commit, pin kernels, ensure reproducibility, prevent JSON bloat in git, and integrate with mlflow experiments. Trigger on "notebook", ".ipynb", "jupyter", "strip output", "kernel".

Install

npx vskill@latest install fqih/.mycc-setup/notebook-hygiene

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as fqih/.mycc-setup/notebook-hygiene.

notebook-hygiene

Jupyter workflow yang bersih: notebook kecil di git, reproducible, siap production.

Output stripping (WAJIB sebelum commit)

Notebook dengan output = JSON bloat (ratusan KB per cell untuk plot). Solusi: nbstripout.

Setup satu kali per repo
bash
# install hook di repo target
nbstripout --install
# cek status
cat .git/hooks/pre-commit | grep -q nbstripout && echo "hook aktif"

Hook pre-commit otomatis strip semua cell output dari .ipynb yang di-stage. Wajib setup sebelum commit notebook pertama.

Manual strip (untuk file yang sudah terlanjur di-commit)
bash
# strip output dari 1 file
nbstripout path/to/notebook.ipynb
# bulk strip semua notebook yang sudah ter-track
git ls-files '*.ipynb' | xargs -I{} nbstripout {}
git add '*.ipynb'
git commit -m "chore: strip notebook output"
Verifikasi
bash
# notebook harusnya kecil setelah strip
git diff --stat | grep ipynb
# idealnya: 0 changed lines untuk output

Kernel pinning

Setiap notebook wajib declare kernel di metadata agar reproducibility terjaga.

bash
# install kernel pinned ke env tertentu
python3 -m ipykernel install --user --name=myproject-py312 --display-name "Python 3.12 (myproject)"
# di notebook, pilih kernel ini via JupyterLab UI atau:
jupyter nbconvert --to notebook --execute \
--ExecutePreprocessor.kernel_name=myproject-py312 \
notebook.ipynb

Cek kernel di notebook:

python
# cell pertama wajib: print kernel info
import sys, ipykernel
print(f"Python: {sys.version}")
print(f"Kernel: {ipykernel.__version__}")
print(f"Executable: {sys.executable}")

Reproducibility rules (di setiap notebook)

  1. Random seed — wajib di awal eksperimen:

``python import numpy as np import random RANDOM_SEED = 42 np.random.seed(RANDOM_SEED) random.seed(RANDOM_SEED) # untuk torch: torch.manual_seed(RANDOM_SEED); torch.cuda.manual_seed_all(RANDOM_SEED) ``

  1. Environment lock — requirements.txt atau uv.lock / poetry.lock. Commit lock file, bukan hanya constraints.
  1. Data versioning — kalau pakai dataset besar, hash + catat di cell pertama:

``python DATASET_HASH = "sha256:abc123..." # dari sha256sum data.csv ``

  1. No hardcoded paths — pakai pathlib.Path relatif terhadap repo root, atau env var.

Struktur notebook yang baik

# Header cell (markdown)
- Title
- Author (Fqih)
- Date
- Purpose
- Random seed
# Setup cell (code)
- imports
- seed
- config constants
# Data loading cell(s)
- reproducible loader
- hash check
# Analysis cells
- 1 cell = 1 logical step
- nama variabel deskriptif
# Conclusion cell (markdown)
- findings
- next steps

MCP integration (jupyter-mcp-server)

Kalau MCP jupyter aktif, pakai untuk eksekusi cell-by-cell:

  1. Start jupyter lab lokal:

``bash jupyter lab --port 8888 --IdentityProvider.token=claude-code-mcp --ip 127.0.0.1 ``

  1. CC punya akses ke tool MCP untuk: execute_cell, read_cell, insert_cell, restart_notebook, list_kernels, multimodal output (plot/gambar inline).
  1. Selalu restart kernel sebelum eksekusi panjang untuk pastikan state bersih:
  • restart_notebook → execute_cell cell by cell → cek output di setiap step.
  1. JANGAN commit notebook dengan cell output besar (gambar base64, DataFrame preview panjang). Strip dulu.

Pre-commit checklist untuk notebook

Sebelum git commit:

  • [ ] nbstripout output sudah jalan (cek git diff --stat)
  • [ ] Kernel declared dan reproducible
  • [ ] Random seed di cell pertama
  • [ ] Tidak ada path absolut (/home/fqih/...)
  • [ ] Tidak ada API key/secret hardcoded
  • [ ] requirements.txt updated

Common pitfalls

PitfallSolusi
Notebook 5MB+ di gitnbstripout retroactive + .gitattributes filter
Kernel "dead" setelah pindah envpython3 -m ipykernel install --user --name=... ulang
Output beda tiap run (no seed)Tambah np.random.seed, random.seed, torch seed
Plot hilang di GitHub previewPakai %matplotlib inline (default), simpan figure ke file jika perlu
Cell error lalu stuck stateRestart kernel + run all dari awal

Invokation

Auto-trigger saat:

  • Edit/tulis file .ipynb
  • User bilang "notebook", "jupyter", "strip output"
  • Pre-commit hook jalan dan ada .ipynb di staged

Manual trigger: /notebook-strip atau panggil skill ini langsung.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/fqih/.mycc-setup/notebook-hygiene/badge)](https://verified-skill.com/skills/fqih/.mycc-setup/notebook-hygiene)

Something wrong with this skill or its page? Tell us.