AlexandrAI AGENTS.md
agents-md

AlexandrAI Tools Color Palette Generator Agent Guide

Agent guide for crypto-seeded HSL palette generation and count clamping.

AGENTS.md

Guidance for coding agents working on AlexandrAI Tools Color Palette Generator in the alexandrai-tools project.

Project overview

This guide covers src/tools/color-palette-generator/index.ts. The tool chooses a random starting hue with crypto.getRandomValues, spaces colors evenly around the HSL wheel, clamps palette size between one and one hundred, and converts each HSL color to six-digit hex.

Primary source files

  • src/tools/color-palette-generator/index.ts defines meta, private hslToHex, and generatePalette.
  • src/tools/color-palette-generator/index.test.ts covers requested counts, hex format, lower clamp, and randomness across calls.
  • src/tools/color-palette-generator/Body.astro owns browser controls.
  • src/tools/color-palette-generator/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

  • Use crypto.getRandomValues for the starting hue.
  • Clamp count to the established one through one hundred range.
  • Keep colors evenly spaced by 360 divided by count.
  • Keep saturation and lightness defaults stable unless tests and UI copy change.
  • Return valid lowercase hex strings.
  • Do not persist generated palettes unless a deliberate save feature is added.
  • When adding seed input, make deterministic and random modes explicit.

Testing

Test count clamping, output count, hex format, saturation and lightness options, random-start behavior, deterministic seed behavior if added, and browser crypto fallback if introduced.

PR checklist

  • npm test passes for color-palette-generator.
  • Pure string or color logic stays independent from DOM preview code.
  • Generated CSS remains copy-ready.
  • Browser-local behavior is preserved.