exercises-for-textbook-chapter

exercises-for-textbook-chapter is a command for Claude Code, Cursor from AI-Learning-Gems/AI-Learning-Gems.github.io. It costs 15 tokens per session (7,593 once invoked), scanned A, original, MIT.

A command workflow for adding interactive exercises to an existing textbook chapter. It creates activities that ask learners to recall, predict, arrange, or fill in answers and that can check their responses.

In plain words
What is it for?
Use it on a Quarto chapter to add section-by-section exercises for retrieval practice, generation, and formative assessment.
Why use it?
It turns finished reading material into practice without requiring the author to design each exercise manually, while preserving the chapter’s other content.

Command for Claude CodeCursor

Written for Cursor and Claude Code: installed under .cursor/, but also a Claude Code command (commands/*.md). Also seen: mentions subagents.

Good fit Use it on a Quarto chapter to add section-by-section exercises for retrieval…

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/ai-learning-gems/ai-learning-gems.github.io/exercises-for-textbook-chapter
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/AI-Learning-Gems/AI-Learning-Gems.github.io

Made for: Claude Code, Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for exercises-for-textbook-chapter

README.md
[![agentmods](https://agentmods.dev/badge/commands/ai-learning-gems/ai-learning-gems.github.io/exercises-for-textbook-chapter.svg)](https://agentmods.dev/commands/ai-learning-gems/ai-learning-gems.github.io/exercises-for-textbook-chapter)
Your own site
<a href="https://agentmods.dev/commands/ai-learning-gems/ai-learning-gems.github.io/exercises-for-textbook-chapter"><img src="https://agentmods.dev/badge/commands/ai-learning-gems/ai-learning-gems.github.io/exercises-for-textbook-chapter.svg" alt="Measured on agentmods" height="20"></a>
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 7,593 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00015 $0.07593
Opus 5 $0.00008 $0.03796
Sonnet 5 $0.00003 $0.01519
Haiku 4.5 $0.00002 $0.00759

Measured 7d ago against content hash 754f47d6840a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

exercises-for-textbook-chapter scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/commands/exercises-for-textbook-chapter.md · 547 lines

How it starts

The opening of the file, as written. The whole thing — 547 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an expert instructional designer adding verifiable interactive exercises to an already-written textbook chapter. The chapter has been through the research, writing, and editing workflows. Your job is to augment each section with exercises that maximize long-term retention through retrieval practice, generation, and formative assessment.

This workflow is idempotent. If exercises already exist in a section, remove all existing exercises (identified by the Quarto div classes .exercise-mcq, .exercise-predict, .exercise-order, .exercise-fillin) and replace them with fresh ones. Keep all other content (including .callout-warning "Common Misconception", .callout-note "Think Hard", .callout-tip, and Retrieval Practice Questions in the closing section) exactly as-is.

=== USER INPUT ===

The user will provide the path to the chapter's index .qmd file (e.g., Agentic Systems/LLM and VLM Agentic Systems.qmd). This file contains {{< include >}} statements pointing to all section files.

Your first step: Read the index file, identify all section files, then process them one by one.


=== EXECUTION CONTEXT ===

This prompt is designed for agentic execution. Execute the entire workflow autonomously without asking for user confirmation at any step.

Key principles:

  • No confirmation needed: Do NOT ask the user to confirm anything. Just execute.
  • File-based output: All edits go directly to the .qmd files, never the chat.
  • Incremental edits: Process one section at a time so the user can review progress.
  • Preserve content: NEVER change the meaning, technical accuracy, or structure of the existing chapter text. Only ADD exercises and REMOVE old exercise divs and old "Self-Explanation Prompt" and "Faded Example" blocks.

=== MANDATORY RULES RE-READ (Do This FIRST) ===

CRITICAL: You MUST read the following rules files from disk before starting any work. Do NOT assume you already know their contents from system prompt injection or prior context. Rules may have been updated since the chat started. Read each file in full using your file-reading tool.

Read ALL of these files now, before proceeding to Step 0:

# File to Read What It Contains When It Matters
1 exercise-syntax.md THE MOST CRITICAL FILE. Exact Quarto div syntax for all 4 exercise types, Pandoc AST pitfalls, what breaks the Lua filter Every single exercise you write
2 writing-style.md Tone, sentence rhythm, AI tell avoidance Writing feedback text inside exercises
3 quarto-conventions.md Callout syntax, heading levels Preserving existing callouts, avoiding structural damage

Per-section re-read (MANDATORY): Before processing EACH section file, re-read exercise-syntax.md in full. This is not a suggestion. The Lua filter is brittle: a single formatting mistake (options as paragraphs instead of bullet lists, letter prefixes on options, bold-wrapped fill-in blanks, LaTeX braces on the same line as fill-in syntax) will silently break the exercise. By the third section, you WILL have forgotten these pitfalls unless you re-read.


=== WHAT TO REMOVE (Cleanup) ===

Before adding new exercises to a section, remove these existing blocks:

REMOVE (replace with new exercises):

  • Any ::: {.exercise-mcq ...} blocks (old exercises from a previous run)
  • Any ::: {.exercise-predict ...} blocks
  • Any ::: {.exercise-order ...} blocks
  • Any ::: {.exercise-fillin} blocks
  • Any ::: {.callout-tip title="Self-Explanation Prompt..."} blocks
  • Any ::: {.callout-tip title="Faded Example..."} blocks

KEEP (do NOT touch):

  • ::: {.callout-warning title="Common Misconception: ..."} blocks
  • ::: {.callout-note title="Think Hard: ..."} blocks
  • ::: {.callout-tip title="Common Mistakes to Avoid"} blocks (in closing)
  • Retrieval Practice Questions (in closing section)
  • All other content, equations, figures, code cells, source headers, etc.

Read the full file on GitHub · 547 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 547 lines · 15 tokens per session scan A 754f47d6840a

Subscribe to this mod's changes

exercises-for-textbook-chapter is a command published in the GitHub repository AI-Learning-Gems/AI-Learning-Gems.github.io (22 stars, last pushed 3mo ago), licensed MIT. It adds 15 tokens to every session and 7,593 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.