Book chapter.update from source

From gpsaggese/helpers · View interactive version

Book chapter.update from source is an AI agent skill from the GitHub repository gpsaggese/helpers. Update a book's content to match changes in its source file

How to use this skill

Skill file

Goal

<SOURCE>, find the changes in <SOURCE> and incorporate them into <TARGET>

Workflow

Read the Version Header

generate the current <TARGET>

```text

% git_hash=<GIT_HASH>, timestamp=<TIMESTAMP>

% <SOURCE>

```

```text

% git_hash=f15bc6b9, timestamp=2026-07-15 14:41:12 EDT

% book_springer/lectures_source/Lesson02.1_From_Data_Science_To_Decision_Science.txt

```

```bash

> git diff <GIT_HASH> -- <SOURCE>

```

Incorporate Changes

headings, diagrams, or paragraphs that group or expand several flat .smd slides

(see "Structural Hierarchy" in typst.rules.md)

<TARGET> content, since it has no direct counterpart anymore

retracted, not merely reorganized out of the slide deck

```text

// git_hash=<NEW_GIT_HASH> timestamp=<NEW_TIMESTAMP>

```

Compare Entire Flow

```bash

> extract_toc_from_txt.py -i msml610/lectures_source/Lesson03.3-Non_classical_logics.smd

> extract_toc_from_txt.py -i msml610/book/Lesson03.3-Non_classical_logics.typ

```

Update Source-Line References

each section, pointing to the exact <SOURCE> line it was generated from

changes, walk the // From: comments top to bottom and fix each <LINE> so it

matches the slide's current position in <SOURCE>

Update Rendered Images

nodes, or a static image swapped for a rendered diagram, or vice versa), carry the

same change into the matching rendered_images:begin/rendered_images:end

placeholder in <TARGET> (see "Diagram Placeholders and wrap-content" in

typst.rules.md)

or the #figure(image(...)) calls by hand for content that already renders

correctly. render_images.py regenerates both on the next render

editing the placeholders, grep <TARGET> for \.typ\.figs/.*\.[0-9]+\.png and

renumber every #figure(image(...)) call, and its matching label=/caption=

line, sequentially from 1 in document order

what a diagram depicts, update the figure's caption=/caption: per "Figures:

Required Elements" in typst.rules.md (sentence case, one plain line, no

node-by-node listing)

Verification

<TARGET>

(typst.rules.md, latex.rules.md, or markdown.rules.md)

render_book_chapter.py and re-rendering of sibling .typ files under a

running gen_slides.py --daemon: stub the unrendered figure PNGs, then compile

```bash

> typst compile --root . <TARGET> /tmp/check.pdf

```

<TARGET>, to catch side effects on sibling chapters

in <SOURCE>

order, with no gaps or duplicates

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.