Skip to content

About

AI agent skill that turns textbook chapter PDFs into colour-coded study notes (Insights, Solutions, Practice) with vector maps as PDF and DOCX.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Chapter Notes Builder

Turn any textbook chapter PDF into uniform, print-ready, colour-coded revision notes — with Chapter Insights, Textbook Solutions, Practice Questions, and vector-preserved maps & diagrams — delivered as a PDF and/or an editable DOCX (you choose).

Download SKILL.md
Opens SKILL.md directly so you can download just the skill file (no need to download Marketing/) · Raw SKILL.md

Chapter Notes Builder — 60s Promotional Trailer Preview
Watch the full 1080p 60 fps trailer with sound

chapter-notes-builder is an AI agent skill (SKILL.md) paired with a lightweight Node.js (docx) + Python (Pillow/NumPy) + Poppler + LibreOffice build pipeline. Every chapter across every subject follows the exact same layout, typography, and colour system so a student's study binder looks cohesive from Chapter 1 to the final unit.


Why Chapter Notes Builder?

  • Consistent Three-Part Architecture — Blue Chapter Insights (always included), green Solutions (optional), and red Practice Questions (optional), with automatic A/B/C re-lettering that preserves content-type colours.
  • 5-Question Fast Intake — Asks an opt-out question first, then configures solutions, practice question source, figure extraction, and output file format in a single message.
  • Strict Textbook Grounding — Traces every definition, date, figure, and solution back to the source chapter; matches the book's own spelling (e.g. British/Indian English) and never invents personal metadata or local survey statistics.
  • Vector-Preserving Figure Cropping — Renders PDF pages via pdftoppm and crops diagrams/maps via crop_figures.py instead of pdfimages, keeping vector map labels, compass roses, scale bars, and legends intact.
  • Flexible Delivery + Zero-Dependency Fallbacks — Outputs {Chapter_Title}_Notes.pdf, editable {Chapter_Title}_Notes.docx, or both (defaulting to PDF only to save time and token budget), or degrades cleanly to a self-contained print-to-PDF HTML file or structured Markdown when code execution is unavailable.

Visual Showcase

All screenshots below are 180-DPI renders of real PDFs generated by the skill from Class VIII Social Science textbook chapters.

1. Section A — Chapter Insights & Structured Callouts

Chapter Opener, Tables & Key Terms Callout Families & Case Study Boxes Tables & Fact Boxes
Section A Chapter Insights Section A Callouts and Case Study Section A Table and Fact Box
World Geography (p. 1): Three-cell header strip, CH1 title, blue banner, The Big Questions, two zebra tables, and KEY TERMS. Factors of Production (p. 3): Blue KEY TERM boxes, red CASE STUDY (J.R.D. Tata), yellow DON'T MISS OUT / DID YOU KNOW?, and green mini-heading. The Rise of the Marathas (p. 4): 8-minister ashta pradhana mandala table with diacritics preserved alongside a yellow DID YOU KNOW? box.

2. Extracted Maps & Diagrams (Vector Labels Preserved)

Map Projections Comparison Satellite Route Map (Suez Canal) Physical Map with Vector Labels
Extracted Map Projections Extracted Suez Canal Map Extracted Asia Physical Map
World Geography (p. 2): Fig. 1.2 (1) Mercator and Fig. 1.2 (2) Robinson projections with italic captions, KEY TERM, and ocean table. World Geography (p. 4): Waterways table, DON'T MISS OUT box, and Fig. 1.10 retaining its compass rose, scale bar, route line, and legend. World Geography (p. 5): 5-term KEY TERMS box paired with Fig. 1.11 physical map of Asia with crisp overlaid vector labels.

3. Section B (Solutions) & Section C (Practice Questions)

Section B — Textbook Solutions Section C — Practice MCQs Section C — Case Study Questions
Section B Textbook Solutions Section C Practice MCQs Section C Case Study Questions
Natural Resources (p. 5): Green banner, book-matched sub-heading, numbered Q&As 1–11 with (Page N) citations, and indented bold-italic Ans: blocks. World Geography (p. 14): Red banner and 15 MCQs with inline (a)–(d) options and green bold-italic Answer: (x) keys. World Geography (p. 17): Red-bordered scenario boxes (Q41–43) with (i), (ii), (iii) sub-questions and answers.

How It Works

1. Five-Question Intake (Asked Before Work Begins)

The skill always begins with a structured intake flow (using the host agent's multiple-choice UI if available, or a numbered message):

  1. Question 1 (Asked Alone First — Opt-Out Gate)

    Use the colour-coded notes format (blue explainer · green solutions · red practice questions), or deactivate this skill and handle the request normally?

    • Choosing 2 immediately deactivates the skill.
    • If the user's initial prompt already explicitly requests the format (e.g., "make notes in the usual colour format"), Q1 is skipped automatically.
  2. Questions 2–5 (Asked Together in One Message)

    • Q2 — Textbook Solutions (Yes / No): Solve in-text prompts (Let's Explore, Think About It, Don't Miss Out, Probe and Ponder, etc.) and end-of-chapter questions.
    • Q3 — Practice Questions (1–4):
      1. No practice questions
      2. AI-generated questions (MCQs, very short, short, long, and case-study questions — all with answers; default 43 questions: 15 MCQ, 10 VSA, 10 SA, 5 LA, 3 Case Studies, adjustable if requested)
      3. User's own question bank (pasted or uploaded; keeps original wording/order and adds solutions if missing)
      4. Both (user's bank first within each sub-heading, topped up with AI questions to at least the default counts)
    • Q4 — Maps & Figures (Yes / No): Copy the maps, diagrams, and figures from the chapter PDF into the notes next to the topics they explain.
    • Q5 — File Format (1–3): Deliver as:
      1. PDF only (default — faster and lighter on conversation budget)
      2. Word (.docx) only
      3. Both (PDF + editable .docx)

Shortcut: Replying "you decide" or "all" applies the defaults: Q2 = Yes, Q3 = 2 (AI-generated), Q4 = Yes (only if the chapter actually has maps/figures), and Q5 = 1 (PDF only). Once answered, the agent states a one-line build plan (e.g., "Building: Insights + Solutions + AI practice questions + figures, as a PDF") and starts generating.

2. Adaptive A / B / C Section Lettering

Colours belong to the content type, never the section letter. Switching off a section re-letters the remaining sections sequentially without changing their colours:

Q2 (Solutions) Q3 (Practice) Resulting Document Structure
No No Insights only — Blue banner CHAPTER INSIGHTS (no section letter)
No Yes SECTION A : CHAPTER INSIGHTS (Blue) + SECTION B : PRACTICE QUESTIONS (Red)
Yes No SECTION A : CHAPTER INSIGHTS (Blue) + SECTION B : SOLUTIONS (Green)
Yes Yes SECTION A : CHAPTER INSIGHTS (Blue) + SECTION B : SOLUTIONS (Green) + SECTION C : PRACTICE QUESTIONS (Red)

3. End-to-End Build Pipeline

  Textbook PDF
       │
       ├──► 1. Inspect (pdfinfo + pdffonts + pdftotext -layout / OCR)
       │         • Handles extensionless uploads via `file`
       │         • Extracts headings, margin glossaries, boxes, dates, questions, figure pages
       │
       ├──► 2. Extract Figures [if Q4 = Yes] (pdftoppm @ 160 DPI + crop_figures.py)
       │         • auto_crop() / manual_crop() preserves vector map labels & legends
       │         • contact_sheet() visual check before embedding (<= 540x400 px)
       │
       ├──► 3. Build DOCX (Node.js + docx + helpers.js)
       │         • Always built first ({Chapter_Title}_Notes.docx)
       │         • Section breaks via pageBreakBefore (prevents blank pages)
       │         • Consecutive boxes/tables separated by gap() so borders never fuse
       │
       ├──► 4. Convert & Verify (LibreOffice soffice --headless --convert-to pdf)
       │         • Converted when Q5 = PDF or Both (or temporarily to check a Word-only build)
       │         • Render key pages and visually verify against the 7-point QA checklist
       │
       └──► Deliverable (exact Q5 choice): {Chapter_Title}_Notes.pdf / .docx / both

4. Graceful Fallbacks (No Code Execution)

If the host environment cannot execute Node.js or Python:

  • Self-Contained HTML Fallback: Generates one standalone HTML file using CSS variables mapped to the exact hex palette (div.banner, div.box.term|fact|case with 1.5px solid borders, blue-header tables) ready for browser Print → Save as PDF.
  • Markdown Fallback: If file output is also unavailable, outputs clean Markdown using > **KEY TERM** … blockquotes.
  • Figure Placeholder Fallback: When figures cannot be extracted or visually inspected, inserts a neutral grey FIGURE — Fig. n.n, textbook p. N box (figurePlaceholder()).

Design System

Page Geometry & Typography

Property Specification
Page Size & Margins A4, 0.625 in (900 twips) margins on all sides (CONTENT_WIDTH = 10106 twips)
Typeface Calibri (UTF-8 supported for diacritics and regional terms)
Header Strip Three-cell table: Class (left) · Subject (centre) · Unit / Book name (right), 10 pt bold over #16345C bottom rule
Running Header {Chapter title} — Notes — centred, 8 pt italic #888888 with thin #16345C bottom rule
Footer Centred page number — 9 pt #666666
Type Scale Chapter title 16 pt bold · Section banner 13 pt bold white · Sub-heading 11.5 pt bold (with bottom rule) · Mini-heading 10.5 pt bold · Body & box title/text 10.5 pt · Answers 10 pt · Table header 10 pt white bold · Table body 9.5 pt · Figure caption & footer 9 pt · Running header 8 pt italic

Colour Palette

Role Hex Swatch / Usage
Document Accent (Navy) #16345C Chapter title, header strip bottom rule, running-header bottom rule
Section A — Insights (Blue) #1F6FB2 Section A banner, Section A sub-headings, table header fill
Section B — Solutions (Green) #2E8B57 Section B banner, Section B sub-headings, Section A mini-headings, MCQ Answer: (x) line
Section C — Practice (Red) #C0392B Section C banner, Section C sub-headings, CASE STUDY border/title & sub-question numbers
Key Term Box #DCEEF9 / #1F6FB2 Fill #DCEEF9, 1 pt border & uppercase title #1F6FB2
Facts / Timeline / Don't Miss Out #FFF6D9 / #E0A800 Fill #FFF6D9, 1 pt border & uppercase title #E0A800
Case Study / Biography Box #FDECEA / #C0392B Fill #FDECEA, 1 pt border & uppercase title #C0392B
Table Rows & Grid #FFFFFF / #F2F7FC / #AAAAAA Alternating zebra rows #FFFFFF and #F2F7FC; #AAAAAA cell borders
Figure Placeholder & Captions #F2F2F2 / #555555 Placeholder fill #F2F2F2 (#AAAAAA border, #555555 title); captions #555555 italic 9 pt

Section Content & Component Rules

  • Section A — Chapter Insights (typically 4–7 pages):
    1. The Big Questions from the chapter opener (bulleted with ●).
    2. Numbered topics (1. … 2. …) following the chapter's own headings, mapping margin glossaries to KEY TERM(S), fun facts/timelines to yellow boxes (DON'T MISS OUT, QUICK FACTS, DID YOU KNOW?, TIMELINE — KEY DATES), biographies/caselets to red CASE STUDY boxes, and comparisons/classifications to blue-header tables.
    3. Before We Move On … summary bullets as the final block.
  • Section B — Solutions (only if Q2 = Yes):
    • Solutions only — no re-teaching or study tips. Uses the textbook's own sub-headings (e.g., Let's Explore / Think About It / Don't Miss Out, Questions and Activities (Page N)), includes (Page N) citations, and provides adaptable outlines for local/personal projects without fabricating local data.
  • Section C — Practice Questions (only if Q3 ≠ 1):
    • Five ordered sub-headings with every answer placed directly below its question. Default Q3 = 2 counts (adjustable if the user states other counts):
Question Type Default Count Numbering Solution Style
Multiple Choice Questions 15 1–15 4 inline options (a)–(d); Answer: (x) (varied keys, max 5 of 15 on any one letter)
Very Short Answer Questions 10 16–25 1 line
Short Answer Questions 10 26–35 2–4 sentences
Long Answer Questions 5 36–40 1 solid paragraph (~120–220 words, 5-mark depth)
Case Study Based Questions 3 41–43 Original 2–4 line scenario box + (i)(ii)(iii) sub-questions (1–3 sentences each)

Appendix Modules (helpers.js & crop_figures.py)

Both helper modules are included directly in SKILL.md (Appendices A and B):

  • helpers.js (docx-js component library)
    • Layout & Structure: headerRowTable, chapterTitle, sectionBanner, subHeading, miniHeading, para, bullet, spacer, gap, pageBreakPara, buildDoc
    • Boxes & Tables: coloredBox, keyTerms, factBox, caseBox, dataTable
    • Q&A & Figures: qBlock, mcq, caseStudy, figure, figurePlaceholder, parseInline (supports **bold** inline markup only — never single *asterisks*)
  • crop_figures.py (Poppler + Pillow + NumPy)
    • render_pages(pdf, pages, outdir, dpi=160) — renders textbook pages and normalises pdftoppm filenames
    • auto_crop(page_png, x_range, y_range, row_thr=0.6, col_thr=0.6) — tight-crops dense diagrams while excluding original textbook captions (use 0.35–0.45 thresholds for pale/white-heavy maps)
    • manual_crop(page_png, box, scale=1.0) — exact coordinate cropping from downscaled previews
    • save(img, path, quality=90) & contact_sheet(paths, out, cols=3, cell=(620, 520)) — batch preview grid for visual verification before embedding

Installation & Usage

1. Install the Skill

Clone the repository and copy SKILL.md into your agent's skill directory:

git clone https://github.com/nobrocoding/Chapter-Notes-Builder.git
  • Antigravity (Project-local): .agents/skills/chapter-notes-builder/SKILL.md
  • Antigravity (Global): ~/.gemini/config/skills/chapter-notes-builder/SKILL.md
  • Claude / Other Agent Skills Hosts: Upload or register SKILL.md in your client's Skills configuration.

For local builds, save Appendix A from SKILL.md as helpers.js and Appendix B as crop_figures.py in your working directory.

2. Install System & Runtime Dependencies

Dependency Purpose Install Command
Node.js + docx Programmatic .docx generation (helpers.js) npm install docx
LibreOffice Headless .docx → .pdf conversion (soffice) See OS commands below
Poppler (poppler-utils) pdfinfo, pdffonts, pdftotext, pdftoppm See OS commands below
Python 3 + pillow, numpy Cropping & contact-sheet verification (crop_figures.py) pip install pillow numpy
OS-specific installation commands (Linux, macOS, Windows)

Ubuntu / Debian

sudo apt-get update && sudo apt-get install -y nodejs npm libreoffice poppler-utils python3-pip
pip3 install pillow numpy
npm install docx

macOS (Homebrew)

brew install node poppler python
brew install --cask libreoffice
pip3 install pillow numpy
npm install docx

Windows (winget / Chocolatey)

winget install OpenJS.NodeJS.LTS TheDocumentFoundation.LibreOffice Python.Python.3.12
# Poppler for Windows (e.g., via Chocolatey or Scoop):
choco install poppler -y
pip install pillow numpy
npm install docx

3. Usage

With an AI Agent

Attach any textbook chapter PDF and prompt:

"Turn this textbook chapter into study notes."
or "Make notes like the last one."

Answer the 5 intake questions (or reply "all" / "you decide"), and the agent handles text extraction, figure cropping, DOCX assembly, LibreOffice PDF rendering (when requested or for visual QA), and delivery in your chosen format.

Standalone Build Script

Using the Appendix C skeleton (build.js) alongside helpers.js:

node build.js
# Only if you want a PDF (Q5 = PDF or both):
soffice --headless --convert-to pdf Chapter_Title_Notes.docx

Real-World Output Examples

Six Class VIII Social Science chapters produced with chapter-notes-builder (featuring Blue Section A CHAPTER INSIGHTS, Green Section B solutions — titled NCERT SOLUTIONS in these Class VIII sample PDFs — and Red Section C with 43 solved practice questions):

Chapter Unit / Book Format & Length Sections & Extracted Elements
CH1 – World Geography: Some Glimpses Land and the People 17 pp · A4 Sec A (p. 1–10), Sec B (p. 11–13, 23 items), Sec C (p. 14–17, 43 Qs) · 12 embedded figures/maps, 5 tables, 4 KEY TERM(S), 3 DON'T MISS OUT
CH1 – Natural Resources and Their Use Land and the People 11 pp · A4 Sec A (p. 1–4), Sec B (p. 5–6, 16 items), Sec C (p. 7–11, 43 Qs) · 4 KEY TERM(S), 2 DON'T MISS OUT, 1 QUICK FACTS, 1 DID YOU KNOW?, 2 CASE STUDY, 1 table
CH3 – The Rise of the Marathas Tapestry of the Past 12 pp · A4 Sec A (p. 1–5), Sec B (p. 6–7, 14 items), Sec C (p. 8–12, 43 Qs) · 4 KEY TERM(S), 4 DON'T MISS OUT, 2 QUICK FACTS, 1 DID YOU KNOW?, 1 table
CH4 – The Colonial Era in India Tapestry of the Past 14 pp · US Letter Sec A (p. 1–5), Sec B (p. 6–9, 23 items), Sec C (p. 10–14, 43 Qs) · 7 KEY TERM(S), 2 DON'T MISS OUT, 1 QUICK FACTS, 1 TIMELINE — KEY DATES
CH5 – Universal Franchise & India's Electoral System Governance & Democracy 10 pp · A4 Sec A (p. 1–3), Sec B (p. 4–5, 14 items incl. Suryodaya School caselet), Sec C (p. 6–10, 43 Qs) · 3 KEY TERM(S), 1 DON'T MISS OUT, 1 QUICK FACTS, 1 DID YOU KNOW?, 3 tables
CH7 – Factors of Production Economic Life Around Us 12 pp · A4 Sec A (p. 1–4), Sec B (p. 5–7, 22 items), Sec C (p. 8–12, 43 Qs) · 8 KEY TERM(S), 3 DON'T MISS OUT, 1 QUICK FACTS, 1 DID YOU KNOW?, 1 CASE STUDY

About

AI agent skill that turns textbook chapter PDFs into colour-coded study notes (Insights, Solutions, Practice) with vector maps as PDF and DOCX.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Contributors