AlexandrAI AGENTS.md
agents-md

AlexandrAI Tools Speed Converter Agent Guide

Agent guide for m/s, km/h, mph, knots, and ft/s conversion through meters per second.

AGENTS.md

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

Project overview

This guide covers src/tools/speed-converter/index.ts. The tool supports m/s, km/h, mph, knots, and ft/s, returns identity conversions unchanged, and converts by multiplying through a meters-per-second factor table.

Primary source files

  • src/tools/speed-converter/index.ts defines meta, SpeedUnit, SPEED_UNITS, TO_MS, and convert.
  • src/tools/speed-converter/index.test.ts covers m/s to km/h, mph to km/h, km/h to m/s, knots to km/h, ft/s to m/s, and identity conversion.
  • src/tools/speed-converter/Body.astro owns browser controls.
  • src/tools/speed-converter/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

  • Use m/s as the base unit.
  • Keep km/h factor as one divided by 3.6.
  • Keep mph factor as 0.44704.
  • Keep knot factor as 0.514444.
  • Keep ft/s factor as 0.3048.
  • Do not round in pure convert; leave formatting to display code.
  • If new units are added, update SpeedUnit, SPEED_UNITS, factor table, UI options, and tests together.

Testing

Test 1 m/s to 3.6 km/h, 1 mph to about 1.60934 km/h, 1 km/h to 1/3.6 m/s, 1 knot to about 1.852 km/h, 1 ft/s to 0.3048 m/s, identity conversion, zero, negative speed if supported, and any new unit.

PR checklist

  • npm test passes for speed-converter.
  • Conversion constants remain traceable and tested.
  • Identity conversions and rounding behavior remain documented.
  • UI labels, unit arrays, and pure conversion logic stay in sync.