This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Hamlearn is a web-based ham radio license exam practice application supporting Technician and General class exams. The application is a client-side JavaScript application with no build process - all files are served statically.
python3 -m http.server 8000Run in repository root to serve files at http://localhost:8000/. Required for fetch requests to work properly.
No automated tests - use manual testing:
- Complete full 35-question exam cycle
- Test navigation (Previous/Next buttons)
- Verify figure display and hints
- Test submission and score report
- Validate score calculations with various answer combinations
- Test "remove image questions" toggle functionality
HTML Files:
index.html- Entry point linking to license class optionstechnician.html- Main exam UI with embedded CSS and initialization scripts
JavaScript Modules (loaded in order):
app-utils.js- Utility functions for question parsing and exam generationpool.js- Question pool loader with fetch-based loading and cachingexam-app.js- Main exam application frameworkexams.js- Exam registry that configures Technician and General exams
- Initialization: URL query parameters determine exam type (technician or general)
- Pool Loading: Questions loaded from plain text files via fetch API
- Exam Generation: One question randomly selected from each group (35 groups total)
- Question Filtering: Optional removal of image-based questions for accessibility
Modular Architecture: Each JavaScript file exposes a global API object:
window.HAMLEARN_UTILS(app-utils.js)window.HAMLEARN_POOL(pool.js)window.createExamApp(exam-app.js)window.HAMLEARN_EXAMS(exams.js)
Question Pool Structure: Questions organized by subelement groups (e.g., T1A, T1B, etc.) with exactly one question selected per group per exam.
Figure Management: Images (T1, T2, T3 for Technician; G7-1 for General) automatically detected from question text and displayed when referenced.
Technician Pool.txt- FCC Technician class question pool (plain text format)General pool.txt- FCC General class question pool (plain text format)t1.jpg,t2.jpg,t3.jpg- Technician exam figuresG7.png- General exam figure
Question format: ID (CORRECT_ANSWER) [REFERENCE] followed by question text and A-D choices.
- HTML: 2-space indentation, semantic tags preferred
- CSS: Use existing custom properties on
:root, utility-style classes preferred over inline styles - JavaScript: Use
const/let, arrow functions for callbacks, descriptive helper names (e.g.,renderReport,clearReport) - Security: Always use
escapeHTML()utility before DOM injection to prevent XSS
- Use conventional succinct commit messages with imperative verb + scope (e.g., "Add score report table")
- Reference related issues in commit body when applicable
- For UI updates, include screenshots or GIFs in pull requests
- When updating FCC question pools, note the effective date and call out data changes
- Keep unused assets out of repository to maintain lightweight distribution
Each question follows this format:
[subelement][group][questionNum] [correct answer] [FCC rule (optional)]
Example: T1A01 (C) [97.1]
- Technician: 35 groups across 10 subelements (T1-T0), 1 question per group
- General: Same structure but 37/50 questions needed to pass (74%)
- Questions distributed among subelements with unique group identifiers
- Maintain unique question IDs to prevent duplicates
The exam builder (buildExamRun in app-utils.js) ensures:
- Exactly one question selected from each group
- Groups are shuffled to prevent predictable question order
- Figure filtering works at the group level when "remove image questions" is enabled
- No build process required - files served directly as static content
- Application works offline once loaded (questions embedded in JS)
- Question pools must maintain exact group structure for proper exam generation
- Opening
technician.htmldirectly from disk works because question pool is embedded - When FCC releases pool revisions, update JS bundle and note effective date