soroban-abacus-flashcards/apps/web/src/app/create/worksheets
Thomas Hallock a3409fff38 refactor: agent instructions Phase 1 + dark mode modal fixes
Dark mode improvements:
- Fix DeploymentInfoModal background, title, footer colors
- Fix badge contrast (StatusBadge, CodeBadge) with raw rgba/hex values
- Fix padding syntax (Panda CSS gotcha: '1 2' → '4px 8px')

Agent instructions refactoring:
- Slim CLAUDE.md from 1,531 to 1,148 lines (-25%)
- Create .claude/skills/database-migrations.md (consolidated skill)
- Create .claude/reference/panda-css.md (styling gotchas)
- Delete 40+ stale plan/status docs (16k+ lines removed)
- Consolidate duplicate migration sections
- Add skills/ and reference/ directory structure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 09:49:10 -06:00
..
__tests__ feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
addition feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
components Add constraint-guided example generation with variety improvements 2026-01-16 09:22:39 -06:00
constants feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
hooks feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
typstHelpers feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
utils feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
AI_GRADING_EXECUTIVE_SUMMARY.md
AI_MASTERY_ASSESSMENT_PLAN.md
CONFIG_SCHEMA_GUIDE.md
HYBRID_LAYOUT_PLAN.md feat(know-your-world): live crop updates and safe zone improvements 2025-11-28 19:46:23 -06:00
IMPLEMENTATION_PLAN_WITH_PANELS.md feat(know-your-world): live crop updates and safe zone improvements 2025-11-28 19:46:23 -06:00
IMPLEMENTATION_STATUS.md
LAYOUT_REDESIGN_PROPOSALS.md feat(know-your-world): live crop updates and safe zone improvements 2025-11-28 19:46:23 -06:00
MASTERY_DEPENDENCIES.md
MASTERY_EXECUTIVE_SUMMARY.md
MASTERY_PROGRESSION_EXAMPLE.md
MASTERY_REDESIGN_PLAN.md
MASTERY_SIMPLIFIED.md
MASTERY_SYSTEM_PLAN.md
MASTERY_UI_PLAN.md
MASTERY_V2_ARCHITECTURE.md
OPERATOR_SPECIFIC_SETTINGS.md feat(know-your-world): live crop updates and safe zone improvements 2025-11-28 19:46:23 -06:00
PROBLEM_GENERATION_ARCHITECTURE.md feat(know-your-world): live crop updates and safe zone improvements 2025-11-28 19:46:23 -06:00
PROMPTING_STRATEGY.md
PUBLICATION_PLAN.md
README.md feat(know-your-world): live crop updates and safe zone improvements 2025-11-28 19:46:23 -06:00
README_CONFIG_PERSISTENCE.md feat(know-your-world): live crop updates and safe zone improvements 2025-11-28 19:46:23 -06:00
REFACTORING_PLAN.md
SHARE_PERSISTENCE_FIX_PLAN.md feat(know-your-world): live crop updates and safe zone improvements 2025-11-28 19:46:23 -06:00
SMART_DIFFICULTY_SPEC.md
SUBTRACTION_AND_OPERATOR_PLAN.md
SUBTRACTION_SCAFFOLDING_ANALYSIS.md
Screenshot 2025-11-10 at 08.43.34.png
Screenshot 2025-11-10 at 08.43.43.png
Screenshot 2025-11-10 at 08.43.50.png
Screenshot 2025-11-10 at 08.55.31.png
Screenshot 2025-11-10 at 08.55.36.png
Screenshot 2025-11-10 at 08.55.42.png
Screenshot 2025-11-10 at 08.55.47.png
Screenshot 2025-11-10 at 08.55.52.png
Screenshot 2025-11-10 at 08.55.57.png
TWO_MODE_IMPLEMENTATION_PLAN.md
TWO_MODE_SYSTEM_PLAN.md
TYPST_HELPERS_REFACTOR_PLAN.md
USER_WARNING_IMPROVEMENTS.md feat(know-your-world): live crop updates and safe zone improvements 2025-11-28 19:46:23 -06:00
UX_EXECUTIVE_SUMMARY.md
UX_UI_PLAN.md
WORKSHEET_VIRTUALIZATION_PROPOSALS.md feat(know-your-world): live crop updates and safe zone improvements 2025-11-28 19:46:23 -06:00
complexityLevels.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
config-schemas.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
difficultyProfiles.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
displayRules.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
generatePreview.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
manualModePresets.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
masteryLogic.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
page.tsx feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
problemAnalysis.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
problemGenerator.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
progressionPath.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
qrCodeGenerator.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
skillMigration.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
skills.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
techniques.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
types.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
typstGenerator.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
typstHelpers.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00
validation.ts feat(vision): improve remote camera calibration UX 2026-01-15 10:51:59 -06:00

README.md

Worksheet Generator

Create customizable math worksheets with progressive difficulty, problem space validation, and Typst-powered PDF generation.

Features

  • Addition & Subtraction: Full support for multi-digit problems (1-5 digits)
  • Progressive Difficulty: Smart Mode automatically scales difficulty based on skill level
  • Problem Space Validation: Real-time warnings when configurations have limited unique problems
  • Typst Integration: High-quality PDF generation with customizable layouts
  • Display Rules: Configurable visual aids (carry boxes, ten frames, place-value colors, etc.)
  • Mastery System: Adaptive learning with skill tracking and progression

Quick Start

// Access the worksheet studio at /create/worksheets/addition
// Configure settings, preview problems, download PDF

Architecture Documentation

Core Systems

Problem Generation - PROBLEM_GENERATION_ARCHITECTURE.md

  • Complete technical documentation of problem generation algorithms
  • Two generation strategies: generate-all + shuffle (small spaces) vs retry-based (large spaces)
  • Problem space estimation and duplicate risk calculation
  • Edge cases: single-digit constraints, mixed mastery mode, subtraction borrowing
  • Performance considerations and testing guide

Quick Reference - .claude/PROBLEM_GENERATION.md

  • Fast lookup for developers and Claude Code
  • Strategy selection logic with code examples
  • Debugging commands and common modifications
  • Q&A troubleshooting section

UX Improvements - USER_WARNING_IMPROVEMENTS.md

  • Recommended UI enhancements for problem space warnings
  • Design mockups for config panel indicators
  • Implementation phases and component structure

Additional Documentation

Key Concepts

Problem Space

The "problem space" is the set of all unique problems possible given your constraints:

  • 1-digit 100% regrouping: Only 45 unique problems exist (e.g., 2+8, 3+7, 4+9...)
  • 2-digit mixed regrouping: ~4,000 unique problems
  • 3-digit problems: ~400,000 unique problems

Why it matters: Requesting more problems than exist in the space results in duplicates. The system warns you when this happens.

Generation Strategies

Generate-All + Shuffle (Small spaces < 10,000)

  • Enumerates all valid problems upfront
  • Shuffles deterministically
  • Zero retries, guaranteed coverage
  • Cycles through full set when requesting more than available

Retry-Based (Large spaces ≥ 10,000)

  • Randomly generates problems
  • Retries on duplicates (up to 100 times)
  • Allows some duplicates to prevent performance issues

Progressive Difficulty

Smart Mode - Automatically adjusts difficulty based on:

  • Student skill level (tracked via mastery system)
  • Previous performance
  • Target regrouping/borrowing probability

Manual Mode - You control:

  • Digit range (1-5 digits)
  • Regrouping/borrowing probability (0-100%)
  • Progressive vs constant difficulty

Common Edge Cases

Single-Digit 100% Regrouping

Problem: Only 45 unique problems where both operands are 0-9 and result requires carrying.

Solution:

  • Reduce pages to 1-2 (20-40 problems)
  • Lower regrouping to 50%
  • Increase to 2-digit problems

Mastery + Mixed Mode

Problem: Addition and subtraction use separate skill-based configs, making combined problem space estimation complex.

Solution: Validation is skipped for this mode. Each operator uses its own config independently.

Subtraction Multiple Borrowing

Problem: 1-2 digit subtraction cannot have 2+ borrow operations (mathematical impossibility).

Solution: System automatically falls back to single-borrow problems for these ranges.

File Structure

worksheets/
├── README.md (this file)
├── PROBLEM_GENERATION_ARCHITECTURE.md    # Technical deep-dive
├── USER_WARNING_IMPROVEMENTS.md          # UX enhancement plan
├── problemGenerator.ts                   # Core generation logic
├── utils/
│   └── validateProblemSpace.ts          # Space estimation
├── components/
│   ├── config-panel/                    # Configuration UI
│   └── worksheet-preview/               # Preview + warnings
│       ├── WorksheetPreviewContext.tsx  # Validation state
│       └── DuplicateWarningBanner.tsx   # Warning display
└── addition/
    ├── SMART_DIFFICULTY_SPEC.md         # Smart Mode spec
    └── page.tsx                         # Addition worksheet page

Testing

# Type check
npm run type-check

# Run all checks before committing
npm run pre-commit

See PROBLEM_GENERATION_ARCHITECTURE.md for comprehensive testing checklist.

Contributing

When modifying problem generation:

  1. Read PROBLEM_GENERATION_ARCHITECTURE.md for complete system understanding
  2. Check .claude/PROBLEM_GENERATION.md for quick reference
  3. Run the testing checklist
  4. Update inline comments if changing generation strategy
  5. Consider UX impact (see USER_WARNING_IMPROVEMENTS.md)

Parent: apps/web/README.md - Web application overview Abacus Component: packages/abacus-react/README.md - Abacus visualization library