src/main.tsxbootstraps the React/Vite entry point, whilesrc/App.tsxrenders the cost estimator UI.- Domain logic lives in
src/lib/, with unit tests co-located as*.test.ts; shared test setup is insrc/test/setup.ts. src/index.csshosts Tailwind v4 directives (@import "tailwindcss";,@plugin "daisyui") plus DaisyUI theme hooks; TypeScript config remains intsconfig*.json.vite.config.tsregisters@tailwindcss/vitealongside the React SWC plugin and wires Vitest globals for browser-like testing.
- Install dependencies with
npm installafter cloning. - Install local git hooks once per clone with
npm run setup:hooks(enables pre-push validation). npm run devstarts the Vite dev server athttp://localhost:5173for live reloading.npm run buildtype-checks (tsc --noEmit) and emits a production bundle indist/.npm run previewserves the built bundle locally to verify deployment artifacts.npm run testruns the Vitest suite in a jsdom environment; append flags like--runInBandif diagnostics need isolation.npm run lintruns Biome for formatting/linting;npm run typecheckperforms type-driven checks via the TypeScript compiler.npm run validate:allruns the full completion gate (typecheck,lint,test,test:browser,test:e2e,build).
- Use TypeScript functional components; name React components and files in PascalCase (e.g.,
CostSummary.tsx) and utilities in camelCase (formatCurrency.ts). - Maintain 2-space indentation, double quotes, and trailing commas per Prettier defaults; rely on editor formatting and
npm run lintto catch type regressions. - Prefer Tailwind utility classes and DaisyUI primitives for styling; reserve
src/index.cssfor shared tokens,@themedefinitions, or global resets that Tailwind/DaisyUI cannot express inline.
- Place tests next to the code they cover as
moduleName.test.ts; use Vitest globals (e.g.,describe,expect) configured invite.config.ts. - Leverage
@testing-library/reacthelpers for component behavior andsrc/test/setup.tsfor shared mocks or extensions. - Cover calculator edge cases (zero values, large areas) and user interaction flows; ensure new logic includes deterministic assertions before merging.
- Bug fix policy: each production bug fix must add at least one regression test that fails on old behavior and passes with the fix.
- Test execution cadence:
- Do not automatically run tests after every implementation step or before an ordinary uncommitted handoff; repeated test runs slow down iteration.
- Run tests only when diagnosing a problem, when the user explicitly requests validation, or immediately before creating a commit.
- While diagnosing, run the smallest relevant targeted test command. Reserve the full completion gate for the final pre-commit run.
- If changes are handed off without a commit, state that tests were not run rather than running them automatically.
- Test run hygiene policy:
- Never start a new test command if a previous test process is still running.
- Before any new run, check for active test processes (for example
vitest,npm run test, Playwright) and either wait for completion or explicitly terminate the stale run first. - If a prior run hangs or does not finish, kill that run, identify the root cause (e.g., infinite loop, unresolved async handle, recursive render), fix it, and only then start the next run.
- Do not paper over hangs by repeatedly launching additional runs in parallel.
- Compose commits with short, imperative subjects (
Add halls summary row), mirroring existing Git history and keeping them under ~72 characters. - Document notable changes in the commit body or PR description, linking issues when relevant and noting any configuration updates.
- For PRs, provide a concise summary, test evidence (
npm run lint && npm run test), and UI screenshots or GIFs when visuals change. - Confirm all required commands pass locally and that builds remain warning-free prior to requesting review.
- Immediately before creating a commit, run the commands below once as the final completion gate:
npm run typechecknpm run lintnpm run test -- --runnpm run test:browsernpm run test:e2enpm run build
- Do not rerun this full gate for an uncommitted handoff unless the user explicitly asks for it or it is needed to diagnose a problem.
- If any pre-commit command fails or cannot run, do not create the commit and report the validation failure.
- Backward compatibility is not a requirement while the project is in pre-alpha.
- Before introducing a backward-incompatible change to persisted project data, import/export behavior, or public APIs, ask the user for explicit confirmation.
- This policy is temporary and should be removed when the project leaves pre-alpha.
- Tailwind 4 no longer uses a JS config; declare content sources, plugins, and DaisyUI customizations via the directives in
src/index.css. - When adding path aliases or environment variables, update both
tsconfig.jsonandvite.config.tsto keep runtime and tests aligned.
- Agentic tools should look for reusable workflows in
skills/<skill-name>/SKILL.md. - Use
skills/_template/SKILL.mdas the starting point for new skills and keep them short, task-focused, and validation-aware. - Dependency update policy: for any dependency upgrade/update, lockfile refresh, or npm audit remediation request, use
skills/dependency-updates/SKILL.md. - IMDF guardrail policy: for any IMDF schema, IMDF import/export, IMDF validation, or IMDF editor-field change, use
skills/imdf-schema-guardrail/SKILL.md. - IMDF quality gate: validation warnings/errors introduced by normal editing operations are bugs, are not acceptable, and must be covered by regression tests before merging.
- Any change incompatible with IMDF specifications is not acceptable and must be treated as a hard failure.