AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Palindrome Checker in the alexandrai-tools project.
Project overview
This guide covers src/tools/palindrome-checker. isPalindrome defaults to ignoring case and non-alphanumeric ASCII characters, treats empty normalized strings as palindromes, and otherwise compares the normalized string with its reversed form. Options can preserve case sensitivity or keep punctuation and spaces.
Primary source files
- src/tools/palindrome-checker/index.ts defines meta, PalindromeOptions, and isPalindrome.
- src/tools/palindrome-checker/index.test.ts covers classic phrases, non-palindromes, single characters, empty strings, punctuation-only strings, case-sensitive mode, keep-non-alphanumeric mode, numeric palindromes, and phrase punctuation.
- src/tools/palindrome-checker/Body.astro owns text input, option toggles, and result display.
- src/tools/palindrome-checker/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
- Default ignoreCase to true.
- Default ignoreNonAlnum to true.
- When ignoreNonAlnum is true, keep only ASCII letters and digits.
- When ignoreCase is true, lowercase before comparison.
- Return true for empty normalized strings.
- Compare by reversing the normalized string.
- Add tests before expanding normalization beyond ASCII alphanumeric characters.
Testing
Test phrases, words, numbers, empty input, punctuation-only input, case-sensitive mode, punctuation-preserving mode, mixed options, Unicode behavior if added, and UI result labels.
PR checklist
- npm test passes for palindrome-checker.
- Pure helper behavior and UI state remain aligned.
- Invalid input and edge cases are documented and tested.
- Privacy and estimate-scope copy stays visible where relevant.