Working example + reusable specification
Reaction Time Test AI Coding Prompt
Build an accurate browser reaction test with explicit phases, monotonic timing, premature-input handling, performance classifications, and validated attempt history.
01 / What it builds
A complete interaction, not a loose concept
Copy a complete AI coding prompt for a visual reaction time test with accurate timing, early-click detection, statistics, accessibility, and tests.
- Monotonic millisecond timing
- Early-click detection and cancellation
- Average, best, and recent-attempt statistics
- Pointer, touch, and keyboard input
02 / Complete prompt
Copy the build specification
Project: Reaction Time Test Objective Build a complete visual reaction test that measures valid responses accurately, distinguishes premature input, summarizes performance, and preserves validated attempt history. Functional Requirements - Implement explicit Ready, Waiting, Green, and Result phases. - Start each signal after a random delay from 1.8 to 5 seconds. - Detect early input, cancel the pending signal, and show clear "Too early" feedback without recording an attempt. - Measure valid reactions in milliseconds using a monotonic browser clock. - Show latest time, rounded running average, best time, and the eight most recent attempts. - Classify results as Elite below 180 ms, Very Fast from 180โ219 ms, Average from 220โ280 ms, Below Average from 281โ350 ms, and Slow from 351 ms onward. - Persist validated attempt history in localStorage and provide Restart and Reset Stats actions. Technical Requirements - Use semantic HTML, responsive CSS, and vanilla JavaScript with native modules. - Keep timing rules and statistics independent from DOM, timer, audio, and storage effects. - Use a monotonic browser clock for elapsed-time measurement. - Cancel timers and timing state when restarting or leaving the game. Accessibility and Responsive Behavior - Support pointer, touch, and Space without accidental scrolling or repeated-key activation. - Include accessible live feedback, visible focus, reduced-motion support, and stable mobile and desktop layouts. Acceptance Criteria - Early input records no attempt and prevents the canceled signal from appearing later. - A valid result equals the elapsed monotonic time between signal presentation and accepted input. - Classification boundaries match the specified millisecond ranges exactly. - Statistics use only valid attempts and retain at most the eight most recent values. - Reloading restores valid history and rejects malformed persisted data. - Deterministic automated tests cover timing boundaries, classifications, early input, statistics, persistence, keyboard input, and lifecycle cleanup. Deliverables - The complete playable test as the primary experience, not a landing page. - Modular application source and focused automated tests. - Concise instructions for running and testing the project locally. Provided by www.my-ai-prompts.com