accelint-react-best-practices▌
gohypergiant/agent-skills · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Comprehensive performance optimization and best practices for React applications, designed for AI agents and LLMs working with React code.
React Best Practices
Comprehensive performance optimization and best practices for React applications, designed for AI agents and LLMs working with React code.
NEVER Do React
These are the most critical anti-patterns that cause real production issues. Experts learned these the hard way through debugging sessions and performance investigations.
NEVER define components inside components — creates new component type on every render, causing full remount with state loss and DOM recreation. Results in input fields losing focus on keystroke, animations restarting unexpectedly, and useEffect cleanup/setup running on every parent render.
NEVER subscribe to searchParams/localStorage if you only read them in callbacks — causes component to re-render on every URL change or storage event even when the component doesn't display those values. Read directly in the callback instead: new URLSearchParams(window.location.search).
NEVER use object/array dependencies in useEffect — triggers effect on every render since objects are recreated with new references each time. Extract primitive values (id, name) from objects and use those as dependencies instead.
NEVER sync derived state with useState + useEffect — leads to extra re-renders, infinite loops, and stale intermediate states. Calculate derived values during render instead: const fullName = firstName + ' ' + lastName.
NEVER use client-only state (localStorage, cookies, device detection) directly in SSR components — causes hydration mismatches where server HTML doesn't match client render, resulting in React warnings, visual flickering, and broken interactivity. Use synchronous inline <script> before React hydrates.
NEVER use forwardRef in React 19+ — deprecated API. Use ref as a regular prop instead: function MyInput({ ref }) { return <input ref={ref} /> }.
NEVER create callbacks/objects/arrays inline as props to memoized components — breaks memoization since new reference is created each render. Extract to module scope, useMemo, or useCallback: const config = useMemo(() => ({ theme }), [theme]).
NEVER put user interaction logic in useEffect — if it's triggered by a button click or form submit, put it directly in the event handler. Effects are for synchronization with external systems, not user-triggered actions.
How to Use
This skill uses a progressive disclosure structure to minimize context usage:
1. Start with the Overview (AGENTS.md)
Read AGENTS.md for a concise overview of all rules with one-line summaries.
2. Load Specific Rules as Needed
When you identify a relevant optimization, load the corresponding reference file for detailed implementation guidance:
Re-render Optimizations:
- defer-state-reads.md
- extract-memoized-components.md
- narrow-effect-dependencies.md
- subscribe-derived-state.md
- functional-setstate-updates.md
- lazy-state-initialization.md
- transitions-non-urgent-updates.md
- calculate-derived-state.md
- avoid-usememo-simple-expressions.md
- extract-default-parameter-value.md
- interaction-logic-in-event-handlers.md
- no-inline-components.md
- useref-for-transient-values.md
- split-combined-hooks.md
- use-deferred-value.md
Rendering Performance:
- animate-svg-wrapper.md
- css-content-visibility.md
- hoist-static-jsx.md
- optimize-svg-precision.md
- prevent-hydration-mismatch.md
- activity-component-show-hide.md
- hoist-regexp-creation.md
- use-usetransition-over-manual-loading.md
Advanced Patterns:
- store-event-handlers-refs.md
- uselatest-stable-callbacks.md
- cache-repeated-function-calls.md
- initialize-app-once.md
Misc:
Quick References:
Automation Scripts:
- scripts/ - Helper scripts to detect anti-patterns
3. Apply the Pattern
Each reference file contains:
- ❌ Incorrect examples showing the anti-pattern
- ✅ Correct examples showing the optimal implementation
- Explanations of why the pattern matters
4. Use the Report Template
When this skill is invoked, use the standardized report format:
Template: assets/output-report-template.md
The report format provides:
- Executive Summary with impact assessment
- Severity levels (Critical, High, Medium, Low) for prioritization
- Impact analysis (potential bugs, type safety, maintainability, runtime failures)
- Categorization (Type Safety, Safety, State Management, Return Values, Code Quality)
- Pattern references linking to detailed guidance in references/
- Phase 2 summary table for tracking all issues
When to use the audit template:
- Skill invoked directly via
/accelint-react-best-practices <path> - User asks to "review code quality" or "audit code" across file(s), invoking skill implicitly
When NOT to use the report template:
- User asks to "fix this type error" (direct implementation)
- User asks "what's wrong with this code?" (answer the question)
- User requests specific fixes (apply fixes directly without formal report)
Examples
Example 1: Optimizing Re-renders
Task: "This component re-renders too frequently when the user scrolls"
Approach:
- Read AGENTS.md overview
- Identify likely cause: subscribing to continuous values (scroll position)
- Load subscribe-derived-state.md or transitions-non-urgent-updates.md
- Apply the pattern from the reference file
Example 2: Fixing Stale Closures
Task: "This callback always uses the old state value"
Approach:
- Read AGENTS.md overview
- Identify issue: stale closure in useCallback
- Load functional-setstate-updates.md
- Replace direct state reference with functional update
Example 3: SSR Hydration Mismatch
Task: "Getting hydration errors with localStorage theme"
Approach:
- Read AGENTS.md overview
- Identify issue: client-only state causing mismatch
- Load prevent-hydration-mismatch.md
- Implement synchronous script pattern
Using Skill Patterns Appropriately
Each reference file demonstrates ONE proven pattern, but React problems often have multiple valid solutions.
When applying patterns:
- ✅ Present the pattern from the reference file
- ✅ Mention alternative approaches when they exist
- ✅ Consider user's React version, project complexity, and team preferences
- ✅ For simple cases, suggest simpler solutions even if not in references
Example: For SSR hydration issues, prevent-hydration-mismatch.md shows the synchronous script approach, but a simple "mounted flag" pattern may be more appropriate for basic use cases.
Important Notes
React Compiler Awareness
Many manual optimization patterns (memo, useMemo, useCallback, hoisting static JSX) are automatically handled by React Compiler.
Before optimizing, check if the project uses React Compiler:
- If enabled: Skip manual memoization, but still apply state/effect/CSS optimizations
- If not enabled: Apply all relevant optimizations from this guide
See react-compiler-guide.md for a complete breakdown of what the compiler handles vs what still needs manual optimization.
React 19+ Features
This skill covers React 19 features including:
useEffectEvent(19.2+) for stable event handlers<Activity>component for preserving hidden component staterefas a prop (replaces deprecatedforwardRef)- Named imports only (no default import of React)
Performance Philosophy
- Start with correct code, then optimize
- Measure before optimizing
- Optimize slowest operations first (network > rendering > computation)
- Avoid premature optimization of trivial operations
Code Quality Principles
- Prefer simple, readable code over clever optimizations
- Only add complexity when measurements justify it
- Document non-obvious performance optimizations
Additional Resources
Catch up on React 19 features:
How to use accelint-react-best-practices on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add accelint-react-best-practices
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches accelint-react-best-practices from GitHub repository gohypergiant/agent-skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate accelint-react-best-practices. Access the skill through slash commands (e.g., /accelint-react-best-practices) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.6★★★★★33 reviews- ★★★★★Fatima Sethi· Dec 12, 2024
Useful defaults in accelint-react-best-practices — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Naina Flores· Dec 8, 2024
accelint-react-best-practices is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Noor Choi· Nov 27, 2024
accelint-react-best-practices reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Kiara Thompson· Nov 11, 2024
accelint-react-best-practices has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Ren Diallo· Nov 3, 2024
I recommend accelint-react-best-practices for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Naina Sanchez· Oct 22, 2024
accelint-react-best-practices reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Olivia Dixit· Oct 18, 2024
I recommend accelint-react-best-practices for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Isabella Torres· Oct 2, 2024
Keeps context tight: accelint-react-best-practices is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Olivia Sharma· Sep 25, 2024
accelint-react-best-practices fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Yash Thakker· Sep 13, 2024
Solid pick for teams standardizing on skills: accelint-react-best-practices is focused, and the summary matches what you get after install.
showing 1-10 of 33