.cursor/skills/ahooks-v3/SKILL.md
Utility hooks for React state management - grouped state and localStorage persistence. Use when: managing grouped state that changes together, persisting state to localStorage, or coordinating state between URL and storage.
npx skillsauth add blockmatic-icebox/basilic-old ahooksInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
useSetState for grouped state that changes together (not URL-shareable)useLocalStorageState for persistent state across browser sessionsuseState only for simple independent state (rare)useSetState for grouped state not in URL (form state, game engine state, ephemeral UI state)useLocalStorageState for localStorage persistenceuseLocalStorageState<boolean>('key', { defaultValue: false })Use for grouped state that updates together:
import { useSetState } from 'ahooks'
const [state, setState] = useSetState({
name: '',
email: '',
age: 0,
})
// Partial updates (shallow merge)
setState({ name: 'John' })
setState(prev => ({ ...prev, email: '[email protected]' }))
When to use: Form state, game engine state, UI state that changes together (if not URL-shareable)
When NOT to use: URL-shareable state (use nuqs), loading states (use TanStack Query)
Use for state that persists across browser sessions:
import { useLocalStorageState } from 'ahooks'
const [value, setValue] = useLocalStorageState<boolean>('key', {
defaultValue: false,
})
// Type-safe with generics
const [settings, setSettings] = useLocalStorageState<Settings>('settings', {
defaultValue: { theme: 'light', fontSize: 14 },
})
When to use: User preferences, debug flags, settings that should persist across sessions
When NOT to use: URL-shareable state (use nuqs), sensitive data (use secure storage)
Bidirectional sync between URL and localStorage:
import { useLocalStorageState } from 'ahooks'
import { useQueryState } from 'nuqs'
import { useEffect, useRef } from 'react'
const [queryState, setQueryState] = useQueryState('debug')
const [storageState, setStorageState] = useLocalStorageState<boolean>('debug', {
defaultValue: false,
})
const isFirstMount = useRef(true)
// Sync on mount: localStorage → URL
useEffect(() => {
if (isFirstMount.current) {
isFirstMount.current = false
if (storageState && queryState !== 'true') {
setQueryState('true')
return
}
}
// Sync changes: URL → localStorage
if (queryState === 'true' && !storageState) {
setStorageState(true)
} else if (queryState === 'false' && storageState) {
setStorageState(false)
}
}, [queryState, storageState, setQueryState, setStorageState])
Use case: Debug flags, feature toggles that should be both URL-shareable and persistent
nuqs (filters, search, tabs, pagination)useSetState (form state, game engine, ephemeral UI)useLocalStorageState (preferences, settings)useState (rare, prefer other options)development
# Skill: wagmi ## Scope - React/Next.js wallet integration with Wagmi v3 for EVM chains - Contract interactions using viem v2 for address validation and transaction building - Transaction state management and error handling - Custom hooks wrapping wagmi for contract-specific interactions Does NOT cover: - Solana frontend development - Backend RPC interactions - Smart contract development ## Assumptions - Wagmi v3.3.2+ - viem v2.44.4 - React 18+ or Next.js 14+ - TypeScript v5+ with strict mo
development
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
development
Advanced TypeScript patterns for type-safe, maintainable code using sophisticated type system features. Use when building type-safe APIs, implementing complex domain models, or leveraging TypeScript's advanced type capabilities.
development
TanStack Query (React Query) for async operations, data fetching, caching, and state management. Use when: fetching server data, managing async operations, caching responses, handling mutations, or any operation that benefits from automatic state management and caching.