dev-create-hook

Generate typed React Query hooks for server state in Next.js modules.

20|3|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/HerbertJulio/specialist-agent --skill dev-create-hook
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dev-create-hook
Source: https://github.com/HerbertJulio/specialist-agent/tree/main/packs/nextjs/skills/dev-create-hook
Command: npx skills add https://github.com/HerbertJulio/specialist-agent --skill dev-create-hook

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Automates the creation of a client hook for server state management in a Next.js module, ensuring consistent React Query patterns and reducing boilerplate.

Core Features & Use Cases

  • Generate a typed useQuery-based hook with caching and error handling, wired to a service and adapter.
  • Provide a useMutation hook for mutations with cache invalidation and error handling.
  • Enforce project structure by placing the hook in hooks/use[Name].ts and ensuring proper TypeScript typings.
  • Use cases include adding server state to an existing module or building new features that fetch and mutate data via APIs.

Quick Start

Provide the hook name and let the tool generate a typed React Query hook wired to your service and adapter layers.

Frequently Asked Questions about dev-create-hook

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a React Query hook for server state in Next.js?

Creating a React Query hook for server state involves automating useQuery and useMutation setup with your service and adapter layers. It enforces TypeScript typing, proper caching, and cache invalidation within your Next.js project structure.

What is the best way to reduce React Query boilerplate in a TypeScript project?

The best way to reduce React Query boilerplate is to automate client-side hook generation. This enforces consistent patterns like the 'use' prefix, 'use client' directive, and explicit staleTime for queries while wiring services and adapters automatically.

Do I need existing services and adapters to generate a React Query hook?

Yes, you need existing services and adapters in your TypeScript project structure. The hook generation requires these layers to be in place so it can properly wire the client-side useQuery and useMutation hooks to your data fetching and mutation logic.

How does cache invalidation work with useMutation in React Query hooks?

Cache invalidation with useMutation works by automatically wiring the mutation to invalidate relevant useQuery caches. This ensures your server state stays fresh after data changes, handling errors properly while maintaining consistent React Query patterns.

Can I use this approach to add server state management to an existing Next.js module?

Yes, you can use this approach to add server state management to an existing Next.js module. It generates typed hooks placed in hooks/use[Name].ts, covering both data fetching and mutations with proper caching and invalidation for new or existing features.