AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Debt To Income Ratio in the alexandrai-tools project.
Project overview
This guide covers src/tools/debt-to-income-ratio/index.ts. The tool returns monthly debt divided by gross monthly income times one hundred, returns zero when income is less than or equal to zero, and allows outputs above one hundred percent when debt exceeds income.
Primary source files
- src/tools/debt-to-income-ratio/index.ts defines meta and calcDTI.
- src/tools/debt-to-income-ratio/index.test.ts covers common DTI, zero debt, zero income, one hundred percent DTI, and debt above income.
- src/tools/debt-to-income-ratio/Body.astro owns browser controls.
- src/tools/debt-to-income-ratio/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
- Return zero when grossMonthlyIncome is less than or equal to zero.
- Compute DTI as monthlyDebt divided by grossMonthlyIncome times one hundred otherwise.
- Allow DTI above one hundred percent.
- Allow zero debt to return zero.
- Do not cap DTI output.
- Do not provide loan eligibility advice in pure logic.
- If lender thresholds are displayed, keep them separate from calcDTI and configurable.
Testing
Test common ratios, zero debt, zero income, negative income, debt equal to income, debt exceeding income, fractional inputs, negative debt if UI permits it, and any separate threshold display logic.
PR checklist
- npm test passes for debt-to-income-ratio.
- Formula, invalid-input policy, and rounding policy remain documented.
- Pure helpers stay arithmetic-only and browser-local.
- UI labels, metadata, and tests update together for behavior changes.