- Package manager: Yarn. Run all commands using
yarn(e.g.,yarn tsc,yarn tsx script.ts). - Install deps:
yarn
- If JavaScript, TypeScript, or JSON files are modified, run:
yarn tsbuildfor typechecking.- Ensure type check passes.
- After any changes, check if
README.mdneeds updating (e.g., new files, changed APIs, modified project structure, new CLI options).
- TypeScript strict mode
- Use functional patterns where possible
- Prefer
.map(),.filter(),.flatMap(),.reduce()overforloops - Avoid mutable variables; prefer
constwith transformations - Use Remeda for cleaner functional programming (e.g.,
R.mapValues(),R.groupBy(),R.pipe()) - Fail early with explicit errors rather than excessive optional chaining; throw when data should exist
- Prefer declaring functions so helpers used later appear above their call sites.
- Use the LSP tool freely when working with TypeScript files for code intelligence (go to definition, find references, hover for type info, document symbols, call hierarchies, etc.)
Follow this structure for React components:
import {FC} from "react";
import tiwi from "tiwi";
//
// Props.
//
interface MyComponentProps {
// ...
}
//
// Style.
//
const Layout = tiwi.div`
// Tailwind classes
`;
//
// Component.
//
export const MyComponent: FC<MyComponentProps> = props => {
// ...
};- Use
tiwifor styling (Tailwind-in-JS) - Organize sections in order: Props, Style, Component
- Use comment separators (
// Props.,// Style.,// Component.) - React Compiler is enabled; do not use
useMemooruseCallbackas the compiler handles memoization automatically
- Test runner: Vitest. Run tests with
yarn testoryarn test:watch. - Place test files in a
__tests__folder at the same level as the file being tested. - Use
.test.tssuffix for test files. - Example: Tests for
src/helpers/hash.tsgo insrc/helpers/__tests__/hash.test.ts.
- Do not add co-author lines to commit messages.
- NEVER run
git checkout -- <file>orgit restore <file>without first runninggit diffon that file and confirming the changes to discard with the user. There may be unrelated working changes that must not be lost.
- We only target Node 25 or newer. No need for legacy compatibility.