---
name: supplementary-exercise-generator
description: >
  Use this skill whenever a user wants to generate supplementary exercises
  for a UOE textbook chapter — exercises that go beyond the in-chapter
  anchor-point exercises, deliberately incorporate interleaving with prior
  chapters, and are suitable for homework sets, online problem banks, or
  instructor-assigned practice. Triggers include: "generate supplementary
  exercises for Chapter N"; "create extra exercises"; "build a homework set";
  "add interleaved practice problems"; "make exercises that review prior
  chapters"; or any request to produce additional exercises beyond those
  embedded in the chapter text. Every generated exercise includes a complete
  model solution. For reviewing *existing* exercises, use the
  exercise-reviewer skill instead.
---

# Supplementary Exercise Generator

Generates a set of supplementary open-ended exercises for a UOE textbook
chapter, with complete model solutions. Supplementary exercises:

1. **Go beyond the in-chapter exercises** — they are not anchored to specific
   sections and can take a broader view of the whole chapter
2. **Build in interleaving** — they deliberately mix practice on prior-chapter
   concepts with current-chapter content, exploiting the interleaving effect
   from the learning sciences to improve long-term retention and transfer
3. **Use only taught tools** — every sub-part uses analytical methods,
   graph types, and concepts formally introduced in this chapter or earlier
4. **Include complete solutions** — every exercise is paired with a model
   solution detailed enough for an instructor to use as grading guidance

The target audience is US/North American students at two- and four-year
colleges, including students less prepared for CORE Economy 2.0 content.

---

## Critical Rules

**Rule 1 — Every exercise must include a complete model solution.**
The output document must contain a model solution immediately following each
exercise. There are no exceptions. A proposed exercise without a solution is
unusable and the output is incomplete.

**Rule 2 — Exercises may only use tools and concepts already taught.**
Every sub-part must be answerable using only tools, concepts, graph types,
and methods introduced in this chapter or a preceding chapter, as listed in
the prior-chapter-concepts reference file. Never introduce a new method
implicitly, even if it would make the exercise richer.

**Rule 3 — Interleaving is required, not optional.**
At least 30% of exercises (and no fewer than 2 exercises in a set of 6+)
must primarily engage concepts from a *prior* chapter, not the current one.
Label these exercises clearly with their interleaving target.

---

## Inputs

- **Chapter document** (required): `.docx` containing the chapter text.
  Used to identify the chapter's key concepts, section structure, and
  exercise anchor points already covered by in-chapter exercises.
- **In-chapter exercises document** (optional but recommended): `.docx`
  containing the existing in-chapter exercises. Used to avoid duplication
  and to identify coverage gaps that supplementary exercises should fill.
- **Verified figure data file** (optional): `.md` from the
  `chapter-figure-extractor` skill. Used to create accurate quantitative
  exercises referencing specific payoff or chart values.
- **Number of exercises** (optional, default: 6): How many supplementary
  exercises to generate. Each exercise typically has 3–5 sub-parts.
- **Prior-chapter concepts file** (built into skill): The reference file
  at `references/prior-chapter-concepts.md` in this skill's directory.
  Read this file during Step 2 to build the available toolkit.

---

## Output

A single downloadable `.docx` file named
`[ChapterN]_Supplementary_Exercises.docx`.

The document contains:
1. A brief introduction explaining how supplementary exercises relate to
   in-chapter exercises and how interleaving works
2. All generated exercises, numbered sequentially (S1, S2, S3, ...)
3. A model solution for each exercise, immediately following the exercise
4. A summary table at the end

---

## Workflow

### Step 1: Read all inputs

```bash
pandoc /mnt/user-data/uploads/CHAPTER_FILE -o /home/claude/chapter.md 2>/dev/null
# If exercises file provided:
pandoc /mnt/user-data/uploads/EXERCISES_FILE -o /home/claude/exercises.md 2>/dev/null
```

Also read the prior-chapter-concepts reference file:

```bash
cat /mnt/skills/supplementary-exercise-generator/references/prior-chapter-concepts.md
```

Read all inputs in full before generating any exercises.

### Step 2: Build the knowledge map

From the chapter, identify:

1. **Section structure and key concepts**: every section and its core ideas
2. **Exercise anchor points already covered**: which concepts the in-chapter
   exercises test (to avoid duplication)
3. **Coverage gaps**: important chapter concepts not tested by in-chapter
   exercises — these are prime candidates for supplementary exercises
4. **Available toolkit**: every analytical tool, graph type, method, and
   concept formally introduced in this chapter or any prior chapter. Use
   the prior-chapter-concepts reference file for prior chapters. Be explicit:
   list what IS available and note any closely related tools that are NOT
   (e.g., "Gini coefficient: YES; Lorenz curve: NO").

From the prior-chapter-concepts file, identify:

5. **Interleaving candidates**: concepts from prior chapters that connect
   naturally to current chapter content. Look for:
   - A prior-chapter model that can be re-applied in the current context
   - A prior-chapter concept that the current chapter implicitly extends
   - A comparison between a current-chapter result and a prior-chapter result
   - A prior-chapter graphical tool that can be read in a new context

### Step 3: Plan the exercise set

Design the set before writing any exercises. Plan:

- **Total exercises**: as requested (default 6)
- **Interleaving exercises**: at least 30% of the set (≥2 for a set of 6)
  These exercises draw primarily on a prior chapter, with a connection to
  current content
- **Current-chapter exercises**: exercises focused on current content,
  covering gaps left by in-chapter exercises and reaching higher Bloom's
  levels
- **Bloom's distribution**: aim for a mix across the set:
  - 1–2 exercises primarily at Apply / Analyse level
  - 1–2 exercises primarily at Evaluate / Create level
  - At least 1 exercise with a genuine open-ended / discussion sub-part
- **Sub-part types**: balance quantitative, analytical, and open-ended
  sub-parts across the set

Write out the plan before proceeding to Step 4. This ensures the set is
coherent and balanced before investing effort in individual exercises.

### Step 4: Draft each exercise

For each planned exercise:

#### 4a — Write the exercise

- Open with a brief context paragraph (1–3 sentences) that situates the
  student in a real-world or hypothetical scenario
- Write 3–5 sub-parts, labelled (a), (b), (c), etc.
- For interleaving exercises: clearly signal which prior-chapter concept
  is being revisited (e.g., "Recall from Chapter 4 that...")
- Ensure sub-parts scaffold logically: earlier parts set up later parts
- For quantitative sub-parts: provide all necessary data within the exercise
  (do not require students to look up values)
- For open-ended sub-parts: specify what kind of answer is expected
  (e.g., "In 2–3 sentences, explain..." or "List two reasons and explain
  each briefly")

#### 4b — Check the content-constraint

Before writing the solution, verify each sub-part against the available
toolkit. Ask: "Can a student answer this using only what they have been
taught?"

Red flags to catch:
- Requiring a graph type not yet introduced
- Requiring calculus in a chapter that uses diagrams and arithmetic
- Requiring the Lorenz curve (excluded from Chapter 5)
- Using "Nash equilibrium" instead of "best-response equilibrium"
- Requiring knowledge from a chapter not yet reached

If a sub-part fails the content-constraint check, revise it before writing
the solution.

#### 4c — Write the model solution

Write a complete model solution for the exercise:

- Answer every sub-part fully
- For quantitative sub-parts: show the full working, not just the answer
- For analytical sub-parts: explain the reasoning, not just the conclusion
- For open-ended sub-parts: provide a model answer detailed enough for
  grading, while noting that legitimate student variation is expected
- Mark grading-sensitive points (where partial credit might apply) with
  a brief note for the instructor
- Do not abbreviate or skip steps — this is for instructor use, not students

#### 4d — Classify the exercise

For the summary table, record:
- **Type**: Current-chapter / Interleaving (+ which prior chapter)
- **Bloom's level**: dominant cognitive level of the exercise as a whole
- **Sub-part types**: Quantitative / Analytical / Open-ended (list all present)
- **Key concepts tested**: brief list

### Step 5: Review the full set

After drafting all exercises, review them as a set:

- **Coverage**: do the exercises collectively address the chapter's main
  concepts and the coverage gaps from Step 2?
- **Interleaving**: is the 30% / 2-exercise minimum met? Are the interleaving
  connections natural and meaningful (not forced)?
- **Bloom's distribution**: does the set include both lower-order and
  higher-order sub-parts?
- **Content-constraint compliance**: does every sub-part pass the toolkit check?
- **Solution completeness**: does every exercise have a complete model solution?
- **Difficulty calibration**: are exercises accessible to less-prepared
  US students while still being substantive?

Revise any exercise that fails these checks before producing the output.

### Step 6: Produce the output document

Build the document following the Output Format below. Read
`/mnt/skills/public/docx/SKILL.md` before writing any code.

**Final check before presenting:**
Scan every exercise in the output. Confirm each is immediately followed by
its model solution. If any exercise is missing a solution, add it before
calling `present_files`.

---

## Output Format

Produce the document as a `.docx` file using the `docx` npm library.

### Document structure

```
Title: Chapter N Supplementary Exercises
Subtitle: For instructor use — includes model solutions

[Introduction paragraph — see below]

Exercise S1 — [brief title]
[Context paragraph]
[Sub-parts (a), (b), (c)...]

Model Solution: Exercise S1
[(a) solution...]
[(b) solution...]
[(c) solution...]

[Repeat for S2, S3, ...]

Summary Table
```

### Introduction paragraph

Include a brief introduction (3–5 sentences) explaining:
- These exercises supplement (not replace) the in-chapter exercises
- Some exercises revisit concepts from prior chapters — this is intentional,
  as interleaving prior and current material improves long-term retention
- Solutions are provided for instructor use and should not be distributed
  to students before the exercises are completed

### Colour-coded boxes

| Box type | Fill colour | Use for |
|---|---|---|
| Exercise box | `E3F2FD` (light blue) | Exercise text (question) |
| Interleaving label | `FFF8E1` (light amber) | Label at top of interleaving exercises: "Interleaving exercise — revisits Chapter N: [concept]" |
| Solution box | `FFFDE7` (light yellow) | Model solution for each exercise |

### Exercise header format

```
Exercise S[N] — [brief title describing main concept tested]
Type: [Current-chapter / Interleaving — Chapter N]
Bloom's level: [dominant level]
Sub-part types: [Quantitative / Analytical / Open-ended]
```

Use the `E3F2FD` box for all exercise content.

For interleaving exercises, add an amber label box immediately before the
exercise box:
```
Interleaving exercise — this exercise revisits [concept] from Chapter [N].
Students who have not yet reviewed Chapter [N] may want to do so first.
```

### Summary table

Include a summary table at the end with columns:
- Exercise (S1, S2, ...)
- Type (Current-chapter / Interleaving Ch. N)
- Main concepts tested
- Bloom's level
- Sub-part types

Use alternating row shading (`EBF3FB` / `FFFFFF`) and a dark header row
(`1F3864` with white text).

---

## Reference: docx generation

Read `/mnt/skills/public/docx/SKILL.md` before writing any code. Key rules:
- `WidthType.DXA` always (never `WidthType.PERCENTAGE`)
- `ShadingType.CLEAR` for all cell shading (never SOLID)
- Never use `\n` inside text runs — use separate Paragraph elements
- US Letter page size: 12240 × 15840 DXA, 1440 DXA margins
- Validate with `python3 scripts/office/validate.py`

---

## Checklist reference

Use mentally during Steps 4–5. Do not include in output.

For each exercise:
- [ ] Context paragraph provided (situates student in a scenario)?
- [ ] 3–5 sub-parts, scaffolded logically?
- [ ] All required data provided within the exercise?
- [ ] Every sub-part passes the content-constraint check?
- [ ] If interleaving: connection to prior chapter is explicit and natural?
- [ ] Model solution immediately follows the exercise?
- [ ] Solution answers every sub-part fully?
- [ ] Solution shows working for quantitative sub-parts?
- [ ] Solution provides grading guidance for open-ended sub-parts?
- [ ] "Best-response equilibrium" used (not "Nash equilibrium")?
- [ ] US spelling throughout?

For the full set:
- [ ] ≥30% of exercises are interleaving exercises (min. 2 in a set of 6)?
- [ ] Coverage gaps from in-chapter exercises are addressed?
- [ ] Bloom's distribution includes lower- and higher-order exercises?
- [ ] Balance of quantitative, analytical, and open-ended across the set?
- [ ] Difficulty is accessible to less-prepared US students?

---

## Note on interleaving and the exercise-reviewer skill

The `exercise-reviewer` skill evaluates in-chapter exercises and notes
interleaving gaps. When it flags that interleaving is absent or partial,
the recommendation is to address that gap through supplementary exercises
generated by this skill. Together, the two skills cover the full exercise
ecosystem for a chapter:

- `exercise-reviewer` → evaluates and improves in-chapter exercises
- `supplementary-exercise-generator` → creates additional practice with
  deliberate interleaving and broader coverage

A complete interleaving assessment should consider both sets together.
