This repository is optimised for collaboration with human developers and code-generating agents. Follow the checklist below to keep contributions consistent and automation-friendly.
- Read
docs/index.d.tsfirst. It lists every exported symbol with use cases, performance notes, and import paths. - Use
src/index.tsfor ESM imports. Category folders mirror the sections in the type definitions (procedural,spatial,ai, etc.). - Examples in
examples/show runnable TypeScript snippets for quick verification. - Find open work in
ROADMAP.md(milestones + checklists) and on the GitHub issue tracker. treat unchecked roadmap items or open issues as the authoritative task list; confirm scope with the current milestone before starting.
- Create a feature branch (
feature/<topic>). - For each feature/fix:
- Implement runtime code in
src/<category>/. - Update
docs/index.d.tswith the same structure (description, “Use for”, performance, import path). - Add or update tests in
tests/(Vitest) and, when applicable, a runnable example inexamples/.
- Implement runtime code in
- Update documentation touchpoints (
README.md,PROJECT_DESCRIPTION.md,ROADMAP.md) if scope or roadmap changes.- Mark relevant roadmap checkboxes and reference/close GitHub issues when tasks are delivered.
- Run the full quality gate before committing:
npm run lint npm run typecheck npm test npm run build - Commit changes atomically with descriptive messages (e.g.,
feat: add behaviour tree module). - Open a pull request targeting
main.
- YAGNI: deliver only what is needed for the active milestone or issue.
- DRY: centralise shared utilities/configuration; avoid copy/paste implementations.
- SOLID: keep modules cohesive with clear responsibilities and exported APIs.
- Assert + guard: assert internal invariants, validate external inputs, and surface friendly errors.
- Clear boundary: consumers interact through
src/index.tsexports and the contract documented indocs/index.d.ts. - Prefer early returns/guard clauses for readability.
- Keep functions small and well named; comment only when additional context adds value.
- Ship tests alongside code changes and ensure CI passes before merging.
- Use readable fixtures and golden files when they clarify behaviour.
- Use modern TypeScript, strict typing, and keep functions pure when possible.
- Provide rich JSDoc (description, “Useful for” line, typed params/returns, runnable
@examples). - Default to ASCII and keep comments concise.
- Prefer options objects for functions with more than three parameters.
- Handle edge cases gracefully; expose internal helpers through
__internalsonly when needed for testing.
- Every new algorithm must ship with unit coverage exercising typical and edge scenarios.
- When randomness is involved, use deterministic seeding to keep tests reproducible.
- Example snippets should run without external dependencies (Node 18+).
- Maintain consistent naming and file structure so LLMs can map
docs/index.d.tsdescriptions to actual implementations. - Provide narrative comments only for non-obvious logic; avoid redundant remarks.
- Keep exports centralised in
src/index.tsto simplify import instructions in prompts.
Following this playbook keeps the codebase predictable for both humans and automated agents.