AlexandrAI AGENTS.md
agents-md

AlexandrAI Tools Simple Interest Agent Guide

Agent guide for principal-rate-time simple interest calculations.

AGENTS.md

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

Project overview

This guide covers src/tools/simple-interest/index.ts. The tool applies the simple interest formula with principal, annual percentage rate, and years, returning interest and total. It rejects non-positive principal, non-positive years, and negative rates by returning zeros.

Primary source files

  • src/tools/simple-interest/index.ts defines meta, SimpleInterestResult, and calcSimpleInterest.
  • src/tools/simple-interest/index.test.ts covers base formula, zero rate, one-year term, invalid principal, invalid years, negative rate, and fractional years.
  • src/tools/simple-interest/Body.astro owns browser inputs and result display.
  • src/tools/simple-interest/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 principal times annual rate divided by one hundred times years.
  • Return zeros for zero principal, negative principal, zero years, or negative rate.
  • Allow zero rate and return total equal to principal.
  • Allow fractional years when the UI passes them.
  • Keep display rounding outside pure calculation.
  • Do not call this compound interest or amortization.
  • Do not present output as borrowing or investing advice.

Testing

Test the formula identity, zero rate, fractional years, invalid principal, invalid years, negative rate, large values, and display rounding if changed.

PR checklist

  • npm test passes for simple-interest.
  • Pure calculation stays independent from UI formatting.
  • Browser-local behavior is preserved.
  • Copy does not present calculator output as personalized financial advice.