new-hook
Scaffolds a new custom React hook with a Vitest browser-mode test file. Use this skill whenever the user asks to "create a hook", "make a useFoo hook", "scaffold a custom React hook", "add a hook unde
SKILL.mdapps/web/.claude/skills/new-hook/SKILL.md
GitHubnew-hook
Workflow
- Confirm: name (
use-kebaboruseCamel), params, return type. - Run from the repo root:
./.gaia/cli/gaia scaffold hook <useFoo> [--params "a:string,b:number"] [--returns "ReturnType"]. - Verify:
pnpm typecheckclean. Open and sanity-check.
The scaffold writes app/hooks/use-<kebab>.ts (named export useCamel) and app/hooks/tests/use-<kebab>.test.ts, which renders the hook with async renderHook from vitest-browser-react and runs in the browser Vitest project (real Chromium; run pnpm install:browsers once). A bare stub declares a void return.