- MUST: Use @antfu/ni. Use
nito install,nr SCRIPT_NAMEto run.nunto uninstall. - MUST: Use TypeScript interfaces over types.
- MUST: Keep all types in the global scope.
- MUST: No inline imports unless nessessarty
- MUST: Use arrow functions over function declarations
- MUST: Default to NO comments. Only add a comment when the user explicitly asks, or when the "why" is truly non-obvious - browser quirks, platform bugs, performance tradeoffs, fragile internal patching, or counter-intuitive design decisions. Never add comments that restate what the code does or what a well-named function/variable already conveys. When in doubt, leave the comment out.
- Do not delete descriptive comments >3 lines without confirming with the user
- MUST: Use kebab-case for files
- MUST: Use descriptive names for variables (avoid shorthands, or 1-2 character names).
- Example: for .map(), you can use
innerXinstead ofx - Example: instead of
movedusedidPositionChange
- Example: for .map(), you can use
- MUST: Frequently re-evaluate and refactor variable names to be more accurate and descriptive.
- MUST: Do not type cast ("as") unless absolutely necessary
- MUST: Remove unused code and don't repeat yourself.
- MUST: Always search the codebase, think of many solutions, then implement the most elegant solution.
- MUST: Put all magic numbers in
constants.tsusingSCREAMING_SNAKE_CASEwith unit suffixes (_MS,_PX). - MUST: Put small, focused utility functions in
utils/with one utility per file. - MUST: Use Boolean over !!.
Run checks always before committing with:
pnpm test # runs tests
pnpm lint
pnpm typecheck # runs type checking
pnpm formatThis is a pnpm monorepo with packages/ (libraries, tools). No external services (databases, Docker, etc.) are required.
pnpm build must complete before pnpm test or pnpm lint. After modifying source files, always rebuild before running tests.
See root package.json scripts for the full list. Quick reference:
- Install:
ni(orpnpm install) - Build:
nr build(orpnpm build) - Dev watch:
nr dev(orpnpm dev) - watches packages - Test:
pnpm test- runs tests - Lint:
pnpm lint- oxlint - Typecheck:
pnpm typecheck- tsc - Format:
pnpm format- oxfmt