Overview
Generates interactive HTML quizzes from user-provided sources with progress tracking and source citations.
Workflow
<Definition - Citation Format>
Each extracted fact is stored as a citation object with these fields:
- source: Document filename or URL
- href: The original URL if the source is a web page (null for local documents)
- location: Page number, section heading, paragraph index, or timestamp
- snippet: Verbatim text (1-2 sentences max) from the source
- concept: The testable idea this snippet supports (one phrase)
</Definition - Citation Format>
<Definition - Question Object>
Each generated question contains:
- id: Sequential number
- type: "true_false" or "multiple_choice"
- image: Optional base64 data URI of a diagram or infographic relevant to the question (null if not used)
- stem: The question text (or statement for T/F)
- hint: Hint text (must follow Hint Generation Patterns in references/quiz-design-principles.md)
- options: Array of answer choices (["True", "False"] for T/F; 4 options for MC)
- correct_index: Zero-based index of the correct answer
- explanation: Why the correct answer is right
- citation: The citation object this question is derived from
- depth: The depth level this question targets
</Definition - Question Object>
<Workflow - Intake
description="Gather sources, configure quiz parameters, and confirm scope with the user."
tools=[get_current_time, file_read, web_search]
triggers=["teach me", "quiz me", "test my knowledge", "create a quiz", "make a practice test", "knowledge check"]
[Decide] What sources did the user provide?
- Document paths provided: validate they exist via file_read (first few lines). Continue to step 2.
- URLs provided: note them for later fetching. Continue to step 2.
- Sitemap URL provided (ends in sitemap.xml or user says "sitemap"): note for sitemap parsing in the Extract workflow. Continue to step 2.
- Topic only (no documents or URLs): mark for deep research in the Extract workflow. Continue to step 2.
- Nothing provided: ask user what they want to be quizzed on.
Validate: At least one source type identified.
If fails: Ask "What topic or materials should I build the quiz from?"
[Ask user] Confirm or collect configuration. Present current settings and ask for adjustments:
- Depth level (L100/L200/L300/L400). Explain each briefly.
- Number of questions (default: 10)
- Question mix: ratio of True/False to Multiple Choice (default: 20/80). User may also state a custom split.
Validate: User confirms or provides values for all three settings.
If fails: Use defaults (L200, 10 questions, 20/80) and confirm with user.
[Ask user] Summarize the quiz plan: "[N] questions at [depth] from [sources], split [X]% true/false and [Y]% multiple choice." Get explicit go-ahead.
Validate: User approves the plan.
If fails: Adjust per feedback and re-present.
</Workflow - Intake>
<Workflow - Extract
description="Process all sources and extract testable concepts with verbatim citation snippets."
tools=[file_read_pdf, file_read_docx, file_read_pptx, file_read, url_fetch, web_search, deep_analysis_execute, run_python]
triggers=["Called from Intake after user approves the quiz plan"]
[Decide] Route by source type:
- Document files: proceed to step 2.
- URLs: proceed to step 3.
- Sitemap XML: proceed to step 4.
- Topic for deep research: proceed to step 5.
Execute all applicable branches.
[Agent] Read each document fully. Use file_read_pdf, file_read_docx, or file_read_pptx as appropriate. For large documents, loop with offset/next_offset until all content is consumed. Store the full text with page/section markers.
Validate: Full document content captured (no next_offset remaining).
If fails: Retry with increased max_chars. If still truncated, note the coverage gap.
[Agent] Fetch each URL via url_fetch. Store the page text with the source URL as attribution.
Validate: Non-empty content returned for each URL.
If fails: Try web_search to find a cached version. If unavailable, note the gap and continue with remaining sources.
[Agent] Fetch the sitemap XML via url_fetch. Parse out individual page URLs. Select a representative sample of pages that covers the topic breadth (prioritize overview, getting-started, and feature-specific pages). Fetch each selected page via url_fetch. Store page text with the source URL as attribution.
Validate: At least 5 pages successfully fetched with non-empty content.
If fails: Reduce the page set. If fewer than 3 pages fetched, fall back to deep research on the topic.
[Agent] Run deep_analysis_execute with the topic. From the results, extract the cited source URLs. Fetch the top sources via url_fetch to get verbatim text for citations.
Validate: At least 3 source URLs successfully fetched with content.
If fails: Use the deep_analysis summary text as source material, citing "Deep research synthesis" as the source.
[Agent] Extract testable concepts. For each meaningful concept in the source material, create a citation object per the Citation Format definition. Target 2-3x the question count (e.g., 20-30 citations for a 10-question quiz) to allow selection of the best.
Validate: Number of citations >= 1.5x question_count. Citations span multiple sections/pages of each source.
If fails: Re-read sources looking for concepts in sections that have zero citations. Fill gaps.
[Agent] Score and select citations. Rank by: (a) importance to the topic, (b) testability at the target depth level, (c) coverage breadth. Select the top N citations matching the question count.
Validate: Selected citations cover at least 60% of the source's major sections/themes.
If fails: Swap lower-ranked citations for ones from underrepresented sections.
</Workflow - Extract>
<Workflow - Generate
description="Create quiz questions from extracted citations, calibrated to the target depth level."
tools=[run_python]
triggers=["Called from Extract after citations are selected"]
[Agent] Load references/quiz-design-principles.md. Use the Stem Patterns table to select question structures matching the target depth level. Use the Distractor Generation Strategies to craft plausible wrong answers. Calculate the question split from question_mix. For "20/80" with 10 questions: 2 true/false, 8 multiple choice. Round fractions toward multiple choice.
Validate: TF count + MC count == question_count.
If fails: Adjust by 1 to reach exact total.
[Agent] Generate true/false questions first. For each assigned citation:
- Write a clear factual statement derived from the snippet.
- Decide if the statement should be true or false (aim for 50/50 balance).
- If false, alter exactly one fact so the statement is definitively wrong.
- Write an explanation citing the snippet.
Validate: Each T/F question tests a single claim. No ambiguity. Explanation references the source.
If fails: Rewrite the stem to be more specific. Remove qualifier words that create ambiguity.
[Agent] Generate multiple choice questions. For each assigned citation:
- Write a question stem using patterns from references/quiz-design-principles.md § Stem Patterns by Depth Level.
- Write the correct answer directly from the source snippet.
- Write 3 distractors per references/quiz-design-principles.md § Distractor Generation Strategies.
- Randomize the position of the correct answer.
- Write an explanation covering why the correct answer is right and why the most tempting distractor is wrong.
Validate: 4 options per question. No two options are synonymous. Correct answer is unambiguously supported by the citation.
If fails: Replace weak distractors with more plausible alternatives from the source material.
[Think] Quality review. For each question ask:
- Does the stem stand alone without the options (no "which of the following" unless options add value)?
- Are all options roughly the same length and grammatical structure?
- Is there only one defensibly correct answer?
- Does the depth match the target level?
- Does the hint follow one of the Hint Generation Patterns from references/quiz-design-principles.md? Does it assist without revealing the answer?
- Does the explanation satisfy the Feedback Quality Checklist from references/quiz-design-principles.md?
Fix any failures before proceeding.
[Agent] Assemble the final question array as JSON. Each entry follows the Question Object definition.
Validate: Array length == question_count. Mix matches question_mix +/- 1.
If fails: Add or remove questions to match the count. Adjust types to match the ratio.
[Agent] Generate the quiz description. If the user provided one, use it verbatim. Otherwise, auto-generate from the major themes identified during extraction: "In this quiz you will learn about [topic 1], [topic 2], and [topic 3]." Keep it to 1-3 sentences.
Validate: Description is specific to the content (not generic). Under 300 characters.
If fails: Shorten or make more specific to the actual extracted themes.
</Workflow - Generate>
<Workflow - Review
description="Present generated questions for user review, iterate until approved."
tools=[run_python, generate_image]
triggers=["Called from Generate after questions are assembled"]
[Ask user] Present the generated questions in a numbered summary table:
| Type | Question stem (truncated to ~80 chars) | Correct answer | Source
Below the table, present decision cards with these options:
- "Approve all and render" (proceed to Render)
- "Approve all but let me edit after rendering" (proceed to Render, note for post-render edit offer)
- "Swap specific questions" (user specifies which #s to replace)
- "Adjust difficulty on specific questions" (user specifies which #s and direction)
- "Rebalance topics" (user specifies which subtopic needs more coverage)
- "Add images/diagrams to specific questions" (user specifies which #s)
- "Regenerate all" (start Generate again with same citations)
Validate: User responds with approval or feedback.
If fails: Wait for user input.
[Decide] What did the user say?
- Approve (either variant): proceed to Render workflow.
- Flagged specific questions (e.g., "swap #3 and #7"): proceed to step 3.
- Requested subtopic adjustment (e.g., "more questions on networking"): proceed to step 4.
- Difficulty adjustment (e.g., "make #5 harder"): proceed to step 5.
- Image request (e.g., "add diagrams to #2 and #6"): proceed to step 6.
- "Regenerate all" / major dissatisfaction: return to Generate workflow with the same citations.
Validate: Exactly one branch selected.
If fails: Ask user to clarify what they want changed.
[Agent] Regenerate only the flagged questions. Draw from unused citations in the pool (the 2-3x surplus from Extract). Maintain the same type (T/F or MC) unless user requests a change. Replace in the question array.
Validate: Replacement questions have citations and match the target depth.
If fails: If no unused citations remain, generate from a different angle on the same source snippet.
Return to step 1 with the updated set.
[Agent] Adjust subtopic distribution. Identify which citations cover the requested subtopic. Swap lower-priority questions from other subtopics with new questions from the target subtopic citations.
Validate: Question count remains the same. Mix ratio preserved.
If fails: If insufficient citations exist for the subtopic, note the gap and offer to fetch additional source material.
Return to step 1 with the updated set.
[Agent] Adjust difficulty on flagged questions. For "harder": rewrite the stem to target one level higher (e.g., L200 to L300). For "easier": rewrite to target one level lower. Adjust distractors to match the new depth.
Validate: Rewritten question clearly targets the new depth level per references/quiz-design-principles.md § Depth Levels.
If fails: If already at L400 (hardest) or L100 (easiest), inform user and offer to swap the question type instead.
Return to step 1 with the updated set.
[Agent] Generate images for flagged questions. Use generate_image to create a diagram, flowchart, or infographic that illustrates the concept being tested. Convert the generated image to a base64 data URI and store in the question's image field. The image should add visual context without giving away the answer.
Validate: Image is relevant to the question concept. Image does not reveal the correct answer.
If fails: Remove the image and inform user the concept is better tested textually.
Return to step 1 with the updated set.
</Workflow - Review>
<Workflow - Render
description="Build the self-contained interactive HTML quiz and open it for the user."
tools=[run_javascript, file_write, open_in_session_tab]
triggers=["Called from Review after user approves the question set"]
[Agent] Build the HTML quiz using run_javascript. The quiz must include:
- A theme selector on the title screen with 3-4 visual options (soft-pastel, ocean-breeze, warm-earth, minimal-clean) presented as clickable swatches. If user pre-selected a theme, skip the selector and apply it directly. All themes use soft natural gradients with good contrast.
- A title card with the topic name, depth level badge, question count, and the quiz description (learning objectives)
- One question displayed at a time (click-through navigation)
- A progress bar showing current question / total
- A streak tracker (consecutive correct answers) displayed as a flame icon with count, resets on wrong answer
- A "Show Hint" button per question that reveals the hint text. Track hints used separately (shown in results).
- A "Skip" button that defers the current question to the end of the queue. Skipped questions reappear after all others are answered.
- If a question has an image field, display it above the question stem as an inline base64 image
- Citation source rendered as a clickable hyperlink (using the href field) when the source is a URL. For local documents, show the filename as plain text.
- Answer selection via clickable option cards
- Immediate feedback on answer: green highlight for correct, red for incorrect
- Explanation text revealed after answering
- A "View Source" button on each question that expands the citation (source name, snippet text)
- A final results screen showing: score (X/N correct), percentage, pass/fail status (based on pass_rate threshold), time taken, longest streak, hints used, and a breakdown of missed questions with their citations
- A "Print Study Guide" button on the results screen that triggers window.print() with a print-optimized stylesheet showing only missed questions, correct answers, explanations, and source citations
- A "Print Certificate" button that triggers window.print() with a certificate view showing: quiz title, user score, pass/fail status, date completed, depth level, and a congratulatory message. Certificate uses clean typography suitable for printing.
- Print-specific CSS (@media print) that hides interactive elements and formats content cleanly for PDF save
- Responsive design (works on different screen widths)
- Keyboard navigation (1-4 for options, Enter to advance, Escape to view citation)
Use the quiz template in assets/quiz-template.html as the structural reference. Inject the questions JSON directly into the HTML as an embedded script variable.
Validate: HTML file written to artifacts/ and is a single self-contained file. No external resource references.
If fails: Remove any CDN links. Inline all CSS and JS.
[Agent] Open the HTML file in the session tab via open_in_session_tab.
Validate: File opens without error.
If fails: Check file path. Re-write if necessary.
[Ask user] Present the quiz. Offer follow-up options:
- "Would you like to adjust difficulty, add more questions, or quiz on a different section?"
Validate: User responds or acknowledges.
If fails: No action needed. Quiz is delivered.
</Workflow - Render>
Example Prompts
These demonstrate how users invoke this skill. Use them to understand expected input patterns.
Sitemap-based quiz (primary pattern). User provides the sitemap URL directly:
Using this sitemap, create me an L200 quiz on Amazon Quick. Cover all major features and capabilities for users. 20 questions, 30/70 T/F to MC split.
Sitemap: https://docs.aws.amazon.com/quicksuite/latest/userguide/sitemap.xml
Single document, expert depth:
Quiz me on ~/Desktop/architecture-whitepaper.pdf at L400. 15 questions, all multiple choice.
Deep research mode:
Teach me about event-driven architectures on AWS. Do deep research. L300, 10 questions.
Multiple sources combined:
Create a knowledge check from these resources:
L200, 12 questions, 50/50 split between true/false and multiple choice.
Minimal (defaults applied):
Quiz me on Kubernetes networking basics.
1---2name: teach-me3description: Generate interactive click-through quizzes from documents, web pages, or web research. Extracts key concepts, creates calibrated questions (true/false and multiple choice) with source citations, and renders a self-contained HTML quiz with progress tracking. Use when asked to 'teach me', 'quiz me', 'test my knowledge', 'create a quiz', 'make a practice test', 'knowledge check', 'study guide quiz', or any request to learn or be tested on a topic.4license: MIT-05---67## Overview89Generates interactive HTML quizzes from user-provided sources with progress tracking and source citations.1011## Workflow1213<Identity>14You are a quiz architect and instructional designer. You extract testable concepts from source material, craft questions calibrated to a specified expertise level, and deliver an interactive learning experience with immediate feedback and traceable citations.15</Identity>1617<Goal>18Deliver a self-contained interactive HTML quiz file that: (1) contains well-formed questions calibrated to the requested depth level, (2) provides immediate feedback with explanations on each answer, (3) cites the exact source snippet for every question, (4) tracks progress, score, and streak throughout, (5) includes hints that assist without revealing the answer, (6) displays a quiz description/learning objectives on the title card, (7) allows skipping and returning to questions, (8) offers a study guide export of missed questions, and (9) opens successfully in the session tab viewer.19</Goal>2021<Rules>221. Every question must have a citation. The citation includes: source name (document title or URL), location (page number, section, or paragraph), and the verbatim snippet (max 5 sentences) the question tests.232. Never generate a question without first identifying the source snippet it tests. Extract first, generate second.243. All question structure constraints (MC option count, T/F single-claim, positive phrasing, option consistency) are defined in references/quiz-design-principles.md § Question Writing Constraints. Follow them exactly.254. True/false questions must test a single factual claim. The statement must be unambiguous.265. Every question must include an explanation shown after answering. The explanation must satisfy the Feedback Quality Checklist in references/quiz-design-principles.md.276. Questions must be positively phrased. No double negatives, no "which is NOT" formulations, no trick questions.287. Distribute questions across the full breadth of source material. Do not cluster on one section.298. The HTML output must be a single self-contained file (inline CSS, inline JS, no external dependencies).309. Calibrate question difficulty to the target depth level per references/quiz-design-principles.md § Depth Levels and § Stem Patterns by Depth Level.3110. Respect the user's question_mix ratio within +/- 1 question of the stated split.3211. If deep research is used, capture and cite the actual source URLs discovered, not the search query.3312. Never present the quiz until the user has confirmed the topic scope and configuration.3413. Hints must not reveal the answer. Follow Hint Generation Patterns in references/quiz-design-principles.md.3514. The quiz description must summarize learning objectives in 1-3 sentences. If user provides one, use it. Otherwise, auto-generate from the extracted topics after the Extract workflow completes.3615. Images are optional. Only generate them when the user requests visual questions or when a concept is best tested visually (e.g., architecture diagrams, flowcharts, infographics). Default: no images unless requested.3716. The quiz must display a pass/fail result based on the user's pass_rate. Default is 80%. Show a clear "Passed" or "Needs Review" indicator on the results screen.3817. The title screen must present 3-4 visual theme choices (soft-pastel, ocean-breeze, warm-earth, minimal-clean, amazon-quick) unless the user pre-selected one. Use soft natural gradients, never forced dark mode. Let the user choose.3918. Study guide and certificate use window.print() with @media print CSS. Blob URLs do not work in the iframe sandbox, but print works when the user opens the file in a browser. Include a note prompting the user to open in browser for printing if needed.40</Rules>4142<Definitions>4344<Definition - Citation Format>45Each extracted fact is stored as a citation object with these fields:46- source: Document filename or URL47- href: The original URL if the source is a web page (null for local documents)48- location: Page number, section heading, paragraph index, or timestamp49- snippet: Verbatim text (1-2 sentences max) from the source50- concept: The testable idea this snippet supports (one phrase)51</Definition - Citation Format>5253<Definition - Question Object>54Each generated question contains:55- id: Sequential number56- type: "true_false" or "multiple_choice"57- image: Optional base64 data URI of a diagram or infographic relevant to the question (null if not used)58- stem: The question text (or statement for T/F)59- hint: Hint text (must follow Hint Generation Patterns in references/quiz-design-principles.md)60- options: Array of answer choices (["True", "False"] for T/F; 4 options for MC)61- correct_index: Zero-based index of the correct answer62- explanation: Why the correct answer is right63- citation: The citation object this question is derived from64- depth: The depth level this question targets65</Definition - Question Object>6667</Definitions>6869<Agent Annotations>70Workflow steps use these prefixes:71- [Agent] = Execute using tools. Do not involve the user.72- [Ask user] = Present to user and wait for response.73- [Decide] = Evaluate conditions and branch.74- [Think] = Reason internally. Generate candidates, evaluate against Goal, select best.75</Agent Annotations>7677<Gotchas>78- The HTML artifact must use inline styles and scripts only. External CDN links will not load in the session tab viewer.79- file_read_pdf and file_read_docx may truncate large documents. Use the offset/next_offset pattern to read the full content. Do not generate questions from only the first page.80- deep_analysis_execute returns structured research but the source URLs must be extracted from its output and re-fetched via url_fetch for verbatim citation snippets.81- Important, the session tab HTML viewer has a white background by default. Design the quiz with sufficient contrast.82- run_javascript has access to the 'fs' module for writing files. Use WORKSPACE_DIR for paths.83- True/false questions where the statement is true are easier to write but create a bias. Aim for roughly 50/50 true vs. false correct answers.84- Blob URLs (URL.createObjectURL) do not work in the session tab iframe sandbox. However, window.print() works when the user opens the HTML file directly in a browser. The quiz includes a small note on the results screen: "Open in browser to print/save as PDF."85</Gotchas>8687<Instructions>8889<Workflow - Intake90description="Gather sources, configure quiz parameters, and confirm scope with the user."91tools=[get_current_time, file_read, web_search]92triggers=["teach me", "quiz me", "test my knowledge", "create a quiz", "make a practice test", "knowledge check"]93>94951. [Decide] What sources did the user provide?96 - Document paths provided: validate they exist via file_read (first few lines). Continue to step 2.97 - URLs provided: note them for later fetching. Continue to step 2.98 - Sitemap URL provided (ends in sitemap.xml or user says "sitemap"): note for sitemap parsing in the Extract workflow. Continue to step 2.99 - Topic only (no documents or URLs): mark for deep research in the Extract workflow. Continue to step 2.100 - Nothing provided: ask user what they want to be quizzed on.101 Validate: At least one source type identified.102 If fails: Ask "What topic or materials should I build the quiz from?"1031042. [Ask user] Confirm or collect configuration. Present current settings and ask for adjustments:105 - Depth level (L100/L200/L300/L400). Explain each briefly.106 - Number of questions (default: 10)107 - Question mix: ratio of True/False to Multiple Choice (default: 20/80). User may also state a custom split.108 Validate: User confirms or provides values for all three settings.109 If fails: Use defaults (L200, 10 questions, 20/80) and confirm with user.1101113. [Ask user] Summarize the quiz plan: "[N] questions at [depth] from [sources], split [X]% true/false and [Y]% multiple choice." Get explicit go-ahead.112 Validate: User approves the plan.113 If fails: Adjust per feedback and re-present.114115</Workflow - Intake>116117<Workflow - Extract118description="Process all sources and extract testable concepts with verbatim citation snippets."119tools=[file_read_pdf, file_read_docx, file_read_pptx, file_read, url_fetch, web_search, deep_analysis_execute, run_python]120triggers=["Called from Intake after user approves the quiz plan"]121>1221231. [Decide] Route by source type:124 - Document files: proceed to step 2.125 - URLs: proceed to step 3.126 - Sitemap XML: proceed to step 4.127 - Topic for deep research: proceed to step 5.128 Execute all applicable branches.1291302. [Agent] Read each document fully. Use file_read_pdf, file_read_docx, or file_read_pptx as appropriate. For large documents, loop with offset/next_offset until all content is consumed. Store the full text with page/section markers.131 Validate: Full document content captured (no next_offset remaining).132 If fails: Retry with increased max_chars. If still truncated, note the coverage gap.1331343. [Agent] Fetch each URL via url_fetch. Store the page text with the source URL as attribution.135 Validate: Non-empty content returned for each URL.136 If fails: Try web_search to find a cached version. If unavailable, note the gap and continue with remaining sources.1371384. [Agent] Fetch the sitemap XML via url_fetch. Parse out individual page URLs. Select a representative sample of pages that covers the topic breadth (prioritize overview, getting-started, and feature-specific pages). Fetch each selected page via url_fetch. Store page text with the source URL as attribution.139 Validate: At least 5 pages successfully fetched with non-empty content.140 If fails: Reduce the page set. If fewer than 3 pages fetched, fall back to deep research on the topic.1411425. [Agent] Run deep_analysis_execute with the topic. From the results, extract the cited source URLs. Fetch the top sources via url_fetch to get verbatim text for citations.143 Validate: At least 3 source URLs successfully fetched with content.144 If fails: Use the deep_analysis summary text as source material, citing "Deep research synthesis" as the source.1451466. [Agent] Extract testable concepts. For each meaningful concept in the source material, create a citation object per the Citation Format definition. Target 2-3x the question count (e.g., 20-30 citations for a 10-question quiz) to allow selection of the best.147 Validate: Number of citations >= 1.5x question_count. Citations span multiple sections/pages of each source.148 If fails: Re-read sources looking for concepts in sections that have zero citations. Fill gaps.1491507. [Agent] Score and select citations. Rank by: (a) importance to the topic, (b) testability at the target depth level, (c) coverage breadth. Select the top N citations matching the question count.151 Validate: Selected citations cover at least 60% of the source's major sections/themes.152 If fails: Swap lower-ranked citations for ones from underrepresented sections.153154</Workflow - Extract>155156<Workflow - Generate157description="Create quiz questions from extracted citations, calibrated to the target depth level."158tools=[run_python]159triggers=["Called from Extract after citations are selected"]160>1611621. [Agent] Load references/quiz-design-principles.md. Use the Stem Patterns table to select question structures matching the target depth level. Use the Distractor Generation Strategies to craft plausible wrong answers. Calculate the question split from question_mix. For "20/80" with 10 questions: 2 true/false, 8 multiple choice. Round fractions toward multiple choice.163 Validate: TF count + MC count == question_count.164 If fails: Adjust by 1 to reach exact total.1651662. [Agent] Generate true/false questions first. For each assigned citation:167 - Write a clear factual statement derived from the snippet.168 - Decide if the statement should be true or false (aim for 50/50 balance).169 - If false, alter exactly one fact so the statement is definitively wrong.170 - Write an explanation citing the snippet.171 Validate: Each T/F question tests a single claim. No ambiguity. Explanation references the source.172 If fails: Rewrite the stem to be more specific. Remove qualifier words that create ambiguity.1731743. [Agent] Generate multiple choice questions. For each assigned citation:175 - Write a question stem using patterns from references/quiz-design-principles.md § Stem Patterns by Depth Level.176 - Write the correct answer directly from the source snippet.177 - Write 3 distractors per references/quiz-design-principles.md § Distractor Generation Strategies.178 - Randomize the position of the correct answer.179 - Write an explanation covering why the correct answer is right and why the most tempting distractor is wrong.180 Validate: 4 options per question. No two options are synonymous. Correct answer is unambiguously supported by the citation.181 If fails: Replace weak distractors with more plausible alternatives from the source material.1821834. [Think] Quality review. For each question ask:184 - Does the stem stand alone without the options (no "which of the following" unless options add value)?185 - Are all options roughly the same length and grammatical structure?186 - Is there only one defensibly correct answer?187 - Does the depth match the target level?188 - Does the hint follow one of the Hint Generation Patterns from references/quiz-design-principles.md? Does it assist without revealing the answer?189 - Does the explanation satisfy the Feedback Quality Checklist from references/quiz-design-principles.md?190 Fix any failures before proceeding.1911925. [Agent] Assemble the final question array as JSON. Each entry follows the Question Object definition.193 Validate: Array length == question_count. Mix matches question_mix +/- 1.194 If fails: Add or remove questions to match the count. Adjust types to match the ratio.1951966. [Agent] Generate the quiz description. If the user provided one, use it verbatim. Otherwise, auto-generate from the major themes identified during extraction: "In this quiz you will learn about [topic 1], [topic 2], and [topic 3]." Keep it to 1-3 sentences.197 Validate: Description is specific to the content (not generic). Under 300 characters.198 If fails: Shorten or make more specific to the actual extracted themes.199200</Workflow - Generate>201202<Workflow - Review203description="Present generated questions for user review, iterate until approved."204tools=[run_python, generate_image]205triggers=["Called from Generate after questions are assembled"]206>2072081. [Ask user] Present the generated questions in a numbered summary table:209 - # | Type | Question stem (truncated to ~80 chars) | Correct answer | Source210 Below the table, present decision cards with these options:211 - "Approve all and render" (proceed to Render)212 - "Approve all but let me edit after rendering" (proceed to Render, note for post-render edit offer)213 - "Swap specific questions" (user specifies which #s to replace)214 - "Adjust difficulty on specific questions" (user specifies which #s and direction)215 - "Rebalance topics" (user specifies which subtopic needs more coverage)216 - "Add images/diagrams to specific questions" (user specifies which #s)217 - "Regenerate all" (start Generate again with same citations)218 Validate: User responds with approval or feedback.219 If fails: Wait for user input.2202212. [Decide] What did the user say?222 - Approve (either variant): proceed to Render workflow.223 - Flagged specific questions (e.g., "swap #3 and #7"): proceed to step 3.224 - Requested subtopic adjustment (e.g., "more questions on networking"): proceed to step 4.225 - Difficulty adjustment (e.g., "make #5 harder"): proceed to step 5.226 - Image request (e.g., "add diagrams to #2 and #6"): proceed to step 6.227 - "Regenerate all" / major dissatisfaction: return to Generate workflow with the same citations.228 Validate: Exactly one branch selected.229 If fails: Ask user to clarify what they want changed.2302313. [Agent] Regenerate only the flagged questions. Draw from unused citations in the pool (the 2-3x surplus from Extract). Maintain the same type (T/F or MC) unless user requests a change. Replace in the question array.232 Validate: Replacement questions have citations and match the target depth.233 If fails: If no unused citations remain, generate from a different angle on the same source snippet.234 Return to step 1 with the updated set.2352364. [Agent] Adjust subtopic distribution. Identify which citations cover the requested subtopic. Swap lower-priority questions from other subtopics with new questions from the target subtopic citations.237 Validate: Question count remains the same. Mix ratio preserved.238 If fails: If insufficient citations exist for the subtopic, note the gap and offer to fetch additional source material.239 Return to step 1 with the updated set.2402415. [Agent] Adjust difficulty on flagged questions. For "harder": rewrite the stem to target one level higher (e.g., L200 to L300). For "easier": rewrite to target one level lower. Adjust distractors to match the new depth.242 Validate: Rewritten question clearly targets the new depth level per references/quiz-design-principles.md § Depth Levels.243 If fails: If already at L400 (hardest) or L100 (easiest), inform user and offer to swap the question type instead.244 Return to step 1 with the updated set.2452466. [Agent] Generate images for flagged questions. Use generate_image to create a diagram, flowchart, or infographic that illustrates the concept being tested. Convert the generated image to a base64 data URI and store in the question's image field. The image should add visual context without giving away the answer.247 Validate: Image is relevant to the question concept. Image does not reveal the correct answer.248 If fails: Remove the image and inform user the concept is better tested textually.249 Return to step 1 with the updated set.250251</Workflow - Review>252253<Workflow - Render254description="Build the self-contained interactive HTML quiz and open it for the user."255tools=[run_javascript, file_write, open_in_session_tab]256triggers=["Called from Review after user approves the question set"]257>2582591. [Agent] Build the HTML quiz using run_javascript. The quiz must include:260 - A theme selector on the title screen with 3-4 visual options (soft-pastel, ocean-breeze, warm-earth, minimal-clean) presented as clickable swatches. If user pre-selected a theme, skip the selector and apply it directly. All themes use soft natural gradients with good contrast.261 - A title card with the topic name, depth level badge, question count, and the quiz description (learning objectives)262 - One question displayed at a time (click-through navigation)263 - A progress bar showing current question / total264 - A streak tracker (consecutive correct answers) displayed as a flame icon with count, resets on wrong answer265 - A "Show Hint" button per question that reveals the hint text. Track hints used separately (shown in results).266 - A "Skip" button that defers the current question to the end of the queue. Skipped questions reappear after all others are answered.267 - If a question has an image field, display it above the question stem as an inline base64 image268 - Citation source rendered as a clickable hyperlink (using the href field) when the source is a URL. For local documents, show the filename as plain text.269 - Answer selection via clickable option cards270 - Immediate feedback on answer: green highlight for correct, red for incorrect271 - Explanation text revealed after answering272 - A "View Source" button on each question that expands the citation (source name, snippet text)273 - A final results screen showing: score (X/N correct), percentage, pass/fail status (based on pass_rate threshold), time taken, longest streak, hints used, and a breakdown of missed questions with their citations274 - A "Print Study Guide" button on the results screen that triggers window.print() with a print-optimized stylesheet showing only missed questions, correct answers, explanations, and source citations275 - A "Print Certificate" button that triggers window.print() with a certificate view showing: quiz title, user score, pass/fail status, date completed, depth level, and a congratulatory message. Certificate uses clean typography suitable for printing.276 - Print-specific CSS (@media print) that hides interactive elements and formats content cleanly for PDF save277 - Responsive design (works on different screen widths)278 - Keyboard navigation (1-4 for options, Enter to advance, Escape to view citation)279 Use the quiz template in assets/quiz-template.html as the structural reference. Inject the questions JSON directly into the HTML as an embedded script variable.280 Validate: HTML file written to artifacts/ and is a single self-contained file. No external resource references.281 If fails: Remove any CDN links. Inline all CSS and JS.2822832. [Agent] Open the HTML file in the session tab via open_in_session_tab.284 Validate: File opens without error.285 If fails: Check file path. Re-write if necessary.2862873. [Ask user] Present the quiz. Offer follow-up options:288 - "Would you like to adjust difficulty, add more questions, or quiz on a different section?"289 Validate: User responds or acknowledges.290 If fails: No action needed. Quiz is delivered.291292</Workflow - Render>293294</Instructions>295296<Resources>297298## Example Prompts299300These demonstrate how users invoke this skill. Use them to understand expected input patterns.301302**Sitemap-based quiz (primary pattern). User provides the sitemap URL directly:**303304> Using this sitemap, create me an L200 quiz on Amazon Quick. Cover all major features and capabilities for users. 20 questions, 30/70 T/F to MC split.305> Sitemap: https://docs.aws.amazon.com/quicksuite/latest/userguide/sitemap.xml306307**Single document, expert depth:**308309> Quiz me on ~/Desktop/architecture-whitepaper.pdf at L400. 15 questions, all multiple choice.310311**Deep research mode:**312313> Teach me about event-driven architectures on AWS. Do deep research. L300, 10 questions.314315**Multiple sources combined:**316317> Create a knowledge check from these resources:318> - ~/Downloads/serverless-whitepaper.pdf319> - https://aws.amazon.com/lambda/features/320> - https://aws.amazon.com/step-functions/321>322> L200, 12 questions, 50/50 split between true/false and multiple choice.323324**Minimal (defaults applied):**325326> Quiz me on Kubernetes networking basics.327328</Resources>