AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Number To Words in the alexandrai-tools project.
Project overview
This guide covers src/tools/number-to-words/index.ts. The tool converts trimmed numeric input to English words, supports negative prefixes, splits decimal parts and spells each decimal digit, supports integer chunks up to 999999999999, and returns a too-large message above that limit.
Primary source files
- src/tools/number-to-words/index.ts defines meta, ones, tens, scales, below1000, numberToWords, and intWordsFromInt.
- src/tools/number-to-words/index.test.ts covers zero, single digits, teens, tens, hundreds, thousands, millions, billions, negatives, decimal parts, blank input, and too-large input.
- src/tools/number-to-words/Body.astro owns browser controls.
- src/tools/number-to-words/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 an empty string for blank input or a lone minus sign.
- Prefix negative outputs with negative.
- Parse the integer part with parseInt base ten.
- Return an empty string when the integer part cannot be parsed.
- Return a too-large message above 999999999999.
- Spell decimal digits individually after point.
- Use hyphens for compound tens such as forty-two.
Testing
Test zero, ones, teens, tens, hundreds, thousands, millions, billions, maximum accepted value, too-large value, negatives, decimals, leading zeros, invalid input, blank input, and decimal digits that include zero.
PR checklist
- npm test passes for number-to-words.
- Validation, formatting, and numeric precision behavior remain documented.
- Pure helpers stay browser-local and side-effect free.
- UI labels, metadata, and tests update together for behavior changes.