Skip to main content

audit-hooks

Audit & fix hooks and API usage patterns — eliminate server actions, raw fetch, and stale patterns

소스 정보

저장소
trycompai/comp
최근 소스 활동
2026년 4월 27일 13:56
감지된 SKILL.md 언어
영어
스타
2,074
포크
441

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
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.** ## Forbidden Patterns (fix immediately) 1. **`useAction` from `next-safe-action`** → replace with SWR hook or custom mutation hook 2. **Server actions mutating via `@db`** → delete and use API hook instead 3. **Direct `@db` in client components** → replace with `apiClient` via hook 4. **Direct `@db` in Next.js pages for mutations** → replace with `serverApi` 5. **Raw `fetch()` without `credentials: 'include'`** → use `apiClient` 6. **`window.location.reload()` after mutations** → use SWR `mutate()` 7. **`router.refresh()` after mutations** → use SWR `mutate()` 8. **`useEffect` + `apiClient.get` for data fetching** → replace with `useSWR` 9. **Callback props for data refresh** (`onXxxAdded`, `onSuccess`) → remove, rely on SWR cache sharing ## Required Patterns - **Client data fetching**: `useSWR` with `apiClient` or custom hook - **Client mutations**: custom hooks wrapping `apiClient` with `mutate()` for cache invalidation - **Server components**: `serverApi` from `apps/app/src/lib/api-server.ts` - **SWR**: `fallbackData` for SSR data, `revalidateOnMount: !initialData` - **API response**: lists = `response.data.data`, single = `response.data` - **`mutate()` safety**: guard against `undefined` in optimistic update functions - **`Array.isArray()` checks**: when consuming SWR data that could be stale ## Process 1. Read files specified in `$ARGUMENTS` 2. Find forbidden patterns and fix them 3. Ensure all data fetching uses SWR hooks 4. Run typecheck to verify: `bunx turbo run typecheck --filter=@trycompai/app`
GitHub에서 보기