AlexandrAI AGENTS.md
agents-md

AlexandrAI Tools Power Converter Agent Guide

Agent guide for W, kW, MW, horsepower, and BTU/h conversion with seven significant figures.

AGENTS.md

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

Project overview

This guide covers src/tools/power-converter/index.ts. The tool converts W, kW, MW, hp, and BTU/h through a watt factor table, returns identity conversions unchanged, and rounds converted results to seven significant figures.

Primary source files

  • src/tools/power-converter/index.ts defines meta, UNITS, PowerUnit, TO_W, sigFig, and convert.
  • src/tools/power-converter/index.test.ts covers kW to W, MW to kW, hp to W, W to kW, kW to hp, and identity conversion.
  • src/tools/power-converter/Body.astro owns browser controls.
  • src/tools/power-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 W as the base unit.
  • Keep kW as 1000 W and MW as 1000000 W.
  • Keep hp as 745.69987158227022 W.
  • Keep BTU/h as 0.29307107017222 W.
  • Round converted values with seven significant figures.
  • Return same-unit values unchanged.
  • If metric prefixes are generalized, preserve current constants and labels.

Testing

Test 1 kW to 1000 W, 1 MW to 1000 kW, 1 hp to about 745.7 W, 1000 W to 1 kW, 1 kW to about 1.341 hp, BTU/h conversions, identity, zero, and sigFig behavior for very small outputs.

PR checklist

  • npm test passes for power-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.