Create custom React hooks with proper cleanup, error handling, loading states, and TypeScript generics.
Create a custom React hook called use[HookName] for [purpose]. Requirements: - TypeScript with generic type parameters where appropriate - Return a typed tuple or object (not untyped array) - Include loading, error, and data states - Handle cleanup in useEffect return (abort controllers, unsubscribe) - Implement proper dependency arrays (no missing deps, no over-triggering) - Use useCallback for returned functions to prevent consumer re-renders - Use useRef for values that shouldn't trigger re-renders - Handle race conditions in async operations (stale closure prevention) - Support SSR (check typeof window !== 'undefined' if using browser APIs) - Add JSDoc with @example usage - Write companion test file using renderHook from @testing-library/react-hooks - Follow existing hook patterns in this codebase
Generate optimized .cursorrules files tailored to your project's tech stack, conventions, and team preferences. Covers TypeScript, Python, Rust, Go, and more.
Leverage Cursor's Agent mode to build complete features end-to-end. Handles file creation, terminal commands, dependency installation, and multi-file edits in one flow.
Generate complete React components with TypeScript types, props interface, stories, and unit tests in one prompt.
Generate robust Next.js API routes with Zod validation, error handling, rate limiting, and TypeScript types.
Design database tables with proper types, constraints, indexes, and migration files for PostgreSQL/Supabase.
Generate FastAPI endpoints with Pydantic request/response models, dependency injection, and async database operations.