mit einem Klick
audit-hooks
// Audit & fix hooks and API usage patterns — eliminate server actions, raw fetch, and stale patterns
// Audit & fix hooks and API usage patterns — eliminate server actions, raw fetch, and stale patterns
| name | audit-hooks |
| description | Audit & fix hooks and API usage patterns — eliminate server actions, raw fetch, and stale patterns |
Audit the specified files for hook and API usage compliance. Fix every issue found immediately.
useAction from next-safe-action → replace with SWR hook or custom mutation hook@db → delete and use API hook instead@db in client components → replace with apiClient via hook@db in Next.js pages for mutations → replace with serverApifetch() without credentials: 'include' → use apiClientwindow.location.reload() after mutations → use SWR mutate()router.refresh() after mutations → use SWR mutate()useEffect + apiClient.get for data fetching → replace with useSWRonXxxAdded, onSuccess) → remove, rely on SWR cache sharinguseSWR with apiClient or custom hookapiClient with mutate() for cache invalidationserverApi from apps/app/src/lib/api-server.tsfallbackData for SSR data, revalidateOnMount: !initialDataresponse.data.data, single = response.datamutate() safety: guard against undefined in optimistic update functionsArray.isArray() checks: when consuming SWR data that could be stale$ARGUMENTSbunx turbo run typecheck --filter=@trycompai/appThe contract every new or modified API endpoint must follow so it is correct for the public OpenAPI spec, the MCP server (npm @trycompai/mcp-server), the ValidationPipe, and the docs. Triggers on "new endpoint", "add API", "new DTO", "@Body", "@RequirePermission", "MCP tool", "edit controller in apps/api", "OpenAPI", or whenever editing controllers under apps/api/src/.
MUST run after writing or modifying code — reviews changed files for verbose patterns, inconsistencies, and readability issues before considering work done
Use when changing Comp AI billing, Stripe products/prices, subscription checkout, org payment methods, entitlements, usage ledgers, invoices, or billing webhooks.
Audit & fix design system usage — migrate @trycompai/ui and lucide-react to @trycompai/design-system
Audit & fix RBAC and audit log compliance in API endpoints and frontend components
Audit & fix unit tests for permission-gated components