vintasoftware/vinta-schedule-frontend-web/new-hook
Claude Code and agent skill by vintasoftware/vinta-schedule-frontend-web
- community
Checking that the SKILL.md file is still in the repository.
Scaffold a new data hook that wraps a generated TanStack Query operation, following this repo's src/hooks/<domain>/ convention. Use when the user says "add a hook", "create a useX hook", "wire up the <endpoint> API", "fetch <resource> with a hook", or "add a mutation/query for <thing>". NOT for non-data React hooks unrelated to the API (write those inline or ask).
Install
npx vskill@latest install vintasoftware/vinta-schedule-frontend-web/new-hookSKILL.md
New Hook
Create a data hook under `src/hooks/<domain>/` that wraps a generated TanStack Query operation. The hook is a thin ergonomic layer: spread the generated factory, add cache invalidation, return an async fn + the raw mutation/query object.
Before writing
- Read AGENTS.md (Data hooks section).
- Find the generated operation. The client is generated by hey-api — never
hand-write request code. Locate the factory in the @tanstack/react-query.gen barrel:
- App API:
@/client/@tanstack/react-query.gen - Auth (allauth):
@/auth-client/@tanstack/react-query.gen
``bash grep -rn "Mutation\|Options" src/client/@tanstack/react-query.gen.ts | head ``
If the operation doesn't exist, the OpenAPI schema may be stale — regenerate with npm run openapi-ts (or npm run openapi-ts-auth) before continuing.
- Pick the domain folder (
authentication,organizations, or a new one)
and file name use-kebab-name.ts.
Patterns
Mutation hook
Mirror `use-create-organization.ts`:
Query hook
Spread the generated *Options() factory into useQuery, and export a `*_QUERY_KEY` const so mutation hooks can invalidate it:
(Match the exact query-key shape the generated factory uses if you need precise invalidation — check the .gen file.)
Conventions
- One hook per file. Named export
useCamelName. No default export. - Types come from
@/client/@/auth-client— don't redeclare request/response shapes. - Return both the ergonomic fn (
mutateAsyncwrapper) and the raw object
(for isPending, error, etc. in the component).
- Add a short doc comment explaining the _why_, especially for auth/token side
effects (see `use-login.ts`).
- Side effects on success (cache invalidation,
localStorage) go inonSuccess.
Verify
npm run typecheckandnpm run lintclean.- Add a test if the hook has non-trivial logic (token handling, header building,
branching) — mock the network like the auth page tests do.
Don't
- Don't write raw
fetch/axios — always go through the generated operation. - Don't edit
src/client/orsrc/auth-client/to "add" an endpoint — regenerate.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingai-tools/skills/new-hook/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/vintasoftware/vinta-schedule-frontend-web/new-hook)