| name | write-book |
| description | Use when writing actual CONJI book prose (the Romanian HTML chapter files in public/book-contents/) from an approved plot in plots/*.md. Writes one chapter/page at a time by default — never the whole book in one pass unless the user explicitly asks for all chapters at once. Use the book-plot skill first if no plot exists yet. |
Write Book — Chapter by Chapter
This skill turns a plot (plots/<slug>.md, produced by the book-plot
skill) into actual book content: the Romanian HTML files readers see in the
app. It never invents plot — if there's no plot doc yet, or the plot needs
changes, use the book-plot skill first.
Note on granularity: in CONJI a "chapter" and a "page" are the same
unit — one N.html file, tracked by content_length in books.json and
served by loadBookPage. So "page by page" and "chapter by chapter" mean
the same thing here: one file per invocation.
Default Behavior: One Chapter at a Time
By default, write exactly one chapter/page per invocation, then stop and
report what was written. Do not write the rest of the book automatically,
even if the plot has many chapters left.
Only write multiple chapters in one pass if the user explicitly says so
(e.g. "write all remaining chapters", "write the whole book now"). If asked
to do that, still write chapters in order, one at a time internally, and
keep every chapter internally consistent with the ones before it.
Workflow
-
Find the plot. Read plots/<slug>.md for the book. If it doesn't
exist, stop and use the book-plot skill first — do not improvise a
plot from scratch here.
-
Find the next chapter to write.
- If the book is new (
book_id: TBD, chapters_written: 0), this is
Chapter 1.
- Otherwise, check both the plot's
chapters_written and the actual
files in public/book-contents/<book_id>/ (they must agree) — the
next chapter number is one past the highest existing N.html.
- Pull that chapter's entry from the plot's "Detailed Chapter
Breakdown" (setting, beats, characters, how it ends). If the plot
doesn't cover that chapter yet, stop and ask the user to extend the
plot first (via
book-plot) rather than inventing beats.
-
Match level and tone.
- Use the plot's
level field (A1/A2, A2/B1, B1+) to calibrate sentence
length and vocabulary — beginner chapters read like
povestea-naturii-drumul-lui-andrei.md's chapters (short sentences,
concrete everyday vocabulary); more advanced chapters read like
trenul-care-nu-opreste.md's (longer, more atmospheric).
- When targeting a beginner level, prefer vocabulary already present in
public/words.json and the group-N.json verb files so the chapter
stays readable for learners at that stage; it's fine to introduce a
few new words naturally, but don't reach for obscure vocabulary.
- Match the existing book's established tone, characters' voices, and
any recurring phrasing patterns from its earlier chapters.
-
Write the chapter as HTML, following the exact structure used by
existing chapters:
<div class="book-chapter">
<h2>CAPITOLUL N - <Chapter Title></h2>
<p>
Narrative paragraph...
</p>
<div class="dialog">
<p><span class="speaker">Name:</span> Line of dialogue.</p>
<p><span class="speaker">Other:</span> Reply.</p>
</div>
<p>More narrative...</p>
</div>
- Expand the plot's beats into full prose and dialogue — never copy
the plot's bullet points verbatim into the book.
- Use
<div class="dialog"> blocks for spoken exchanges, plain <p>
for narration, exactly like existing chapters in
public/book-contents/.
- End the chapter the way the plot's "Ends on" note for that chapter
describes.
-
Save the file at public/book-contents/<book_id>/<N>.html. If this
is a brand-new book with no book_id yet, generate a UUID, create the
folder, and update the plot doc's book_id field.
-
Update bookkeeping after writing the chapter:
public/books.json: set/create the book's content_length to match
the new highest chapter number (create the entry with id, title,
description, content_length if this is chapter 1 of a new book).
plots/<slug>.md: bump chapters_written and update status
(planned → ongoing on chapter 1; ongoing → complete once the
final planned chapter is written).
- Do not touch
public/*.min.json files — those are generated by
minify-json.js, not hand-edited.
-
Report back which chapter was written and what naturally comes
next, but stop there — wait for the user before writing further
chapters.
Checking Vocabulary Coverage
To see which words in a book aren't yet covered by words.json or the verb
group files, use the repo's find-missing-words.js (run from the repo
root):
node find-missing-words.js
node find-missing-words.js <book-id>
It writes results to missing.json (gitignored, not committed). Note that
Romanian's inflected forms (definite articles, plurals, cases) mean many
"missing" entries are just different forms of words already covered —
review the list rather than adding everything verbatim.