一键导入
phys130b-notebook
Safe read/write and validation for PHYS130B Jupyter notebooks under notes_src. Use when editing, fixing, or restructuring any .ipynb.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Safe read/write and validation for PHYS130B Jupyter notebooks under notes_src. Use when editing, fixing, or restructuring any .ipynb.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Derivation QC for PHYS130B—every derivation touch follows rules/derivation-quality.md (read _refs first, outline chain, full steps, structural diff vs professor notes). Aligns with _refs/; proposes scoped fixes only; notebook-writer implements.
Design and audit lecture narrative, pedagogy, structure, prompts, homework, projects, and discussion boxes for PHYS130B—align with rules without implementing .ipynb edits. Pair with notebook-writer for implementation.
Ch4–6 phased notebook maintenance (validate → notation → style → derivation quality). Use when progress.md phase cursor, auditing the next notebook in the round, or user says maintenance phases / phase A–D.
Design and audit Prompts boxes (cell 1) for PHYS130B notebooks—specify LLM-preview questions; implementation via notebook-writer only. Triggers on prompt review, stale prompts after lecture edits, new notebook prompts, or cell 1 quality issues.
Design and audit `### Summary` and `See Also` blocks in PHYS130B—templates, bullets, cross-links; specify changes for notebook-writer. Use when auditing summaries or See Also consistency.
Design and audit homework problems for PHYS130B—quality, formatting specs, AI-era pedagogy; implementation via notebook-writer. Use for new problems, homework review, or formatting fix specs.
| name | phys130b-notebook |
| description | Safe read/write and validation for PHYS130B Jupyter notebooks under notes_src. Use when editing, fixing, or restructuring any .ipynb. |
Sole .ipynb implementation layer. Apply patches from feedback.md, progress.md, or any \*-designer skill (proposed markdown + cell index / scope). All *-designer skills only audit, review, plan, and propose—they never run validator commands on notebooks. Normative tables live in rules/—this skill does not restate them; it implements specs that already cite those rules. When a designer cites TEMPLATES.md, treat that as the format shell to paste unless it conflicts with rules/ (rules win).
After every .ipynb save (including implementing a designer proposal, ad hoc fixes, or bulk scripts): run validators per rules/validation.md in the same session before claiming the edit is done. No designer skill shares this responsibility.
Programmatic editing of .ipynb only—never NotebookEdit or Edit/Write on notebooks in Cowork.
feedback.md (professor, if any open items) then .claude/README.md / progress.md.notes_src/**/*.ipynb (content, structure, or metadata).feedback.md / progress.md that require JSON cell edits.Scripts under skills/summary-designer/scripts/ and skills/homework-designer/scripts/ (see each skill’s SKILL.md + scripts/README.md) mutate .ipynb files—run them only here, with the same Bash + Python + text_to_source discipline as manual edits.
derivation-designer, lecture-designer, or other *-designer skills when content is non-trivial../build.sh or jupyter-book build (rules/validation.md).rules/troubleshooting-ipynb.md, re-validate, then continue.NotebookEdit on .ipynb.Edit/Write on .ipynb in Cowork—use Bash + json.load / json.dump.json.dump(nb, f, indent=1, ensure_ascii=False) always, then write a single trailing newline at EOF.text_to_source for markdown strings—canonical implementation: skills/notebook-writer/scripts/safe_edit.py (same logic as rules/notebook-editing.md). The last line must not carry a trailing \n or the editor flags the file as modified on open (see rules/notebook-editing.md § Canonical on-disk form).save_notebook() from safe_edit.py, which auto-normalizes (no trailing source newline, cell ids present, nbformat_minor >= 5). After bulk/manual JSON surgery, run python3 .claude/scripts/normalize_notebooks.py.import json
def text_to_source(text):
text = text.rstrip('\n') # last line must not carry a trailing newline
if not text:
return []
lines = text.split('\n')
return [line + '\n' for line in lines[:-1]] + [lines[-1]]
with open(path) as f:
nb = json.load(f)
# inspect len(nb['cells']), then:
nb['cells'][CELL_INDEX]['source'] = text_to_source(new_content)
with open(path, 'w') as f:
json.dump(nb, f, indent=1, ensure_ascii=False)
f.write('\n')
Who runs validators: only this skill (or the same agent explicitly acting as notebook-writer after an edit). *-designer skills do not invoke safe_edit.py validate or validate_project.py.
Commands and scopes: only rules/validation.md (do not duplicate command tables here). Typical pattern: safe_edit.py validate on each file touched, then scoped validate_project.py when appropriate.
Report results in a small table if many files: | Notebook | Corruption | Structure | Other |.
json.load the notebook; locate cell/line from the report.\n / collapsed line / content violation of rules/ (architecture, MyST, style).json.dump; validate; update progress.md or annotate feedback.md when resolved.*-designer skills in .claude/skills/ (this skill implements those specs).CLAUDE.md, .claude/README.md, rules/notebook-editing.md, rules/tooling-security.md, rules/validation.md, rules/troubleshooting-ipynb.md_refs/ (project root): Professor's original lecture notes. Read the corresponding _refs/ file before writing or rewriting any derivation or physics content. See CLAUDE.md § "Reference materials" for the chapter-to-file mapping.