Agent skill
hook
Create custom React hooks following Darkroom standards. Use when: - User says "create hook", "new hook", "custom hook" - User wants to extract logic into a reusable hook - User mentions "use" prefix like "useAuth", "useScroll"
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/hook-darkroomengineering-cc-settings
SKILL.md
Create Custom Hook
Create a custom React hook following Darkroom conventions.
Structure
lib/hooks/<name>.ts # Hook implementation
Template
'use client'
import { useState, useEffect } from 'react'
interface Use<Name>Options {
// Hook configuration options
}
interface Use<Name>Return {
// Return type definition
}
export function use<Name>(options?: Use<Name>Options): Use<Name>Return {
// Implementation
return {
// Return values
}
}
Conventions
- Always
'use client'- Hooks use React APIs that require client - Type everything - Options interface, return interface
- Named export -
export function useX, not default - Prefix with
use- React hook naming convention - No memoization - React Compiler handles it automatically
Before You Start
If this hook uses an external library, fetch docs first:
- Run
/docs <library>to get current API via context7 - Run
bun info <package>to check latest version
Consider Using Hamo
For common use cases, prefer hamo hooks (run /docs hamo first):
import { useWindowSize, useRect, useIntersectionObserver } from 'hamo'
Only create custom hooks when hamo doesn't cover the use case.
Example
User: "create a useLocalStorage hook"
→ Creates lib/hooks/use-local-storage.ts
Arguments
$ARGUMENTS- Hook name (e.g., "useAuth", "useLocalStorage")
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?