gen-hook

A code generator for React Query hooks, which are reusable functions for fetching and changing data in React applications. It creates hooks for reading, adding, editing, and deleting records with TypeScript types and cache updates.

In plain words
What is it for?
Use it to generate hooks such as use, useById, useCreate, useUpdate, and useDelete for a feature. It can also apply organized query keys, error handling, cache invalidation, and an advanced optimistic-update pattern.
Why use it?
It removes repetitive data-fetching code and helps keep cached data correct after changes. It first checks the existing service layer so the generated hooks match the available application methods.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/ramakrishnan24689/codeapps-toolkit/gen-hook
Any agent
npx skills add Ramakrishnan24689/codeapps-toolkit --skill gen-hook
Clone the repo
git clone --depth 1 https://github.com/Ramakrishnan24689/codeapps-toolkit

Made for: Claude Code, Codex.

Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,974 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00035 $0.01974
Opus 5 $0.00017 $0.00987
Sonnet 5 $0.00007 $0.00395
Haiku 4.5 $0.00003 $0.00197

Measured 2d ago against content hash 51a2d94cc003, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

gen-hook scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (templates/react-query-hooks.template.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/gen-hook/SKILL.md · 284 lines

How it starts

The opening of the file, as written. The whole thing — 284 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Generate React Query Hooks

Generate React Query hooks for data fetching and mutations with proper cache management and TypeScript types.

What This Skill Does

  1. Creates query hooks for data fetching (use, useById)
  2. Creates mutation hooks for data modification (useCreate, useUpdate, useDelete)
  3. Implements proper query key hierarchy (factory pattern)
  4. Sets up cache invalidation after mutations
  5. Provides TypeScript types and error handling
  6. Includes optimistic updates pattern (advanced)

Usage

/gen-hook todos
/gen-hook accounts
/gen-hook userprofile

Template

This skill uses a comprehensive React Query template:

  • templates/react-query-hooks.template.ts - Complete hooks with query key factory, cache management, and optimistic updates

How to use template: Read the template to understand the complete pattern, then generate adapted code based on the actual service layer you're integrating with.

Workflow

Step 1: Verify Service Layer Exists

Before generating hooks, ensure the service layer exists:

ls src/features/$ARGUMENTS[0]/services/*Service.ts

Read the service file to understand:

  • Available methods (getTodos, createTodo, etc.)
  • DTO types (CreateTodoDto, UpdateTodoDto)
  • Domain model type (Todo)

Step 2: Read the React Query Template

Read templates/react-query-hooks.template.ts

Study the template structure:

  • Query key factory pattern
  • Query hooks with proper configuration
  • Mutation hooks with cache invalidation
  • Optimistic updates pattern
  • TypeScript types

Step 3: Generate Hooks File Following Template Pattern

Create src/features/<feature>/hooks/use<Feature>.ts following the template structure.

React Query Hook Pattern (From Template)

Critical Pattern #1: Query Key Factory (From Template)

The template shows the query key factory pattern for hierarchical cache management:

// Query key factory - adapt to your feature name
const <feature>Keys = {
  all: ['<feature>'] as const,
  lists: () => [...<feature>Keys.all, 'list'] as const,
  list: (filters?: Filters) => [...<feature>Keys.lists(), filters] as const,
  details: () => [...<feature>Keys.all, 'detail'] as const,
  detail: (id: string) => [...<feature>Keys.details(), id] as const,
};

Read the full file on GitHub · 284 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 284 lines · 35 tokens per session scan A 51a2d94cc003

Subscribe to this mod's changes

gen-hook is a skill published in the GitHub repository Ramakrishnan24689/codeapps-toolkit (5 stars, last pushed 6mo ago), licensed MIT. It adds 35 tokens to every session and 1,974 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

weekly-digests

Generate a serial week-by-week narrative digest of a project's full claude-mem timeline. Splits the timeline into per-ISO-week files, then runs one consecutive subagent per week — each receiving the prior week's carry-forward block — to produce one chapter per ISO week of data. Use when asked for "weekly digests"…

thedotmack/claude-mem · 93 tokens

agentmail

Use when an agent needs AgentMail CLI email inboxes.

NousResearch/hermes-agent · 15 tokens

skill-template

Template for creating new Agent Skills for context engineering. Use this template when adding new skills to the collection.

muratcankoylan/Agent-Skills-for-Context-Engineering · 24 tokens

Agent Development

This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development…

anthropics/claude-code · 80 tokens

skill-creator

Scaffold a new yoyo skill when a human or community issue asks for one ("add a skill for X", "create a skill that does Y"). Generates correct frontmatter, validates, writes to disk.

yologdev/yoyo-evolve · 46 tokens

subagent-delegation

Canonical protocol for delegating GSD work to native Antigravity subagents — when to delegate, how to invoke, workspace isolation modes, and the inline fallback for older IDE versions.

toonight/get-shit-done-for-antigravity · 42 tokens