Install
openclaw skills install make-textbookResearch a subject via web search and produce a comprehensive, graduate-level university textbook as a professionally formatted PDF with table of contents, citations, worked examples, misconceptions, data tables, glossary, and references. Trigger phrases: "make a textbook", "write a textbook", "generate a textbook", "create a university textbook", "build a textbook", "write a comprehensive textbook", "graduate-level textbook", "academic textbook", "comprehensive learning material".
openclaw skills install make-textbookBuild a comprehensive graduate-level university textbook on any subject, complete with chapter outlines, worked examples, misconceptions, data tables, citations, glossary, and an index. Output: a professionally formatted PDF (~40-100 KB per book).
Invoke when the user asks to "make a textbook," "write a textbook," "create a comprehensive learning resource" on any topic — from quantum mechanics to local AI agent infrastructure.
SUBJECT → OUTLINE → CHAPTER RESEARCH → CONTENT DRAFTING → QA → PDF GENERATION → DELIVER
Part I / Section heading
Chapter 1. [Title] — 1-2 sentence description
Chapter 2. [Title] — ...
Search strategy: Use batch_web_search for 8-10 concurrent searches per chapter.
Combine broad searches with specific sub-topic queries.
Each chapter follows this structure:
CHAPTER N. [Title]
├─ N.0 Introduction (overview, prerequisites)
├─ N.1 [Core concept] — definitions, explanation, worked examples
├─ N.2 [Next concept] — ...
├─ ⚠ Common Misconceptions (callout box)
├─ N.3 Data Table (comparison or structured data)
└─ References (IEEE numbered)
Every chapter must include:
After drafting all chapters:
The PDF generator is at scripts/textbook_generator.py. It reads the JSON content
file and produces a professional academic PDF with:
Run it:
python3 scripts/textbook_generator.py textbook_content.json output/book.pdf
The textbook_content.json file must conform to this schema:
{
"title": "Topic Title",
"subtitle": "Optional Subtitle",
"date": "May 2026",
"preface": "How to use this book...",
"chapters": [
{
"number": 1,
"title": "Chapter Title",
"intro": "Chapter banner subtitle (optional)",
"sections": [
{"type": "heading", "level": 1, "content": "Major Heading"},
{"type": "heading", "level": 2, "content": "Sub-heading"},
{"type": "text", "content": "Body text with **bold**, *italic*, `code` markup."},
{"type": "example", "title": "Example 1.1", "problem": "...", "solution": "..."},
{"type": "misconception", "title": "Misconception: ...", "explanation": "..."},
{"type": "table", "header": true, "data": [["Col1","Col2"],["A","B"]]},
{"type": "divider", "content": ""}
],
"summary": "- Key takeaway 1\n- Key takeaway 2"
}
],
"glossary": [
{"term": "Term", "definition": "Definition sentence."}
],
"full_references": [
"[1] A. Author, Title, Source, Year."
]
}
| type | Fields | Notes |
|---|---|---|
heading | level (1/2/3), content | Level 1 adds a gold rule above |
text | content | Body text with markup |
example | title, problem, solution | Blue callout box |
misconception | title, explanation | Orange callout box |
table | data (array of arrays), header (bool, default: true) | Ragged rows auto-padded |
divider | none | Full-width gold rule |
text content| Syntax | Result |
|---|---|
**text** | Bold |
*text* | Italic |
__text__ | Underline |
`code` | Courier / monospace |
~~text~~ | Strikethrough |
The generator is resilient to malformed input:
data in a table section → table skipped silently, no crashtextbook_generator.py is pure Python 3, no external API callscanvas.showPage() on page 1 to advance to page 2 for TOCmake_example, make_table, etc.) return a list of
flowables; empty list means "skip gracefully" — never raise from a renderertextbook_generator.py for detailed per-function docs