Last updated 2026-05-21
This repository ships with a .cursor/ tree that tells human developers and AI agents how to work here. Rules are standing policies; skills are procedural playbooks opened when a task matches their description. AGENTS.md at the repo root is the entry point — load the TDD and shadcn skills before touching next/.
AI architecture — data, tools, instructions
If you think AI is moving too fast, you are operating at the wrong abstraction layer. Every system reduces to three durable parts: data, tools, and instructions. Zoethales is built around that invariant layer — not around whichever multi-agent orchestration framework is fashionable this quarter.
| Layer | In this project | Why it endures |
|---|---|---|
| Data | PostgreSQL schema — companies, periods, statements, validated extractions (SQL over NoSQL) | Structured rows carry context; agents and developers perform better on explicit schema. |
| Tools | Folder upload, parsers, batch store, GCS blobs, review APIs, portfolio roll-up | Concrete capabilities with clear inputs and outputs. |
| Instructions | Intake context, prompts, .cursor/ rules & skills, human review gates | How agents and operators steer tools over the data. |
- Invariant layer — invest in clean data, well-scoped tools, and explicit instructions; that stack outlasts model and framework churn.
- No complex multi-agent frameworks — orchestration libraries change quickly; we avoid betting the product on them.
- Robust to change — swap a parser or model without rewiring the whole system when data model and tool boundaries stay stable.
- Wrong abstraction — chasing agent-framework features is a symptom of weak data discipline or unclear tool contracts.
- SQL over NoSQL — relational schema is structured; structured data carries more context for AI agents and developers alike.
Rules vs skills
| Kind | Location | Role |
|---|---|---|
| Rules | .cursor/rules/*.mdc | Always-on or glob-scoped policies (TDD default, shadcn-first, Make targets, site-docs sync). |
| Skills | .cursor/skills/*/SKILL.md | Step-by-step playbooks loaded at task start (TDD cycle, shadcn bootstrap, Cloud Run deploy, /docs updates). |
| Human index | README.md | Inventory of rules and skills; run instructions and architecture summary. |
| Agent index | AGENTS.md | Mandatory reads and bootstrap order for Cursor agents on this repo. |
Test-driven development
TDD is the default for every feature, bug fix, and behavior change under next/. Opt out only when a human explicitly skips it for a narrow task (throwaway spike, vendored-only edit).
- Iron law: no production code without a failing test first.
- Cycle: RED (write smallest failing test) → verify RED → GREEN (minimal pass) → verify GREEN → REFACTOR (only while green).
- Bug fixes: add a regression test that reproduces the symptom before fixing.
- Legacy code: pin current behavior with tests, then add a new failing test for the desired change.
- Completion bar: make test passes; you observed RED and GREEN, not just assumed them.
Stack and commands
| Item | Detail |
|---|---|
| Runner | Vitest + Vite (happy-dom/jsdom) under next/ |
| Test files | Co-located *.test.ts / *.test.tsx next to the unit under test |
| Full suite | make test from repo root |
| Scoped run | cd next && npx vitest run path/to/file.test.tsx |
| Assertions | Behavior (roles, text, outcomes) — not implementation trivia |
| Mocking | Only at seams (fetch, clocks, clipboard) |
Key TDD rules and skills
- Rule: .cursor/rules/test-driven-development.mdc — default red → green → refactor policy.
- Rule: .cursor/rules/tdd-frontend-react-vitest.mdc — Vitest conventions for next/**/*.{ts,tsx}.
- Rule: .cursor/rules/agent-preflight-tdd.mdc — load the TDD skill at task start; verify RED/GREEN.
- Skill: .cursor/skills/test-driven-development/SKILL.md — full agent checklist and rationalization guardrails.
UI and shadcn/ui
The Next.js app uses shadcn/ui as the default foundation for controls and layout. Compose and extend primitives before introducing custom base components. The app was bootstrapped with shadcn CLI preset b3lnmLrRg and the Next App Router template.
UI conventions
- Prefer existing @/components/ui/* primitives (Button, Card, Dialog, Table, Badge, etc.).
- Add new primitives via npx shadcn@latest add --cwd next <component> — not hand-rolled copies.
- Preserve accessibility semantics, variant props, and theming from shadcn defaults.
- Custom components only when requirements cannot be met by composition.
- Load .cursor/skills/shadcn-ui-design-basis/SKILL.md before UI work; obey .cursor/rules/shadcn-ui-first.mdc.
Sagard brand palette
Product chrome extends the shadcn token set with Sagard brand colors defined in next/app/globals.css:
| Token | Hex | Usage |
|---|---|---|
| sagard-navy | #11263e | Hero bands, dark section backgrounds |
| primary (burgundy) | #a8353a | Primary buttons, accents, focus rings |
| sagard-slate | #365876 | Secondary labels, muted hero copy |
- font-heading — display headings (batch titles, page heroes).
- font-sans — body copy and table text.
- Layout width — max-w-6xl content column with px-6 md:px-10 padding.
- Navigation — pill-shaped tab links in site-nav.tsx (Upload, Docs).
- Status badges — outline/destructive/default variants via status-display.ts helpers.
Thoughtful targeted UI/UX design
Beyond tokens and shadcn primitives, the app follows thoughtful targeted UI/UX: each route gets a Sagard-style full-bleed scenic hero (photography + navy gradient overlay + burgundy accent rule) like sagard.com hero-full sections, while dense tools stay on a light content band below the hero.
| Artifact | Role |
|---|---|
| PageHero | next/components/page-hero.tsx — reusable scenic hero; optional HeroStat grid in stats slot |
| page-heroes.ts | Maps upload / workflow / review / docs / portfolio variants to next/public/scenic/*.png |
| thoughtful-targeted-uiux-design.mdc | Cursor rule for agents — when to use compact heroes, per-route imagery, a11y |
| shadcn-ui-design-basis skill | Bootstrap + thoughtful UI/UX checklist alongside shadcn composition |
- Upload (/) — hero-upload.png; full-height hero, upload panel below.
- Batch workflow — hero-workflow.png; compact hero, progress table below.
- Document review — hero-review.png; compact hero, side-by-side review below.
- Docs (/docs/*) — hero-docs.jpg (nature landscape only, no people); compact hero; article body is blocks only (title lives in hero).
- Scenic policy — SCENIC_HERO_IMAGE_POLICY in page-heroes.ts; nature-only assets enforced by page-heroes.test.ts.
- Portfolio roll-up — PageHero portfolio variant with coverage stats in the stats slot.
Other agent policies
| Rule / skill | Summary |
|---|---|
| site-docs-sync.mdc + site-docs-sync skill | Update /docs in the same delivery when storage, workflow, or API behavior changes. |
| make-commands.mdc | Root Makefile exposes only make dev, make test, make deploy. |
| agent-git-workflow.mdc | Branch-first commits; Conventional Commits; no direct main commits. |
| refactor-and-code-roast.mdc | Roast-then-refactor under test guard. |
| nextjs-gcp-cloud-run skill | Cloud Build + Cloud Run deploy playbook. |
Agent checklist (before claiming done)
- Loaded TDD skill; wrote failing test(s) before production code.
- Ran tests and observed RED, then GREEN.
- make test passes for touched areas.
- For UI: reused or extended shadcn/ui primitives.
- For system changes: updated matching /docs section and site-docs tests.
