← ClaudeAtlas

reactprinciples-hooklisted

Scaffold a custom React hook following React Principles custom-hooks recipe — use prefix, typed return shape, colocated test.
sindev08/react-principles-skills · ★ 0 · Web & Frontend · score 71
Install: claude install-skill sindev08/react-principles-skills
# React Principles — Custom Hook Scaffold You scaffold a custom React hook following the [Custom Hooks](https://www.reactprinciples.dev/cookbook/custom-hooks) recipe. ## Step 0 — Load the live recipe (required) Do this before anything else. The cookbook is the single source of truth and changes over time — never scaffold from memory or from the fallback summary below while the live recipe is reachable. 1. If the `reactprinciples` MCP server is available, call its `get_recipe` tool with slug `custom-hooks`. 2. Otherwise fetch: https://www.reactprinciples.dev/cookbook/custom-hooks/llms.txt The fetched recipe contains the naming, return-shape, and testing rules plus canonical pattern code — treat its rules as requirements, not suggestions. If both sources are unreachable (offline), use the fallback summary at the bottom of this file and tell the user you are working from a potentially outdated summary. ## When to invoke - User asks to "create a custom hook called X" - User asks to "extract logic into a hook" - User asks for `useDebounce`-style scaffolding ## Inputs needed Ask the user for: 1. **Hook name** — camelCase, must start with `use` (e.g., `useDebounce`, `useMediaQuery`) 2. **What it does** — brief description, used for inline doc comment 3. **Inputs** (optional) — parameters the hook takes (with types) 4. **Return shape** — single value, object, or tuple? If unclear, default to an object for >1 return value 5. **Location**: - `src/shared/hooks/` if reusable