The Problem
Traditional textbooks and study materials typically contain questions that are relatively simple and one-dimensional. Students aren’t exposed to the variety of question formats and approaches needed to truly test their understanding. Most textbooks repeat similar question types, which limits how well students can prepare for real assessments.
My Solution
I’ve developed an AI system that addresses this by doing three things:
- Scans curriculum materials (either a full Contour workbook OR a 3-section textbook scan) to understand the knowledge scope students should master
- Analyzes existing mock tests from educational institutions to extract question patterns—identifying the testing aspect of each question (what concept/formula/skill is being assessed)
- Generates fresh questions that test the same concepts with entirely new scenarios, numbers, and diagrams—while staying within appropriate difficulty levels
The Process
The workflow uses an agent orchestration model with four sequential steps:
Step 1: Curriculum Analysis
/analyze-curriculum "Workbook.pdf" → Produces curriculum_context.md
- Extracts all formulas, theorems, and worked examples
- Documents difficulty benchmarks and number patterns
- Identifies the full knowledge range for the topic
Step 2: Test Extraction
/extract-test "Test.pdf" → Produces ExtractedQuestions.md + images/
- Captures the testing aspect of each question (not just the question text)
- Extracts original diagrams with metadata tracking
- Classifies diagram types for proper regeneration
Step 3: Question Generation
/generate-variations → Produces new test PDF + answers
- Creates completely new questions (not just number swaps)
- Generates new diagrams for diagram questions
- Uses three prioritized sources:
- Testing aspects from extracted questions
- Curriculum context for enrichment
- Variation type strategies for simple questions
Full Pipeline
/generate-test "Workbook.pdf" "Test.pdf" → Runs all steps sequentially
Input Flexibility
Scenario A: With Contour Workbook
When Contour study materials exist for the topic, use the full workbook PDF as curriculum reference.
Scenario B: Textbook 3-Section Scan
When Contour materials don’t exist yet, scan just 3 sections from any school textbook:
- Chapter Summary → Mind map of formulas/concepts
- Chapter Checklist → “I can…” success criteria with difficulty levels
- Review Questions → Example question formats with solutions
These ~6-10 pages contain everything needed to generate curriculum-aligned variations.
Diagram Intelligence
The system classifies all diagram questions before generating:
- Type A (Input): Diagram provides given information → Create NEW diagram with different values
- Type B (Output): Blank grid for student sketching → Create BLANK GRID only (not the answer!)
- Type C (Reference): Partial information for annotation → Create similar partial diagram
Question Variation Types (Type 1-5)
The system uses a library of 5 variation strategies to create questions that test true understanding, not just memorization:
| Type | Name | When to Use | Example |
|---|---|---|---|
| Type 1 | Different Numbers | Basic calculations, building confidence | “Range of {5,1,9,12}” → “Range of {7,2,11,15}” |
| Type 2 | Modified Challenge | Student shows mastery, ready for extension | “Find the range” → “Find the range AND interquartile range” |
| Type 3 | Reverse Pattern | Testing deep understanding of relationships | “Calculate range” → “Range is 15, min is 3. What’s max?” |
| Type 4 | Conceptual Application | Testing if student can apply to new situations | “Calculate range” → “Which set has larger range? Explain.” |
| Type 5 | Construct & Calculate | Testing visualization, no diagram given | Text description only → Student must draw diagram first |
Distribution Guideline
- ~35% Type 1 (mechanical practice)
- ~25% Type 2 (extend thinking)
- ~15% Type 3 (deep understanding)
- ~10% Type 4 (new contexts)
- ~15% Type 5 (visualization + multi-step)
Real-Life Context Layer
This is NOT a variation type — it’s a presentation layer that wraps any Type 1-5 variation in a real-world scenario.
The Two-Step Process
Original Question
↓
Step 1: Apply Variation Type (1-5)
↓
Step 2: Apply Real-Life Context Layer
↓
Final Question
Example
Original: "A circle has radius 10 cm. A chord is 6 cm from centre. Find chord length."
Step 1 - Apply Type 1:
"A circle has radius 12 cm. A chord is 5 cm from centre. Find chord length."
Step 2 - Apply Real-Life Context:
"A circular swimming pool has a radius of 12 metres. A lane rope is
stretched across the pool as a straight chord, positioned 5 metres
from the centre. Find the length of the lane rope."
Application Rules
| Section | Real-Life Context | Reason |
|---|---|---|
| First 2-3 questions | 0% – Keep abstract | Test basic concepts directly |
| Remaining questions | ~80% apply | Test comprehension + math |
| Priority | Diagram questions > Text questions | Visual scenarios more impactful |
Why This Matters
When Real-Life Context is applied:
- Numbers are NOT given directly in the question
- Student must read and comprehend the scenario first
- Student must extract relevant information from context
- Tests comprehension + mathematical skill together
This creates questions that test TRUE understanding — students can’t just “plug and chug” because they must first identify what information is relevant.
Test PDF Generator (Final Step – After Question Creation)
This runs AFTER question generation is complete. At this point, the agent has already:
- Created all question text (with variations + real-life context applied)
- Generated all diagram images (PNG files saved to
new_images/) - Calculated mark allocations for each question
Now this final step combines everything into a printable PDF using a reusable Python script.
The Process (After Questions Are Ready)
┌─────────────────────────────────────────┐
│ ALREADY COMPLETE (from Step 3): │
│ • Question text (with variations) │
│ • Diagram PNG files (new_images/) │
│ • Mark allocations │
└─────────────────────────────────────────┘
│
▼
Agent creates config.json
(references pre-made content)
│
▼
test_pdf_generator.py
(reusable script - never changes)
│
▼
Final Test PDF (ready to print)
Key Design: Separation of Concerns
| Component | Created By | When |
|---|---|---|
| Question text | Agent (Step 3) | During question generation |
| Diagram images | diagram-generator scripts | During question generation |
| PDF layout | test_pdf_generator.py | Final step only |
The script is REUSABLE – it doesn’t generate any content, it only formats what already exists.
Input: JSON Config (References Pre-Made Content)
{
"title": "Year 10 Mathematics",
"version": "Version B",
"sections": [
{
"name": "Section A",
"questions": [
{
"number": 1,
"marks": 3,
"text": "A circular pool has radius 12m...",
"diagram": "new_images/q1_pool.png"
}
]
}
]
}
Note: "diagram": "new_images/q1_pool.png" references a pre-made PNG that was already generated.
Output: Professional PDF
The script handles formatting only:
- Page layout with proper margins
- Question numbering and mark allocation
[3 marks] - Embedding pre-made PNG diagrams (aspect ratio preserved)
- Working space for student answers
- Section headers and page breaks
Script Location
.claude/skills/test-pdf-generator/scripts/test_pdf_generator.py
This separation means the PDF formatting logic is written once and reused for every test – the agent only provides the content.
Technical Architecture
/generate-test
│
├─→ curriculum-analyzer agent
│ (workbook → curriculum_context.md)
│
├─→ test-contents-extractor agent
│ (test PDF → ExtractedQuestions.md + images/)
│
└─→ question-generator agent
(creates fresh questions + new diagrams → PDF)
Future Potential
During this process, I’ve accumulated extensive data on question patterns and variations. This opens up exciting possibilities:
- Phase 1 (current): Reproducing and improving existing mock tests with fresh variations
- Phase 2 (future): Creating entirely new mock tests without needing existing test examples—using only the knowledge scope and accumulated pattern knowledge from analyzing many test sources
This approach is powerful because the system learns how to ask good questions, not just copying templates.
