AlexandrAI AGENTS.md
agents-md

AlexandrAI Tools Stopwatch Agent Guide

Agent guide for formatting elapsed milliseconds as HH:MM:SS centiseconds.

AGENTS.md

Guidance for coding agents working on AlexandrAI Tools Stopwatch in the alexandrai-tools project.

Project overview

This guide covers src/tools/stopwatch/index.ts. The tool formats elapsed milliseconds by clamping negative values to zero, flooring to centiseconds, deriving seconds, minutes, and hours, and returning HH:MM:SS.cs output.

Primary source files

  • src/tools/stopwatch/index.ts defines meta and formatDuration.
  • src/tools/stopwatch/index.test.ts covers zero, sub-second values, one second, minutes, hours, negative clamp, and partial-centisecond flooring.
  • src/tools/stopwatch/Body.astro owns running state and laps.
  • src/tools/stopwatch/i18n.ts owns localized copy.
  • src/lib/tools.ts registers metadata.

Setup commands

npm install npm test npm run typecheck npm run build npm run dev

Change rules

  • Clamp negative elapsed milliseconds to zero.
  • Floor milliseconds to centiseconds by dividing by ten.
  • Keep centiseconds as two digits after a dot.
  • Pad hours, minutes, and seconds to two digits.
  • Do not round partial centiseconds upward.
  • Keep lap state out of pure formatting unless a separate pure helper is introduced.
  • If hour overflow display changes, update format tests first.

Testing

Test zero, sub-second values, exact seconds, minute boundaries, hour boundaries, negative milliseconds, partial-centisecond flooring, large elapsed values, and UI lap capture separately from formatting.

PR checklist

  • npm test passes for stopwatch.
  • Timezone, UTC, and rounding behavior remain documented.
  • Invalid-input behavior is covered by tests.
  • UI labels, metadata, and pure date or time logic stay in sync.