AlexandrAI AGENTS.md
agents-md

AlexandrAI Tools Ovulation Calculator Agent Guide

Agent guide for cycle-length ovulation estimates, fertile window dates, and next LMP calculation.

AGENTS.md

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

Project overview

This guide covers src/tools/ovulation-calculator. calcOvulation validates LMP string shape and an integer cycle length from 21 through 35 days, estimates ovulation as LMP plus cycle length minus 14 days, sets the fertile window from five days before ovulation through one day after, and estimates the next LMP as LMP plus cycle length.

Primary source files

  • src/tools/ovulation-calculator/index.ts defines meta, OvulationResult, addDays, isValidISO, and calcOvulation.
  • src/tools/ovulation-calculator/index.test.ts covers 28-day and 30-day cycles, fertile window start and end, next LMP, month boundaries, invalid LMP, out-of-range cycle lengths, and accepted boundaries.
  • src/tools/ovulation-calculator/Body.astro owns LMP input, cycle length input, and result display.
  • src/tools/ovulation-calculator/i18n.ts owns localized labels and health-scope copy.
  • src/lib/tools.ts registers the tool metadata.

Setup commands

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

Change rules

  • Accept only integer cycle lengths.
  • Accept cycle lengths from 21 through 35 days.
  • Estimate ovulation as LMP plus cycle length minus 14 days.
  • Set fertile window start to ovulation minus five days.
  • Set fertile window end to ovulation plus one day.
  • Set next LMP to LMP plus cycle length.
  • Do not present output as contraception or fertility medical advice.

Testing

Test valid cycle lengths, boundary cycle lengths, non-integer inputs, invalid LMP strings, month and year boundaries, fertile window dates, next LMP, and health-scope messaging.

PR checklist

  • npm test passes for ovulation-calculator.
  • Date, random, or hash behavior is documented exactly as implemented.
  • Health outputs remain framed as estimates, not medical decisions.
  • UI labels, validation, and pure helper tests stay aligned.