AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Net Worth Calculator in the alexandrai-tools project.
Project overview
This guide covers src/tools/net-worth-calculator/index.ts. The tool is intentionally small: it returns totalAssets minus totalLiabilities without validation, clamping, or rounding. Positive, zero, and negative net worth are all valid arithmetic outputs.
Primary source files
- src/tools/net-worth-calculator/index.ts defines meta and calcNetWorth.
- src/tools/net-worth-calculator/index.test.ts covers positive net worth, zero net worth, negative net worth, and no-liability cases.
- src/tools/net-worth-calculator/Body.astro owns browser controls.
- src/tools/net-worth-calculator/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
- Compute net worth as totalAssets minus totalLiabilities.
- Do not clamp negative results.
- Do not round in pure logic.
- Keep validation in UI if required by product copy.
- Allow zero liabilities.
- Avoid financial advice in pure logic and labels.
- If asset categories are added, sum them before calling this helper or add a separate helper with tests.
Testing
Test assets greater than liabilities, assets equal liabilities, liabilities greater than assets, zero liabilities, zero assets, negative inputs if UI permits them, fractional values, and any future categorized asset/liability helper.
PR checklist
- npm test passes for net-worth-calculator.
- 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.