Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Add dev skills

François Zaninottocb7cde129e57
diff --git a/.claude/skills/backend-dev/SKILL.md b/.claude/skills/backend-dev/SKILL.md
new file mode 100644
index 00000000..72d4a9fa
--- /dev/null
+++ b/.claude/skills/backend-dev/SKILL.md
@@ -0,0 +1,21 @@
+---
+name: backend-dev
+description: Coding practices for backend development in Atomic CRM. Use when deciding whether backend logic is needed, or when creating/modifying database migrations, views, triggers, RLS policies, edge functions, or custom dataProvider methods that call Supabase APIs.
+---
+
+There is no custom backend server. All server-side logic uses Supabase: PostgreSQL (tables, views, triggers, RLS), Auth API, Storage, and Edge Functions.
+
+Prefer frontend-only solutions via custom dataProvider methods calling the PostgREST API.
+
+When backend logic is needed:
+
+- **Aggregation/read optimization**: Create a database view (`CREATE OR REPLACE VIEW` in a new migration). PostgREST exposes views like tables. When underlying table columns change, update the `contacts_summary` and `companies_summary` views too.
+- **Complex mutations** (multi-table writes): Create a Supabase edge function in Deno. Stored procedures via RPC are less preferred (code lives in migrations, harder to maintain). On the frontend, expose the edge function as a custom dataProvider method (using `httpClient(`${supabaseUrl}/functions/v1/<name>`)`) and call it via react-query. (e.g. `salesCreate()` → `/functions/v1/users`, `mergeContacts()` → `/functions/v1/merge_contacts`)
+
+Edge function conventions:
+- Shared utils in `supabase/functions/_shared/` — reuse `authentication.ts`, `supabaseAdmin.ts`, `cors.ts`, `utils.ts`
+- Follow the middleware chain pattern: CORS preflight → `authenticate()` → handler
+- `verify_jwt = false` in config.toml, so JWT validation is manual via `authenticate()`
+
+Other conventions:
+- New tables need RLS policies and the auto-set `sales_id` trigger (see migration `20260108160722`)
diff --git a/.claude/skills/frontend-dev/SKILL.md b/.claude/skills/frontend-dev/SKILL.md
new file mode 100644
index 00000000..60ca001f
--- /dev/null
+++ b/.claude/skills/frontend-dev/SKILL.md
@@ -0,0 +1,48 @@
+---
+name: frontend-dev
+description: Coding practices for frontend development in Atomic CRM. Use when creating or modifying React components, forms, list pages, detail views, filters, data fetching, or responsive layouts.
+---
+
+The frontend uses ra-core (react-admin headless) for data fetching, routing, and CRUD logic, with shadcn-admin-kit and shadcn/ui for the UI layer.
+
+## Component architecture
+
+- Import form inputs (`TextInput`, `SelectInput`, `ReferenceInput`, etc.) from `@/components/admin/`, not from shadcn/ui directly. The admin layer wraps shadcn with ra-core integration (labels, validation, data binding).
+- Import pure UI components (`Card`, `Button`, `Badge`, `Sheet`, etc.) from `@/components/ui/`.
+- Domain configuration (deal stages, note statuses, task types, company sectors) comes from `useConfigurationContext()`, never hardcoded.
+
+## Resource (CRUD) conventions
+
+Each resource follows this file structure (e.g. `contacts/`):
+
+- `ContactList.tsx` — list page (desktop + mobile variants)
+- `ContactShow.tsx` — detail view
+- `ContactEdit.tsx` / `ContactCreate.tsx` — form pages
+- `ContactInputs.tsx` — shared form fields reused between create and edit
+- `index.tsx` — exports `{ list, show, edit, create, recordRepresentation }`
+
+Resources are registered in `root/CRM.tsx` via `<Resource name="contacts" {...contacts} />`.
+
+## Data fetching
+
+- For standard CRUD, use ra-core hooks: `useListContext()`, `useShowContext()`, `useGetList()`, `useGetOne()`, `useGetIdentity()`.
+- When a query or mutation isn't covered by ra-core hooks, add a custom dataProvider method and call it via `useQuery`/`useMutation` with `useDataProvider<CrmDataProvider>()` (e.g. `dataProvider.getActivityLog()` in `ActivityLog.tsx`, `dataProvider.salesCreate()` in `SalesCreate.tsx`).
+
+## Forms
+
+- Forms use `Form` from ra-core + `FormToolbar` for submit/cancel actions.
+- Ra-core's `Form` uses React Hook Form under the hood. Use `useFormContext()` for imperative operations (`setValue`, `reset`, `getValues`).
+- Top-level resource forms use full-page `CreateBase`/`EditBase` with `Card` (e.g. contacts), or `Dialog` (e.g. deals).
+- On mobile, inline/sub-resource forms use `CreateSheet`/`EditSheet` from `misc/` (e.g. notes, tasks).
+- Split form fields into semantic sub-components (e.g. `ContactIdentityInputs`, `ContactPositionInputs`).
+
+## Filters
+
+- Use `ToggleFilterButton` / `ActiveFilterButton` components for filter UI.
+- Filters apply immediately, no "apply" button.
+
+## Responsive design
+
+- Major pages have desktop and mobile variants. Use `useIsMobile()` to branch.
+- Desktop: 2-column grid layouts. Mobile: single column with `MobileHeader`/`MobileContent`.
+- Mobile lists use `InfiniteListBase` for scroll pagination.
diff --git a/.gitignore b/.gitignore
index afd837e8..993d30b1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,9 +33,9 @@ dist/
/lib/
.env
*storybook.log
-.claude
# Shadcn Registry
public/r/
!supabase/functions/.env
+.claude/settings.local.json