ingest-course-repo
Render a course repo's .ipynb files and helper module(s) into
materials/notebooks/from-repo/<course>-context.md.
This is an extra, not a shortcut. The main way materials arrive is still a
manual download from https://course-context-lab.vercel.app — both the notebooks
.md and the transcripts. What this skill adds on top is the course's real,
runnable code and its helper.py definitions, which the site dump doesn't
carry. Transcripts are never produced here.
Steps
Verify cwd is a course folder. Confirm all of these exist relative to cwd:
materials/notebooks/,materials/transcripts/,builds/,evals/. If any are missing, refuse with: "Run /ingest-course-repo from inside a course folder —cd courses/<name>first." Stop.Require the repo URL. If
$ARGUMENTSis empty, say: "Which course repo? If it's a DeepLearning.AI course, find it at https://github.com/deeplearningai-eng/courses and paste the URL of the course's folder — e.g..../courses/tree/main/course_10." Stop until they answer.Parse the URL. Strip any
?queryor#fragmentfirst, then:Input Becomes https://github.com/<org>/<repo>/tree/<ref>/<path…>repo https://github.com/<org>/<repo>,--ref <ref>,--subdir <path…>https://github.com/<org>/<repo>repo as given, no --subdirgit@…:…,ssh://…, local path,file://…repo as given, no --subdirStrip only the
/tree/<ref>/<path…>tail; don't add or remove a.gitsuffix. The repo string lands in the generated file's provenance line, so it should read back as what the user actually pasted.A
/blob/URL points at a file — ask for the folder URL instead. Splittingtree/<ref>/<path>assumes the ref is a single segment; if the branch name contains a/, that guess is wrong, so let the user correct it and pass--ref/--subdirexplicitly.Refuse the courses index. If the input resolves to
deeplearningai-eng/courseswith no subdirectory, refuse with: "That's the courses index — 262 courses, 3.4 GB. Browse to your course and paste its folder URL, e.g..../courses/tree/main/course_10." Stop. Any other repo root is fine and proceeds without--subdir.Run the ingest script from the course folder:
python3 "$CLAUDE_PROJECT_DIR/.claude/skills/ingest-course-repo/scripts/ingest_repo.py" \ <repo> --out "materials/notebooks/from-repo/<course>-context.md" \ [--ref <ref>] [--subdir <path>]Use the course-folder name (cwd basename) for
<course>. With--subdirthe clone is sparse and blobless, so only that course's files are fetched. Other flags, rarely needed:--title(document H1),--helper-name(defaulthelper.py),--keep-clone(debugging). If the script exits non-zero — clone/auth failure, a subdir that doesn't exist, nothing to ingest, or a bad--out— surface its error verbatim and Stop.Report. Echo the script's one-line summary (notebooks, cells, helper files, unique defs, conflicts). Then
Glob materials/notebooks/*.md: if a hand-downloaded*-context.mdsits at the top level, add a note that both are now read by/generate-spec— the site dump is authoritative for lesson numbering and titles, this file carries the real code andhelper.py. State it and move on; don't ask the user to choose.Hand off. Remind them the site download is still the main source: if
materials/transcripts/is empty, transcripts must come from https://course-context-lab.vercel.app. Once materials are in place, run/generate-spec.
Don't
- Don't write
spec.md— that's/generate-spec. - Don't write anywhere under
materials/exceptmaterials/notebooks/from-repo/, and never intomaterials/transcripts/. The script enforces this too, but don't rely on it. - Don't overwrite or edit a hand-downloaded
*-context.md. Thefrom-repo/subfolder exists precisely because the two share a filename. - Don't WebFetch course content, or the courses index — the user browses it and pastes a URL. The agent only clones the repo it was handed.
- Don't clone a monorepo root hoping to filter afterwards. Scope it with
--subdirso the fetch stays small. - Don't run from the repo root or from inside a build folder. Materials are
off-limits during a build, and a
PreToolUsehook enforces that.