跳到正文
cccskills
免费在 GitHub 公开

audit-hooks

Review specified files for outdated hook and API patterns, then replace them with the prescribed SWR hooks, API clients, or server API calls. The guidance covers data fetching, mutations, cache updates, and response handling, followed by a typecheck command.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

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

trycompai/comp星标 2,061(GitHub 2,061 + cccskills 0)

实测评分 未实测

查看安装方法

适用场景

  • Auditing files for disallowed API and hook patterns
  • Replacing raw fetch calls with the API client
  • Migrating server actions and database mutations to API hooks
  • Checking data fetching and cache update conventions

包含的文件(1)

  • SKILL.md1.8 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

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

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Guide API endpoint changes so request DTOs, runtime validation, OpenAPI documentation, and MCP tool metadata stay aligned. It covers discoverability, authentication, uploads, long-running tasks, and response types that MCP tools cannot handle.

中文简介正在准备中。当前显示英语简介。

  • Adding an API endpoint with a request body
  • Updating DTO validation and OpenAPI metadata
  • Making an endpoint available as an MCP tool
trycompai/comp20612026年10月24日 更新

Review specified files for design system usage, replace legacy @trycompai/ui components and lucide-react icons with available @trycompai/design-system equivalents, and run the app type check to verify the migration.

中文简介正在准备中。当前显示英语简介。

  • Migrating legacy UI components
  • Replacing lucide-react icons with Carbon icons
  • Checking specified files for design system compliance
trycompai/comp20612026年10月24日 更新

Review NestJS API endpoints and frontend components for role-based access control and audit log compliance. The skill lists permission, guard, route, and UI gating rules, then directs the agent to fix violations and run type checks.

中文简介正在准备中。当前显示英语简介。

  • Auditing API routes for permission decorators
  • Checking UI actions against user permissions
  • Fixing access control inconsistencies
trycompai/comp20612026年10月24日 更新

Audit unit tests for components that use permissions. Add missing tests and fix failures, checking that administrators can use mutation controls, auditors cannot, and read-only content remains visible to both.

中文简介正在准备中。当前显示英语简介。

  • Adding permission tests for a component
  • Checking admin and auditor behavior
  • Fixing failing permission-related tests
trycompai/comp20612026年10月24日 更新

Set up Better Auth for TypeScript applications, including server and client configuration, database adapters, sessions, email and social sign-in, and plugins. The guide also highlights environment variables, schema generation, and security settings to review.

中文简介正在准备中。当前显示英语简介。

  • Configuring Better Auth in a TypeScript app
  • Connecting an ORM or database adapter
  • Setting up sessions and cookie storage
trycompai/comp20612026年10月24日 更新

billing

免费

Use this skill when changing subscription billing with Stripe. It guides catalog and SKU updates, checkout, local entitlements and usage records, audit events, and webhook handling that tolerates retries and out-of-order delivery.

中文简介正在准备中。当前显示英语简介。

  • Adding or updating a billing SKU
  • Implementing subscription checkout
  • Handling billing webhooks safely
trycompai/comp20612026年10月24日 更新

查看 trycompai 的全部技能

报告此技能的问题