Conventions
Follow the house rules for Next 16 code, the design system, money and ids, user-facing text and finishing UI work.
Updated November 22, 2026
These rules keep a small codebase consistent. Most are enforced by a lint rule or a test. The rest are review checks.
Next 16 is not the Next you know
The app runs Next 16.4. APIs, file conventions and defaults differ from older versions. Before you add a route, layout, metadata or data fetching, read the matching guide in apps/web/node_modules/next/dist/docs/ and follow its deprecation notices. AGENTS.md says the same; next dev re-adds that block, so leave it in the diff.
UI components
- Build screens from
@/components/app/dsfirst.components/app/ds/README.mdlists the canonical pieces:PageHeader,PageContainer,EntityListPage,EntityTable,FinancialWorksheet,StatusBadge,Money,EmptyState,NoAccess,ReturnHeader,StatTileand others. Extend a component there rather than forking it in a screen. - Lower-level parts come from
@workspace/ui/components/...: shadcn on Base UI, ReUI components (reui/…) and Pro blocks (blocks/…). Don't hand-roll something the kit already has. eslint.config.jsblocks two imports: the raw@workspace/ui/components/empty(useEmptyState) and@/components/app/ds/page-header(importPageHeaderfrom the barrel).- Use semantic tokens only, so dark mode comes from the tokens. State uses the Badge
-lightvariants. Spacing isgap-2within a row,gap-4between groups andgap-6between sections. Body text istext-sm, metatext-xs, nothing smaller. Numbers aretabular-nums. - One container family per screen: a Frame, never a Card inside it.
- Counts go through
count(n, one, other?)and amounts throughmoney()inlib/format.ts. Return status labels come only fromlib/return-status.ts.
Text in the product
- Write for an accountant in plain words: short sentences, active voice, the product's own labels.
- No boilerplate hint text. Add a one-line visible caption only where a layperson needs the specific reason for something, such as why a schedule is required.
- Error messages from the repository are shown verbatim as toasts, so write them as full sentences that say what to do ("Reopening needs a reason.").
Money, values and ids
- Amounts are
bigintcents (Centsinsrc/money.ts). Rates are exact fractions. Round once, with a pinned policy. Never usenumberfor money. - A field value is a
Value, so blank, zero, unknown, not applicable and blocked stay distinct. A blank is never silently 0 where a fact is needed: read it withneed(). - Field ids such as
t2.300ors125.9060are frozen keys. Saved inputs and locked versions use them, so never rename one. A CRA renumbering is a form revision or a filing-spec mapping. - Every law-dependent number lives in a parameter file with a citation, not in code. See Versioned parameters.
Comments and shortcuts
Comment the why the code can't show, in one line. A deliberate shortcut gets a comment in this form, so it can be found later:
Terminal
// shortcut: counts calendar years between year-ends, so extra short tax years are not counted; upgrade if the table gains a year count.Finishing UI work
- Add Playwright coverage for every new form or flow.A vitest unit test isn't enough for a form. Put the spec in
apps/web/e2eand use the fixtures ine2e/fixtures.ts. - Take screenshots at phone and desktop widths, in light and dark.Look at them before you call the work done. Layout bugs show up at the edges.
- Check accessibility.
e2e/a11y.spec.tsruns axe on the main screens. Add your page if it's new. - Add a changelog entry for anything a user will notice.See Reference pages.
Related
- ContributingBranch, change, check and open a pull request the way this repository expects, with the right extra steps for rules and UI changes.
- TestingRun the engine, web and Playwright suites, know what each covers, and add the right tests for a change without overloading your machine.
- ArchitectureSee how the web app, the tax engine and the UI kit fit together, where state lives, and what the prototype leaves out.