tutorial-gen — a LangGraph supervisor-subagent pipeline that generates tutorials from Claude Code's CHANGELOG.
# Run tests
PYTHONPATH=src .venv/bin/python -m pytest tests/ -v
# Install for development
pip install -e ".[dev]"
# CLI
tutgen run [--dry-run] [--limit N]
tutgen status
tutgen list- Pattern: Supervisor-subagent with feature loop (LangGraph StateGraph)
- State:
PipelineStateTypedDict insrc/tutorial_gen/state.py— usesAnnotatedreducers formessages,processed_features,errors - Graph: Built in
src/tutorial_gen/graph.pyviabuild_graph()— supportsskip_fetch=Truefor CLI--limitmode - Agents: In
src/tutorial_gen/agents/— each is an async function returning a state dict - Nodes: In
src/tutorial_gen/nodes/— fetch, diff, save (non-LLM) - DB: SQLite via
src/tutorial_gen/db.py— tracks processed features
- All agent/node functions take
PipelineStateand returndictwith state updates - LLM agents use
langchain-anthropic(ChatAnthropic) — mock withpatch("...ChatAnthropic")in tests - Shared utilities go in
src/tutorial_gen/agents/__init__.py(e.g.extract_script) - Prompt templates live in
src/tutorial_gen/prompts/— one file per agent - Tests use
pytest-asynciowithasyncio_mode = "auto" - The validator uses an allowlist-based env (PATH, HOME, USER, SHELL, TERM, LANG only) — sensitive keys like
ANTHROPIC_API_KEYare never passed to generated scripts
Prompts enforce realistic Claude Code usage in generated tutorials and demo scripts:
- Session chaining is the primary pattern —
--output-format jsonto capturesession_id, then--resumefor follow-ups - Slash commands (
/simplify,/batch,/cost) are interactive — prompts require they be shown inside sessions via--resume, never as standalone CLI args claude -pone-shots are reserved for simple standalone demos only- No fake output — scripts must not use
echoto simulate Claude responses
src/tutorial_gen/state.py— State schema (modify here when adding new state fields, always add reducer annotations for list fields)src/tutorial_gen/graph.py— Graph assembly (add new nodes/edges here)src/tutorial_gen/cli.py— CLI entry pointpyproject.toml— Dependencies and project config