Best practices for working on the Harness books repo. Use this skill when editing, restructuring, building, or exporting the books under `book1-claude-code/` and `book2-comparing/`, especially for Honkit, print HTML, Pandoc/XeLaTeX PDF export, build cleanup, TOC issues, naming conventions, and keeping source assets separate from generated outputs.
72
88%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Use this skill for changes inside this repository's book system.
This repo has two books:
book1-claude-code/book2-comparing/Shared build logic lives in:
tools/book-kit/book_meta.pytools/book-kit/build_pandoc_book.pytools/book-kit/build_print_html.pytools/book-kit/export_book_pdf.pytools/book-kit/export_pdf.pyPrefer changing shared behavior in tools/book-kit/ rather than reintroducing per-book one-off scripts.
Treat book release metadata as structured config, not manuscript text.
release_date in book.json.revision automatically from git in shared tooling instead of maintaining a manual version string.README.md, chapter files, or cover artwork.--draft for internal draft exports when you explicitly want today's date plus git revision in the rendered output.assets/ is for source assets only: cover SVG/PDF, hand-maintained source files, reusable static inputs.diagrams/ is for diagram sources and committed generated images used by the books. In this repo, .puml is the source of truth and .png is the embedded artifact.exported/ is for final deliverables only: *.pdf, *-print.html._book/ is a build/cache directory and may be deleted._debug/ and _texdebug/ are disposable debug directories and may be deleted.Do not move exported PDFs into assets/. That mixes source inputs with build outputs and makes cleanup/error analysis harder.
.puml is the source of truth in diagrams/. The committed .png next to it is the artifact embedded in the book. Regenerate .png with python3 tools/book-kit/export_pdf.py <book> --clean-generated (this calls plantuml -tpng); never hand-edit a .png.
These books are about runtime behavior, so default to diagrams that surface behavior, not static structure:
state, [*], <<choice>>) — for lifecycles, "where state lives," and stateful loops (query loop, thread, budget thresholds).start/stop, if/then/else, fork/fork again) — for decision ladders and governance flows (recovery paths, compact rebuild, tool batch ordering).actor, participant, ->) — for temporal interactions between distinct actors (coordinator/worker, user/runtime/worker).If a diagram does not show a loop, a decision branch, a transition, or a temporal exchange, reconsider whether it is earning its page.
When contrasting Claude Code vs Codex on a single dimension:
top to bottom direction and stack the two sides vertically. Do not lay them out side-by-side with left to right direction; that invites parallel component lists and makes the contrast hard to read at book width.state "<b>Claude Code - assemble then loop</b>" as CC { ... } and state "<b>Codex - structure then turn</b>" as CX { ... }.[hidden] edge: CC -[hidden]-> CX.Topic - Behavior Statement, e.g. Query Loop Core - One Iteration Of The While Loop, Recovery Decision Paths - Cheapest Fix First, Tool Batch Ordering - Concurrency Without Context Reordering. Avoid Chapter N · Topic phrasing.Target render dimensions of roughly 700-1500 px on each axis so the diagram fits a printed page without forced scaling.
Standard skinparam baseline (default Harness palette):
skinparam backgroundColor #FEFEFE # transparent for book2 comparisons
skinparam shadowing false
skinparam dpi 120 # 120 for comparison diagrams, 130 for single-book
skinparam defaultFontName Georgia
skinparam defaultFontSize 14
skinparam TitleFontSize 19
skinparam TitleFontColor #161616
skinparam NoteFontSize 12
skinparam ArrowFontSize 12
skinparam ArrowColor #5E5A53Then add only the semantic blocks the diagram actually uses (skinparam state { ... }, skinparam activity { ... }, skinparam sequence { ... }, skinparam note { ... }) using the palette below.
Default Harness palette (book1 and Claude-Code-side of book2):
#F2E9D9, border #1D1D1D, font #161616, arrow #5E5A53, start #8C2721, end #161616#F5EBDD, border #8C2721, font #7B1E1E#E8DDD0 (input / source), #EFE6D8 (runtime / loop), #F5EBDD (decision / warning / error)Codex palette (Codex-side of book2 only, when contrast with the Harness palette is the point):
#F8FAFC, border #334155, font #0F172A, arrow #475569#FFF7ED, border #C2410C, font #7C2D12Do not reintroduce these settings, which were removed from the redesigned diagrams because they fight auto-layout or print badly:
linetype ortho and packageStyle rectangleranksep / nodesep overridesRectangleFontSize, PackageFontSize, etc. (use defaultFontSize plus the semantic blocks above)When changing a .puml:
--clean-generated so the embedded .png matches the source..png: does it fit roughly 700-1500 px on each axis, and does the contrast read at book width?[hidden] separator is keeping them apart.Keep final exports per book under exported/ with stable names:
book1-claude-code/exported/book1-claude-code.pdfbook1-claude-code/exported/book1-claude-code-print.htmlbook2-comparing/exported/book2-comparing.pdfbook2-comparing/exported/book2-comparing-print.htmlIf a new output is added, put it in book.json under outputs.
Do not encode the primary release version only in the output filename. The canonical source of version truth should remain book.json.
All hyperlink colors in the PDF are set to Maroon for a uniform appearance. This is configured via Pandoc -V variables in export_book_pdf.py:
linkcolor=Maroon (internal cross-references)urlcolor=Maroon (external URLs)citecolor=Maroon (citations)filecolor=Maroon (file links)toccolor=Maroon (TOC entries)When adding new link-related Pandoc variables, keep the Maroon convention. Do not leave individual color variables at their Pandoc defaults (Blue, Green, Cyan) as this produces a distracting multi-color link style.
Current PDF export is intentionally:
PandocXeLaTeXctexbookDo not switch PDF generation to Playwright unless the user explicitly asks to change the production path.
Use:
python3 tools/book-kit/export_pdf.py book1-claude-code
python3 tools/book-kit/export_pdf.py book2-comparingAvailable cleanup options:
python3 tools/book-kit/export_pdf.py book1-claude-code --clean
python3 tools/book-kit/export_pdf.py book2-comparing --clean-generatedMeaning:
--clean: remove _book/, _debug/, _texdebug/, and old exported outputs before rebuilding--clean-generated: includes --clean behavior and also regenerates diagrams/*.png from diagrams/*.pumlNever let cleanup delete assets/.
Important: PDF TOC layout is owned by LaTeX, not by Pandoc.
Known repo-specific pitfalls:
parskip path for PDF export in this repo.ctexbook setup, parskip patched \@starttoc and caused TOC entries to disappear around page breaks.\renewcommand{\l@chapter} / \renewcommand{\l@section}, place them inside \AtBeginDocument. In this repo, ctexbook applies delayed hooks that can silently override preamble-time TOC customizations.\setstretch{1.0} with \setlength{\parskip}{0pt} in the TOC \pretocmd group. This specific pair triggers a TeX page-break bug where TOC entries near the first page break silently disappear. \setstretch{1.08} or higher does not trigger it — the issue is specific to exactly 1.0 which creates zero-tolerance vertical spacing. The safe approach is to omit \setstretch entirely in the TOC group and only use \parskip=0pt.\AtBeginDocument, and keep the \tableofcontents pre-hook minimal. In practice, \let\thispagestyle\@gobble\pagestyle{empty} has been more stable than adding extra TOC line-spacing tweaks.\setstretch{1.08} as a universal TOC fix. It fixed one page break in book2-comparing, but regressed later chapter breaks in both books by causing subsequent chapter titles to disappear even though the entries were present in .toc.tools/book-kit/export_book_pdf.py, \tocchapterneedspace measures \pagegoal - \pagetotal and forces a page break when the remaining height is too small. This prevents chapter headings from landing at the bottom of a TOC page and avoids losing the following section entries around the break.book1 could still lose 3.4 even after chapter-level protection was added..toc but still disappear from the rendered PDF near a page break. Treat this as a LaTeX pagination problem, not a Pandoc generation problem.第 4 章 in one book can still regress 第 5 章 or a mid-chapter section block in the other book.pdftotext -f 3 -l 6 -layout ... or an equivalent page-scoped extraction to inspect only the TOC pages. Whole-document text extraction can hide TOC regressions because the same heading still exists later in body text.book1-claude-code: 第 3 章 section block around 3.3 to 3.7book1-claude-code: 第 4 章 to 第 5 章book2-comparing: 第 3 章 to 第 4 章book2-comparing: 第 4 章 to 第 5 章.toc file. If the missing headings are present there, debug LaTeX pagination and TOC macros rather than markdown generation.tools/book-kit/export_book_pdf.py over per-book hacks.When debugging TOC issues:
pdftotext..aux/.toc generation.If TOC entries disappear near page breaks, inspect tools/book-kit/export_book_pdf.py first.
book1-claude-code/ or book2-comparing/ unless the chapter is explicitly about repo structure.Harness consistently as the preferred term.references/ in this skill, not inside book1-claude-code/ or book2-comparing/.references/ for background material that helps future editing decisions but should not be treated as buildable manuscript content.references/harness-engineering-book-proposal.md (book1 proposal)references/comparative-book-proposal.md (book2 proposal)tools/book-kit/ for behavior changes.book.json for per-book output naming.book.json for per-book release metadata such as release_date.SUMMARY.md aligned with the actual reading structure when the book uses Honkit navigation.After substantial book or pipeline changes, run enough of this checklist to cover the touched area:
*-print.htmlexported/.md links leak into the merged PDF text.puml is the source, use --clean-generated, then run the diagram validation steps in the Diagrams (PUML) sectionassets/ for source and exported/ for output.fbf2b43
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.