AGENTS.md
Guidance for coding agents working on AlexandrAI Tools converters and calculators.
Project Overview
Converters and calculators are pure-logic utilities wrapped in browser UI. The category includes unit conversion, data storage, speed, energy, power, pressure, shoe size, finance calculators, math solvers, date calculators, health calculators, and everyday estimators.
Project Map
- src/tools/unit-converter/index.ts defines unit groups, conversion constants, sigFig(), and convert().
- src/tools/data-storage-converter/index.ts, speed-converter/index.ts, energy-converter/index.ts, power-converter/index.ts, pressure-converter/index.ts, and shoe-size-converter/index.ts follow the converter pattern.
- src/tools/compound-interest/index.ts, savings-goal/index.ts, roi-calculator/index.ts, profit-margin-calculator/index.ts, and net-worth-calculator/index.ts cover finance calculations.
- src/tools/average-calculator/index.ts, quadratic-solver/index.ts, ratio-calculator/index.ts, and standard-deviation-calculator/index.ts cover math helpers.
- src/tools/*/index.test.ts files hold focused Vitest coverage.
Setup Commands
bashnpm test -- src/tools/unit-converter/index.test.ts src/tools/data-storage-converter/index.test.ts src/tools/average-calculator/index.test.ts
npm run typecheck
npm run build
Change Rules For Agents
- Keep calculation logic in index.ts and UI wiring in Body.astro.
- Keep unit constants explicit and traceable.
- Use deterministic rounding policies and test boundary cases.
- Validate negative, zero, blank, and non-finite inputs by tool domain.
- Do not use locale-formatted strings inside pure numeric functions.
- Keep financial calculators clear about estimates.
- Keep health calculators conservative and non-diagnostic.
- Add tests for every formula change.
Verification
bashnpm test -- src/tools/unit-converter/index.test.ts src/tools/data-storage-converter/index.test.ts src/tools/average-calculator/index.test.ts
npm run typecheck
Manual checks should cover unit category switching, invalid input, decimal precision, reset behavior, and copy/download actions where present.
Security Notes
Calculator inputs can be personal or financial. Keep processing local, avoid analytics payloads containing input values, and do not store user entries.
PR Checklist
- Formula changes have tests.
- Rounding policy is intentional.
- Pure logic stays DOM-free.
- UI copy avoids overclaiming.
- Typecheck and focused tests pass.