react-development
Skill1 starsChanged 11 months agoISCView on GitHub
Best practices for building modern React applications with functional components, hooks, and optimal performance. Use when working with .jsx or .tsx files in React projects.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- PracticalSwan/agent-skillstheir own version, first seen Sep 14, 2026
- Domush/ai-agent-web-development-skillstheir own version, first seen Apr 22, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- PracticalSwan/agent-skills★ 18same name
- Domush/ai-agent-web-development-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository13 other files it gives its agents.
- ai-development-assistantSkill
- angular-developmentSkill
- bun-package-managerSkill
- css-developmentSkill
- go-developmentSkill
- html-developmentSkill
- javascript-developmentSkill
- npm-package-managerSkill
- pnpm-package-managerSkill
- python-developmentSkill
- rust-developmentSkill
- typescript-developmentSkill
- vue-developmentSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
58 rules. About 0 are common, 51 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈51
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Use this skill when:
- Distinctive: line 22
Functional Components: Always use functional components over class components.
- Distinctive: line 23
Hooks Only: Use hooks for state and side effects.
- Distinctive: line 24
JSX Best Practices: Keep JSX readable. Extract complex expressions to variables.
- Distinctive: line 26
Props Immutability: Never mutate props. Treat them as read-only.
- Distinctive: line 31
Component Size: Keep components small (under 200 lines).
- Very specific: line 34
Index Files: Use index.ts/js to re-export components for cleaner imports.
- Very specific: line 60
Use functional updates when new state depends on previous: setState(prev => prev + 1)
- Distinctive: line 62
Use objects for related state that changes together
- Very specific: line 68
Use empty dependency array [] only for mount-only effects
- Distinctive: line 69
Avoid objects/arrays in dependencies (use useMemo/useCallback)
- Distinctive: line 72
Use useCallback for functions passed to child components
- Distinctive: line 73
Use useMemo for expensive computations only
- Distinctive: line 74
Don't over-optimize - measure first
- Distinctive: line 78
Use for DOM references and mutable values that don't trigger re-renders
- Distinctive: line 79
Don't use for state that affects rendering
- Distinctive: line 86
Keep hooks focused on single responsibility
- Distinctive: line 111
Type All Props: Always define prop types (TypeScript interfaces or PropTypes)
- Distinctive: line 113
Default Values: Use default parameters for optional props
- Very specific: line 114
Children Type: Use React.ReactNode for children prop
- Distinctive: line 120
Use useState for component-specific state
- Distinctive: line 122
Keep state as close to where it's used as possible
- Distinctive: line 125
Use for global state (theme, auth, user preferences)
- Distinctive: line 128
Use useReducer with Context for complex state logic
- Distinctive: line 141
Code Splitting: Use React.lazy() and Suspense for route-based splitting
- Distinctive: line 142
Virtualization: Use react-window or react-virtualized for long lists
- Distinctive: line 144
Key Props: Use stable, unique keys for list items (never index)
- Distinctive: line 148
Arrow Functions: Use arrow functions for inline handlers or bind in constructor
- Very specific: line 150
Prevent Default: Use e.preventDefault() when needed
- Very specific: line 151
Stop Propagation: Use e.stopPropagation() carefully
- Distinctive: line 157
Ternary for If-Else: Use ternary operator for if-else rendering
- Distinctive: line 158
&& for If Only: Use logical AND for conditional rendering without else
- Distinctive: line 174
Controlled Components: Prefer controlled components for form inputs
- Distinctive: line 175
Form Libraries: Use React Hook Form or Formik for complex forms
- Distinctive: line 176
Validation: Use Zod or Yup for schema validation
- Distinctive: line 178
Accessibility: Use proper labels, ARIA attributes, and semantic HTML
- Distinctive: line 183
Cleanup: Always return cleanup function when needed
- Distinctive: line 184
Data Fetching Libraries: Use TanStack Query, SWR, or Apollo for server state
- Distinctive: line 185
Async in useEffect: Create async function inside useEffect, don't make useEffect async
- Distinctive: line 209
Try-Catch: Use try-catch in async functions and event handlers
- Distinctive: line 216
Testing Library: Use React Testing Library over Enzyme
- Distinctive: line 217
Test User Behavior: Test what users see and do, not implementation
- Distinctive: line 218
Queries: Use getByRole, getByLabelText over getByTestId
- Distinctive: line 219
Async Utils: Use waitFor, findBy* for async operations
- Distinctive: line 220
Mock API Calls: Use MSW (Mock Service Worker) for API mocking
- Distinctive: line 221
Component Tests: Test components in isolation and integration
- Very specific: line 227
Import as object: import styles from './Button.module.css'
- Distinctive: line 237
Use className for styling
- Distinctive: line 241
Avoid inline styles for complex styling
- Distinctive: line 242
Use CSS variables for theming
- Distinctive: line 247
Semantic HTML: Use proper HTML elements (button, nav, article)
- Distinctive: line 248
ARIA Attributes: Add ARIA labels when semantic HTML isn't enough
- Distinctive: line 249
Keyboard Navigation: Ensure all interactive elements are keyboard accessible
- Distinctive: line 252
Color Contrast: Ensure sufficient color contrast ratios
- Distinctive: line 253
Screen Reader Testing: Test with screen readers
- Distinctive: line 274
Concurrent Features: Use useTransition for non-urgent updates
- Distinctive: line 275
Suspense: Use for data fetching and code splitting
- Distinctive: line 282
Before submitting React code, verify:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill 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
React Development Skills
When to Use This Skill
Use this skill when:
- Writing or refactoring React components (.jsx, .tsx files)
- Building single-page applications (SPAs) or web applications
- Working with React hooks and state management
- Optimizing React performance and rendering
- Integrating with APIs and external libraries
I. React Fundamentals
- Functional Components: Always use functional components over class components.
- Hooks Only: Use hooks for state and side effects. No class component patterns.
- JSX Best Practices: Keep JSX readable. Extract complex expressions to variables.
- Component Composition: Build complex UIs by composing small, reusable components.
- Props Immutability: Never mutate props. Treat them as read-only.
II. Component Architecture
- Single Responsibility: Each component should do one thing well.
- Component Size: Keep components small (under 200 lines). Extract when larger.
- File Organization: One component per file. Name file same as component.
- Component Hierarchy: Organize components by feature, not by type.
- Index Files: Use index.ts/js to re-export components for cleaner imports.
Recommended Project Structure:
src/
├── components/ # Reusable components
│ ├── Button/
│ │ ├── Button.tsx
│ │ ├── Button.test.tsx
│ │ └── index.ts
│ └── ...
├── features/ # Feature-based modules
│ ├── auth/
│ ├── dashboard/
│ └── ...
├── hooks/ # Custom hooks
├── utils/ # Utility functions
├── contexts/ # React contexts
├── services/ # API services
└── App.tsxIII. React Hooks Best Practices
useState:
- Initialize state with proper types
- Use functional updates when new state depends on previous:
setState(prev => prev + 1) - Split state into multiple useState calls for unrelated data
- Use objects for related state that changes together
useEffect:
- Specify all dependencies in dependency array
- One effect per concern (don't combine unrelated side effects)
- Return cleanup functions for subscriptions and timers
- Use empty dependency array
[]only for mount-only effects - Avoid objects/arrays in dependencies (use useMemo/useCallback)
useCallback & useMemo:
- Use useCallback for functions passed to child components
- Use useMemo for expensive computations only
- Don't over-optimize - measure first
- Include all dependencies
useRef:
- Use for DOM references and mutable values that don't trigger re-renders
- Don't use for state that affects rendering
- Access ref.current in effects or event handlers, not during render
Custom Hooks:
- Prefix with "use" (e.g., useAuth, useFetch)
- Extract reusable logic into custom hooks
- Return arrays for multiple values
[value, setValue]or objects{ value, setValue } - Keep hooks focused on single responsibility
IV. Props & TypeScript
Props Definition (TypeScript):
// Prefer interface for props
interface ButtonProps {
variant: 'primary' | 'secondary';
onClick: () => void;
children: React.ReactNode;
disabled?: boolean;
}
// Destructure props in function signature
export const Button: React.FC<ButtonProps> = ({
variant,
onClick,
children,
disabled = false
}) => {
// Component logic
};- Type All Props: Always define prop types (TypeScript interfaces or PropTypes)
- Destructure Props: Destructure in function parameters for clarity
- Default Values: Use default parameters for optional props
- Children Type: Use
React.ReactNodefor children prop - Event Handlers: Type event handlers explicitly (e.g.,
React.MouseEvent<HTMLButtonElement>)
V. State Management
Local State:
- Use useState for component-specific state
- Lift state up only when necessary
- Keep state as close to where it's used as possible
Context API:
- Use for global state (theme, auth, user preferences)
- Split contexts by concern (don't create god contexts)
- Memoize context values to prevent unnecessary re-renders
- Use useReducer with Context for complex state logic
External Libraries:
- Zustand: Lightweight, simple state management
- Redux Toolkit: Complex applications with predictable state
- Jotai/Recoil: Atomic state management
- TanStack Query: Server state and data fetching
VI. Performance Optimization
- React.memo: Wrap components that receive same props often
- useMemo: Cache expensive calculations
- useCallback: Prevent function recreation on each render
- Code Splitting: Use React.lazy() and Suspense for route-based splitting
- Virtualization: Use react-window or react-virtualized for long lists
- Avoid Inline Functions: In JSX when passing to frequently re-rendering children
- Key Props: Use stable, unique keys for list items (never index)
VII. Event Handling
- Arrow Functions: Use arrow functions for inline handlers or bind in constructor
- Event Delegation: Let React handle event delegation
- Prevent Default: Use
e.preventDefault()when needed - Stop Propagation: Use
e.stopPropagation()carefully - Synthetic Events: Understand React's synthetic event system
- Event Handler Naming: Prefix with "handle" (handleClick, handleSubmit)
VIII. Conditional Rendering
- Ternary for If-Else: Use ternary operator for if-else rendering
- && for If Only: Use logical AND for conditional rendering without else
- Early Return: Return early for simple conditions
- Avoid Complex JSX Logic: Extract complex conditions to variables or functions
- Null Rendering: Return
nullto render nothing
// Good patterns
{isLoading && <Spinner />}
{error ? <Error message={error} /> : <Content />}
// Extract complex logic
const shouldShowAlert = isError && !isDismissed && hasPermission;
return shouldShowAlert && <Alert />;IX. Forms & Input Handling
- Controlled Components: Prefer controlled components for form inputs
- Form Libraries: Use React Hook Form or Formik for complex forms
- Validation: Use Zod or Yup for schema validation
- Debouncing: Debounce input handlers for search/autocomplete
- Accessibility: Use proper labels, ARIA attributes, and semantic HTML
X. Side Effects & Data Fetching
- useEffect for Side Effects: API calls, subscriptions, manual DOM manipulation
- Cleanup: Always return cleanup function when needed
- Data Fetching Libraries: Use TanStack Query, SWR, or Apollo for server state
- Async in useEffect: Create async function inside useEffect, don't make useEffect async
- Race Conditions: Handle component unmounting during async operations
useEffect(() => {
let cancelled = false;
const fetchData = async () => {
const data = await api.getData();
if (!cancelled) {
setData(data);
}
};
fetchData();
return () => {
cancelled = true;
};
}, []);XI. Error Handling
- Error Boundaries: Implement error boundaries for component tree errors
- Try-Catch: Use try-catch in async functions and event handlers
- Error States: Maintain error state for API calls and async operations
- User Feedback: Show meaningful error messages to users
- Fallback UI: Provide fallback UI in error boundaries
XII. Testing
- Testing Library: Use React Testing Library over Enzyme
- Test User Behavior: Test what users see and do, not implementation
- Queries: Use getByRole, getByLabelText over getByTestId
- Async Utils: Use waitFor, findBy* for async operations
- Mock API Calls: Use MSW (Mock Service Worker) for API mocking
- Component Tests: Test components in isolation and integration
XIII. Styling Approaches
CSS Modules:
- Scoped styles per component
- Import as object:
import styles from './Button.module.css'
Styled Components / Emotion:
- CSS-in-JS with component scoping
- Dynamic styling based on props
- Theme support built-in
Tailwind CSS:
- Utility-first CSS framework
- Rapid UI development
- Use className for styling
Best Practices:
- Be consistent across project
- Avoid inline styles for complex styling
- Use CSS variables for theming
- Consider performance implications
XIV. Accessibility (a11y)
- Semantic HTML: Use proper HTML elements (button, nav, article)
- ARIA Attributes: Add ARIA labels when semantic HTML isn't enough
- Keyboard Navigation: Ensure all interactive elements are keyboard accessible
- Focus Management: Manage focus for modals, drawers, and route changes
- Alt Text: Provide meaningful alt text for images
- Color Contrast: Ensure sufficient color contrast ratios
- Screen Reader Testing: Test with screen readers
XV. Common Patterns
Good Patterns:
- Container/Presenter pattern for separating logic and UI
- Compound components for flexible APIs
- Render props for sharing logic
- Higher-order components (HOCs) for cross-cutting concerns
- Custom hooks for reusable logic
Anti-Patterns to Avoid:
- Prop drilling (use Context or state management)
- Massive components (split into smaller ones)
- Direct DOM manipulation (use refs sparingly)
- Index as key in lists
- Mutating state directly
- Mixing business logic with rendering logic
XVI. React 18+ Features
- Concurrent Features: Use useTransition for non-urgent updates
- Suspense: Use for data fetching and code splitting
- Automatic Batching: Understand automatic state update batching
- useId: Generate unique IDs for accessibility
- useDeferredValue: Defer expensive updates
XVII. Best Practices Checklist
Before submitting React code, verify:
- Functional components with hooks only
- Props typed (TypeScript/PropTypes)
- All hooks dependencies declared correctly
- No unnecessary re-renders (use React DevTools Profiler)
- Keys used properly in lists
- Accessibility attributes added
- Error boundaries implemented
- Components tested
- No console errors or warnings
- Code formatted (Prettier/ESLint)
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.

