docs/topics/ — agent guide
Topic pages are deep dives on a single concept that spans multiple
chapters. Each page should make sense in isolation; do not chain
prerequisites across topic pages.
File contract
A topic page must include, in order:
- H1 title matching the filename (no chapter number).
- Framing paragraph — what the concept is and why it matters.
- In this codebase — bullet list of which classes / functions
realize the concept, with paths.
- End-to-end snippet — minimal runnable code demonstrating the
concept (≤ 25 lines).
- Pitfalls — actual numerical / API surprises, not theory.
- See also — relative links to chapter, statistics, and reference
pages.
When to add a topic page
Only when the topic genuinely cannot be covered cleanly inside a single
chapter or reference page. If the topic is just one statistical tool,
prefer a statistics/ page. If the topic is just one subpackage,
prefer extending the reference/ page.
Avoid
- Reproducing book passages — write summaries in our own prose.
- Long mathematical derivations — link to the book or a textbook.
- Code snippets > 25 lines — extract them into an orchestrator under
chapters/chapter_<N>/ instead and link to it.