AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Waist To Hip Ratio in the alexandrai-tools project.
Project overview
This guide covers src/tools/waist-to-hip-ratio. calcWhr divides waist by hip, rounds to two decimals, and returns zero when hip is not positive. whrRisk applies sex-specific WHO-style threshold bands, and inToCm converts inches to centimetres.
Primary source files
- src/tools/waist-to-hip-ratio/index.ts defines meta, Sex, WhrRisk, calcWhr, whrRisk, and inToCm.
- src/tools/waist-to-hip-ratio/index.test.ts covers ratio math, rounding, zero hip, female thresholds, male thresholds, and inch conversion.
- src/tools/waist-to-hip-ratio/Body.astro owns measurement inputs, unit handling, sex selection, and risk display.
- src/tools/waist-to-hip-ratio/i18n.ts owns localized labels.
- 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
- Return zero when hip measurement is zero or negative.
- Round WHR to two decimals.
- Use female thresholds: below 0.80 Low, 0.80 through 0.85 Moderate, above 0.85 High.
- Use male thresholds: below 0.90 Low, 0.90 through 0.95 Moderate, above 0.95 High.
- Keep inch to centimetre conversion as inches times 2.54.
- Keep measurement units outside the pure ratio helper.
- Do not present risk labels as a medical diagnosis.
Testing
Test ratio rounding, zero hip, negative UI inputs, all female threshold edges, all male threshold edges, inch conversion, unit switching, and health disclaimer copy.
PR checklist
- npm test passes for waist-to-hip-ratio.
- Calculator formulas, units, and rounding rules are documented.
- Health and fitness outputs keep informational safety scope.
- UI labels, validation, and pure helper tests stay aligned.