A full-featured CRM built with React, shadcn/ui, and Supabase.
Harness planning + test-authoring rules (audit D10, A1, A2)
Jerome086ca939f5f4
diff --git a/.claude/agents/orchestrator.md b/.claude/agents/orchestrator.mdindex d1ad29f0..dcd7b41e 100644--- a/.claude/agents/orchestrator.md+++ b/.claude/agents/orchestrator.md@@ -65,6 +65,8 @@ SIMPLE vs COMPLEX is a routing decision you own — the `developer` itself has n**NOT SIMPLE (push to COMPLEX):** "Add an 'industry' field importable from CSV" (import); "Add a 'manager' relation to contacts" (cross-entity); "Add a tags field with its own table" (new entity); "Add two fields" (multiple); "Add a date-range filter with a calendar picker" (new custom component).+**Classify by RISK and SCOPE, not raw file count (audit A1).** The SIMPLE ceiling is "contained and low-risk", not "one file". A pre-diagnosed, cohesive change with no schema change, no import/export, no new component and no cross-entity relation stays SIMPLE even when it spans ~2-3 files (e.g. a localized bug fix, or a flaky-test fix that is already diagnosed). File count is a signal, not the rule: do not force COMPLEX just because a well-understood change touches more than one file. When the scope or risk is genuinely uncertain, still push to COMPLEX.+When the SETUP signal is ambiguous (e.g. *"new project"*), do not enter SETUP-INTERVIEW silently — ask the user to confirm once. Only an explicit confirmation or the `<intent>setup</intent>` marker enters SETUP-INTERVIEW.### Blocking during SETUP-INTERVIEWdiff --git a/.claude/agents/planner.md b/.claude/agents/planner.mdindex 131344b7..1b0f9c59 100644--- a/.claude/agents/planner.md+++ b/.claude/agents/planner.md@@ -106,6 +106,8 @@ Rules:Normal feature tickets (type / component / config prop) → `parallel_safe: true`.+**Derive `parallel_safe` from REAL file overlap, schema files included (audit A2).** Set it `false` whenever two tickets would edit the SAME file, especially a schema file (`supabase/schemas/01_tables.sql`, `03_views.sql`, ...): two tickets each adding a column to the same table race and produce duplicate or conflicting DDL (this once shipped a duplicate `leads.form_token` column to prod). If `files_to_modify` undercounts the shared schema file, the overlap is invisible and both tickets wrongly look safe, so compute overlap from the FULL `files_to_modify` (see the checklist below), not the primary source file alone.+**`branch_name`**: descriptive only — a human-readable label, `<TICKET_ID>-<short-kebab>` (e.g. `TASK-002-deal-stage-filter`). It is NOT used as the git branch: the orchestrator always dispatches with the canonical `BRANCH_NAME: <SESSION_SHORT_ID>/TASK-XXX`, and `setup-worktree` derives the branch it creates solely from the ticket id (`<SESSION_SHORT_ID>/TASK-XXX`), ignoring any suffix. Keep it readable; never prefix with `feature/` or `fix/`.**`visual_customization`**: set `true` when the ticket touches colors, theme, component styling, dark/light mode, or layout preferences. The developer loads `Skill({skill: "shadcn-customization"})` as its first action on such tickets.@@ -118,6 +120,8 @@ Normal feature tickets (type / component / config prop) → `parallel_safe: true`files_to_modify` is a hint, not a contract. DEVELOPER may add/remove/substitute.+**List the FULL set, and ONLY files the ticket MODIFIES (audit A2).** Undercounting is what makes two tickets wrongly look `parallel_safe` when they share a file. For an entity / field change, include: the TS type, the schema file(s) (`supabase/schemas/*`), the view(s) it feeds (`03_views.sql`), i18n labels, the e2e spec, unit tests, and the 2nd-provider (FakeRest) parity files / generators, not just the primary component. A file the ticket only READS for reference goes in a separate `reference_files` array (or is omitted); never list a reference file as a target, since it corrupts the overlap and dependency computation.+## Step 4 — Persist tickets`TICKETS_DIR=<absolute path>` is in your spawn prompt — use the literal value.diff --git a/.claude/rules/testing.md b/.claude/rules/testing.mdindex d4a9898d..f2f31a39 100644--- a/.claude/rules/testing.md+++ b/.claude/rules/testing.md@@ -6,7 +6,32 @@ paths: []## Minimum coverage: 80%-New code paths without tests are a blocking issue in code review.+New code paths without tests are a blocking issue in code review. But coverage is a+FLOOR, not a target: never write a test just to reach the number (that is what produces+filler tests). Pertinence outranks the percentage.++## Pertinence: test behavior, not implementation++- Assert user-observable behavior / rendered output (Testing Library principle: "the more+ your tests resemble the way the software is used, the more confidence they give"). Never+ assert internal state, props, private methods, or merely that a mock was called.+- Weight toward integration for this React app (the Testing Trophy): a component with its+ real collaborators over many shallow unit tests. Never test the framework or a third-party+ library.+- Delete a test ONLY for lack of intrinsic value (cannot name a realistic bug it would catch,+ tautological, implementation-detail, snapshot-only, redundant with a better test), NEVER+ because "the code works now" or to cap the count: a passing test exists to guard FUTURE+ regressions. Shrink the suite by CONSOLIDATING redundancy, not by deleting coverage.+- Forbidden (blocking in review): asserting a mock returns its configured value; a snapshot+ as the primary assertion; reading component state / props / internals; a test written only+ to raise the coverage number.++## TDD orientation: acceptance-test-driven++- Derive each test from the ticket's `acceptance_criteria`; every test should map to a+ criterion or a user-visible behavior. A test with no traceable criterion is filler.+- Enforce the OUTCOME (behavior tests present and green), not literal red-green ordering+ (unverifiable when one agent writes both the test and the code).## Test structure — AAA pattern