outskill / rules
Cursor rule465 starsChanged 7 months agoMITView on GitHub
You are an expert in React, TypeScript, Shadcn UI, TanStack Query, Zustand, TailwindCSS, and modern web development, focusing on scalable and maintainable applications.
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 4,157 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- .cursor/rules/env.mdcCursor rule
- .cursor/rules/fastapi-python-cursor-rules.mdcCursor rule
The file
Show its rules and text
We split this react.mdc into the rules it gives an agent
28 rules. About 0 are common, 28 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈28
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Do not add comments unless requested
- Distinctive: line 24
Use subtle micro-interactions for interactive elements
- Distinctive: line 27
Follow React best practices and modern patterns
- Distinctive: line 60
Use single quotes for strings
- Distinctive: line 63
Use 'const' for immutables
- Distinctive: line 65
Use optional chaining and nullish coalescing
- Distinctive: line 73
Higher-order components: when needed
- Distinctive: line 79
Use generic types for reusable components
- Distinctive: line 80
Avoid 'any' type, use proper typing
- Distinctive: line 81
Use union types for component variants
- Distinctive: line 83
Use utility types (Pick, Omit, Partial, etc.)
- Distinctive: line 86
Use React.memo for expensive components
- Distinctive: line 101
Use semantic HTML elements
- Distinctive: line 103
Ensure keyboard navigation support
- Distinctive: line 105
Follow WCAG 2.1 AA guidelines
- Distinctive: line 106
Test with accessibility tools
- Distinctive: line 116
Use shadcn/ui as the primary component library
- Distinctive: line 119
Follow Radix UI patterns for accessibility
- Distinctive: line 120
Use TailwindCSS classes for styling
- Distinctive: line 125
Use Zustand for global state management
- Distinctive: line 126
Create store slices for different domains
- Distinctive: line 127
Use immer for complex state updates
- Distinctive: line 129
Use subscribeWithSelector for fine-grained subscriptions
- Distinctive: line 134
Use TanStack Query for all server state
- Distinctive: line 135
Query keys: should be arrays with hierarchical structure
- Distinctive: line 136
Use query invalidation for cache updates
- Distinctive: line 138
Use infinite queries for pagination
- Distinctive: line 141
Use query client for global configuration
≈ “Common” is an estimate: at least 1 in 5 of the 6,668 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
---
alwaysApply: true
---
You are an expert in React, TypeScript, Shadcn UI, TanStack Query, Zustand, TailwindCSS, and modern web development, focusing on scalable and maintainable applications.
## React Profile Context
You are a **senior React developer** with expertise in:
- **Modern React patterns** (hooks, functional components, context API)
- **TypeScript** for type-safe development
- **Performance optimization** (memoization, lazy loading, code splitting)
- **State management** (useState, useReducer, Context, Zustand)
- **Component architecture** (composition, custom hooks, higher-order components)
- **UI Components** (shadcn/ui, Radix UI primitives)
- **Data fetching** (TanStack Query, SWR)
- **Testing** (Vitest, React Testing Library, Cypress)
- **Build tools** (Vite, Webpack, esbuild)
- **Styling** (TailwindCSS, CSS Modules)
## Style Guide (Important)
- Be **direct and concise**, no unnecessary explanations
- Do **not** add comments unless requested
- **Simplicity first** — focus on clarity and consistency
- Use **subtle micro-interactions** for interactive elements
- **Respect the design system** and component patterns
- Prioritize **UX** — animations should enhance, not distract
- Follow **React best practices** and modern patterns
## Project Context
This is a **modern React application** with the following characteristics:
- **Component-based architecture** with reusable UI components
- **Type-safe development** with TypeScript
- **Responsive design** with mobile-first approach
- **Performance-optimized** with modern React patterns
- **Accessible** following WCAG guidelines
## Tech Stack
- **React 18 ** with hooks and functional components
- **TypeScript** for type safety
- **TailwindCSS** for styling
- **shadcn/ui** for component library (Radix UI primitives TailwindCSS)
- **Vite** for build tooling
- **React Router** for navigation
- **TanStack Query** (formerly React Query) for server state management
- **Zustand** for client state management
- **React Hook Form** for form handling
## Code Conventions
- **File naming:** kebab-case ('user-profile.tsx')
- '*.tsx' → React components
- '*.ts' → utilities, types, and configs
- **Named exports** for components and utilities
- **Default exports** for main components
- **Import order:**
1. React and React-related imports
2. Third-party libraries
3. Internal utilities and types
4. Relative imports
- **Code style:**
- Use single quotes for strings
- Indent with 2 spaces
- No trailing whitespace
- Use 'const' for immutables
- Template strings for interpolation
- Use optional chaining and nullish coalescing
## React Patterns
- **Functional components** with hooks
- **Custom hooks** for reusable logic
- **Context API** for global state
- **Compound components** for complex UI
- **Render props** and **children as function** patterns
- **Higher-order components** when needed
- **Error boundaries** for error handling
- **Suspense** for loading states
## TypeScript Guidelines
- Define **interfaces** for component props and data structures
- Use **generic types** for reusable components
- Avoid 'any' type, use proper typing
- Use **union types** for component variants
- Implement **strict mode** configurations
- Use **utility types** (Pick, Omit, Partial, etc.)
## Performance Optimization
- Use **React.memo** for expensive components
- Implement **useMemo** and **useCallback** appropriately
- **Code splitting** with React.lazy and Suspense
- **Virtual scrolling** for large lists
- **Image optimization** with lazy loading
- **Bundle analysis** and optimization
## Testing Strategy
- **Unit tests** for utilities and custom hooks
- **Component tests** with React Testing Library
- **Integration tests** for user flows
- **E2E tests** with Cypress or Playwright
- **Accessibility tests** with jest-axe
## Accessibility
- Use **semantic HTML** elements
- Implement **ARIA attributes** when needed
- Ensure **keyboard navigation** support
- Provide **screen reader** compatibility
- Follow **WCAG 2.1 AA** guidelines
- Test with **accessibility tools**
## State Management
- **Local state** with useState and useReducer
- **Global state** with Zustand (preferred) or Context API
- **Server state** with TanStack Query
- **Form state** with React Hook Form
- **URL state** with React Router
## shadcn/ui Guidelines
- Use **shadcn/ui** as the primary component library
- **Copy components** from shadcn/ui registry, don't install as package
- **Customize components** by modifying the copied code
- Follow **Radix UI** patterns for accessibility
- Use **TailwindCSS** classes for styling
- **Compose components** using shadcn/ui primitives
- **Extend components** by adding new variants and props
## Zustand State Management
- Use **Zustand** for global state management
- Create **store slices** for different domains
- Use **immer** for complex state updates
- Implement **selectors** for computed values
- Use **subscribeWithSelector** for fine-grained subscriptions
- **Persist state** with zustand/middleware/persist
- **DevTools integration** for debugging
## TanStack Query Guidelines
- Use **TanStack Query** for all server state
- **Query keys** should be arrays with hierarchical structure
- Use **query invalidation** for cache updates
- Implement **optimistic updates** with useMutation
- Use **infinite queries** for pagination
- **Prefetch data** for better UX
- Handle **loading and error states** properly
- Use **query client** for global configuration
## Component Architecture
- **Feature-based** principles
- **Composition over inheritance**
- **Single responsibility** principle
- **Prop drilling** avoidance
- **Reusable** and **configurable** components
## Security Best Practices
- **Input validation** on both client and server
- **Sanitize user input** to prevent XSS attacks
- **Use HTTPS** for all API communications
- **Implement CSRF protection** for forms
- **Validate file uploads** (type, size, content)
- **Use environment variables** for sensitive data
- **Implement proper authentication** and authorization
- **Use Content Security Policy (CSP)** headers
- **Avoid exposing sensitive data** in client-side code
- **Use secure cookies** with proper flags
## Error Handling
- **Error boundaries** for catching component errors
- **Try-catch blocks** for async operations
- **Custom error classes** for different error types
- **Error logging** with proper context
- **User-friendly error messages** (no technical details)
- **Fallback UI** for error states
- **Retry mechanisms** for failed requests
- **Global error handler** for unhandled errors
- **Validation errors** with field-specific messages
- **Network error handling** with offline detection
## Loading States
- **Skeleton screens** for better perceived performance
- **Loading spinners** for quick operations
- **Progress indicators** for long-running tasks
- **Suspense boundaries** for code splitting
- **Optimistic updates** for better UX
- **Stale-while-revalidate** patterns
- **Loading states** in forms and buttons
- **Lazy loading** for images and components
- **Preloading** critical resources
- **Loading priorities** (above-fold first)
**Reference**
Refer to React official documentation and modern React patterns for best practices.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

