AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Salary Converter in the alexandrai-tools project.
Project overview
This guide covers src/tools/salary-converter. convertSalary normalizes hourly, weekly, monthly, or annual input to annual pay using hours per week and weeks per year, then derives hourly, weekly, monthly, and annual values from that annual amount.
Primary source files
- src/tools/salary-converter/index.ts defines meta, SalaryInput, SalaryResult, and convertSalary.
- src/tools/salary-converter/index.test.ts covers annual to hourly, hourly to annual, monthly to annual, weekly to annual, consistency with custom weeks, and zero hours per week.
- src/tools/salary-converter/Body.astro owns amount, source period, hours, weeks, currency, and result display.
- src/tools/salary-converter/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
- Calculate total hours per year as hours per week times weeks per year.
- For hourly input, annualize by total hours per year.
- For weekly input, annualize by weeks per year.
- For monthly input, annualize by twelve.
- For annual input, use the value as-is.
- Return zero hourly pay when total hours per year is not positive.
- Return zero weekly pay when weeks per year is not positive.
Testing
Test all input periods, custom hours and weeks, zero hours, zero weeks, monthly derivation, annual consistency, negative UI input handling, currency display, and rounding policy.
PR checklist
- npm test passes for salary-converter.
- Calculator formulas, units, and rounding expectations are documented.
- Currency and display formatting remain outside pure helpers.
- Invalid-input behavior is covered by tests and UI validation.