A full-featured CRM built with React, shadcn/ui, and Supabase.
feat: Improve Agentic Factory
erwanMarmelabc8ee04619c90
diff --git a/.claude/agents/developer.md b/.claude/agents/developer.mdindex dfb31ba8..e1fdd124 100644--- a/.claude/agents/developer.md+++ b/.claude/agents/developer.md@@ -185,6 +185,8 @@ e2e tests:(or: not required — reason from acceptance_criteria)```+**Keep files small — extract, don't grow.** When a change would push a file past the ~400-line typical ceiling (`coding-style.md`), create a new focused module and import it instead of appending to the existing file. Splitting a large file you already have to touch is in-scope, not scope creep.+---## Implementation rulesdiff --git a/.claude/agents/quality-reviewer.md b/.claude/agents/quality-reviewer.mdindex 7439638f..ddce9bcd 100644--- a/.claude/agents/quality-reviewer.md+++ b/.claude/agents/quality-reviewer.md@@ -159,6 +159,7 @@ Any `[FAIL]` → BLOCKED. Omitting a criterion from the list is itself a bug.### A.4 Code quality (WARNING)- Functions > 50 lines → split- Files > 800 lines → extract+- A diff that grows a file already past ~400 lines by appending, where a new focused module was the natural home → flag (extract, don't grow)- Deep nesting > 4 levels → early returns- No `console.log` outside conditional debug- No dead code, unused imports, commented-out code@@ -224,6 +225,8 @@ Flag only issues with a realistic attack vector.- Policies use `auth.jwt() ->> 'role'` or `auth.uid()` — never `USING (true)` in production- No table with RLS enabled but zero policies- Roles match the project's `user_roles`+- `WITH CHECK` constrains **every** field a non-admin can set (`status`, `type`, amounts, flags) — not just ownership. Ownership-only `WITH CHECK` = privilege escalation (caller forges other columns via PostgREST)+- Row-counting enforcement (capacity/quota/balance) is `SECURITY DEFINER` — a `SECURITY INVOKER` count runs under caller RLS, under-counts, and the limit never fires### B.2 Secrets & env vars (BLOCKING)- No service_role key or secret in client-side codediff --git a/.claude/rules/coding-style.md b/.claude/rules/coding-style.mdindex f4a7168e..f440d66c 100644--- a/.claude/rules/coding-style.md+++ b/.claude/rules/coding-style.md@@ -32,6 +32,9 @@ Many small files over few large files:- High cohesion, low coupling- Organize by feature/domain, not by type- Extract utilities from large modules+- Grow the file *count*, not the file: when an edit would push a file past+ the ~400-line typical ceiling, extract a new focused module instead of+ appending to the existing one## Error handlingdiff --git a/.claude/skills/backend-dev/SKILL.md b/.claude/skills/backend-dev/SKILL.mdindex 72d4a9fa..f0346353 100644--- a/.claude/skills/backend-dev/SKILL.md+++ b/.claude/skills/backend-dev/SKILL.md@@ -19,3 +19,7 @@ Edge function conventions:Other conventions:- New tables need RLS policies and the auto-set `sales_id` trigger (see migration `20260108160722`)++RLS enforcement pitfalls (security-critical):+- A trigger/function that **counts rows to enforce a limit** (capacity, quota, balance, subscription depletion) must be `SECURITY DEFINER` with a fixed `search_path`, or delegate to one. A `SECURITY INVOKER` count runs under the caller's RLS, sees only the rows that caller may read, under-counts, and the limit silently never fires (e.g. `session_booked_count` is DEFINER for exactly this reason).+- A `WITH CHECK` clause must constrain **every column a non-admin may set**, not just ownership. `with check (contact_id = current_user_contact())` alone lets the caller forge any other column (`status`, `type`, amounts, flags) via PostgREST — privilege escalation / payment bypass. Whitelist allowed values in the policy, a trigger, or a `CHECK` constraint; never trust a client-chosen `status`/`type`.