chapter-content-generator
This skill generates comprehensive chapter content for intelligent textbooks after the book-chapter-generator skill has created the chapter structure. Use this skill when a chapter index.md file exists with title, summary, and concept list, and detailed educational content needs to be generated at the appropriate reading level with rich non-text elements including diagrams, infographics, and MicroSims. (project, gitignored)
What this skill does
# Chapter Content Generator
**Version:** 0.08
## Overview
This skill generates detailed educational content for individual textbook chapters, transforming chapter outlines (title, summary, concept list) into comprehensive learning material with appropriate reading level, rich visual elements, and interactive components. The skill is designed to run after the `book-chapter-generator` skill has created the chapter structure.
**Version 0.08 Features:**
- **Mascot self-introduction in Chapter 1** - When the project CLAUDE.md defines a pedagogical mascot, the FIRST mascot admonition in Chapter 1 must be a self-introduction that names the mascot and enumerates each of the six pose-roles the mascot will play across the book. This sets reader expectations for every later chapter (see Step 2.4, principle 4)
**Version 0.07 Features:**
- **Instructional scaffolding** - Define-before-display rules ensure terms are explained before diagrams use them, code parameters are explained before code examples, and tables reinforce rather than introduce concepts (see Step 2.4, principle 3)
- **Sequential execution** - Generate content one chapter at a time to avoid excessive token usage. A user may override this with the phrase "use parallel execution" but the skill will warn them that a 38% additional tokens will be used
- **Edge direction validation** - Mandatory check to prevent inverted dependency bugs (see Step 1.3a)
## When to Use This Skill
Use this skill when:
- The `book-chapter-generator` skill has created chapter directories with index.md files
- A chapter index.md contains: title, summary, and concepts covered list
- Detailed chapter content needs to be generated
- Content should be adapted to a specific reading level (junior high, senior high, college, graduate)
- Rich non-text elements (diagrams, MicroSims, infographics) are desired
Do NOT use this skill when:
- Chapter structure hasn't been created yet (use `book-chapter-generator` first)
- Content already exists and just needs editing (use Edit tool directly)
- Generating other types of content (prompts, glossaries, etc.)
- The user is almost out of tokens (over 95% of used in a 5-hour window)
## Execution Modes
### Sequential Mode (Default for all use-cases)
- Always only do one chapter at a time due to large overhead of parallel mode
- Wait for a chapter to totally finish and log the session before you begin the next chapter
- Clearly indicate to the user when each chapter is finished
### Parallel Mode (Only on request)
Parallel mode should ONLY be used when the user specifically request parallel execution.
Warn the user that there will be a substantial token penalty to pay for parallel execution.
### Single Chapter Mode
Use for:
- Updating one chapter after outline revision
- Testing content format before batch generation
## Workflow
### Phase 1: Setup (Sequential)
This phase runs once before any content generation, reading shared context that all agents will need.
#### Step 1.1: Capture Start Time for Logging
```bash
date "+%Y-%m-%d %H:%M:%S" >>logs/ch-{NN}-content-generation.md
```
Where {NN} is the two digit chapter number with zero padding.
Log the start time for the session report.
#### Step 1.2: Indicate Skill Running
Notify the user: "Chapter Content Generator Skill v0.05 running in [parallel/sequential] mode."
#### Step 1.3: Read Shared Context
Read and cache these files for all agents:
1. **Course Description** (`docs/course-description.md`)
- Extract target audience and reading level
- Note course objectives and tone guidelines in the project CLAUDE.md
- Identify any mascot or narrative elements (e.g., Delta in calculus) in the project CLAUDE.md
2. **Learning Graph** (`docs/learning-graph/learning-graph.json` and/or `learning-graph.csv`)
- Load concept list with dependencies
- Understand concept relationships for pedagogical ordering
!!! info "Learning Graph = Concept Dependency Graph (a DAG)"
A learning graph is a **Concept Dependency Graph** -- a directed acyclic
graph (DAG) where each edge represents a "depends on" relationship. We use
the **dependency direction** (edges point FROM a concept TO the concepts it
depends on) because this aligns with standard graph theory algorithms for
topological sorting, cycle detection, and transitive reduction.
Some learning management systems use an **enablement graph** where edges
point the opposite way (FROM prerequisite TO enabled concept). That direction
is more intuitive for some teachers but less natural for graph algorithms.
This project uses the dependency direction exclusively.
!!! danger "CRITICAL: Edge Direction in learning-graph.json"
In the vis-network JSON format, edges point **FROM dependent TO prerequisite**
(the dependency direction).
- Edge `{from: 5, to: 1}` means "Biodiversity (5) depends on Ecology (1)"
- It does NOT mean "Ecology leads to Biodiversity" (that would be the enablement direction)
**To build a prerequisite map:**
```python
# CORRECT: dependency direction -- from=dependent, to=prerequisite
prereqs[edge['from']].add(edge['to'])
```
**NEVER use:**
```python
# WRONG: accidentally converts to enablement direction, inverting ALL dependencies
prereqs[edge['to']].add(edge['from'])
```
Getting this wrong produces hundreds of false violations and wastes
significant tokens on invalid chapter designs. Always validate with
Step 1.3a before proceeding.
3. **Glossary** (`docs/glossary.md`)
- Load term definitions for consistent terminology if they exist
- In most cases the glossary is created after the content is generated
- Note which concepts have glossary entries
4. **Project CLAUDE.md** (if exists)
- Load project-specific guidelines
- Note any mascot specifications, tone requirements, or special formatting
5. **Chapter List** (scan `docs/chapters/` directory)
- Enumerate all chapter directories
- Identify which chapters need content generation (have outline but no content)
#### Step 1.3a: Validate Edge Direction (MANDATORY)
Before using any dependency data, verify the edge direction is correct. This step prevents the most common and expensive bug in chapter generation -- an inverted dependency map that silently produces invalid chapter orderings.
**Validation procedure:**
1. Identify foundational concepts -- those with empty Dependencies in the CSV, or with zero prerequisites in the JSON
2. Build the prerequisite map using `prereqs[edge['from']].add(edge['to'])`
3. Check that foundational concepts have ZERO entries in the prereqs map
```python
import json
from collections import defaultdict
with open('docs/learning-graph/learning-graph.json') as f:
data = json.load(f)
# Build prereqs: from=dependent, to=prerequisite
prereqs = defaultdict(set)
for e in data['edges']:
prereqs[e['from']].add(e['to'])
# Find concepts with zero prerequisites (foundational)
all_ids = {n['id'] for n in data['nodes']}
foundational = all_ids - set(prereqs.keys())
print(f"Foundational concepts (no prerequisites): {len(foundational)}")
for fid in sorted(foundational):
node = next(n for n in data['nodes'] if n['id'] == fid)
print(f" {fid}: {node['label']}")
# SANITY CHECK: foundational concepts should be simple/introductory
# If you see advanced concepts here, the edge direction is WRONG
```
**Pass criteria:**
- Foundational concepts should be simple, introductory terms (e.g., "Ecology", "Energy", "System")
- If advanced concepts appear as foundational (e.g., "Sustainability", "Climate Change", "Tipping Points"), the edge direction is inverted -- STOP and fix before proceeding
- The number of foundational concepts should be small (typically 3-10 for a 200-400 concept graph)
- If you see 50+ "foundational" concepts, the direction is likely inverted
**If validation fails:** Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.