agentleFS
theyoungastronautstheyoungastronauts/polaris/skills/react/SKILL.md

react

Skill4 starsChanged 3 months agoMITView on GitHub

React and Next.js performance best-practices reference — 57 rules across 8 categories, prioritized by impact.

48 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use app-renderer-systems, refactoring-analysis and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • pedronauckSkill

    app-renderer-systems

    Create, extend, or debug frontend domain modules organized under systems/. Covers adapters, Query hooks, local state, and public exports; excludes generic components and backend implementation.

    Also in 3 projects that use this

  • pedronauckSkill

    refactoring-analysis

    Audit code quality and architectural health or plan refactoring using Fowler code smells and techniques; write prioritized findings to docs/_refacs/. Excludes formatting, performance, and security audits.

    Also in 3 projects that use this

  • andyridsSkill

    express

    Run the ICM express-change pipeline - a small change no spec has to move for, with the plan record left intact

    Also in 4 projects that use this

  • tondevrelSkill

    pytorch

    Leading deep learning framework. Provides Tensors and Dynamic Computational Graphs with strong GPU acceleration. Widely used for research, neural networks, and differentiable programming.

    Also in 3 projects that use this

  • azlekovSkill

    tailwindcss

    This skill should be used when the user asks to "style with Tailwind", "add CSS", "configure theme", "use @theme", "add custom colors", "implement dark mode", "use container queries", "add responsive design", "use OKLCH colors", or discusses styling, theming, or visual design. Always use the latest Tailwind CSS version and modern patterns.

    Also in 5 projects that use this

  • jander99Skill

    typescript-advanced

    Design, implement, refactor, and debug advanced TypeScript patterns including generics, utility types, mapped types, conditional types, type guards, discriminated unions, and strict mode configuration. Use when writing type-safe code, fixing type errors, or improving type inference.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

28 rules. 0 are common, 15 are distinctive, and 13 are very specific to this project.

  • 0

    Common

    Most of the 37 edited versions we read keep these.

  • 15

    Distinctive

    This author's own choices. Worth a look.

  • 13

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    async-parallel: Use Promise.all() for independent operations

    line 37
  2. Very specific:

    async-dependencies: Use better-all for partial dependencies

    line 38
  3. Distinctive:

    async-api-routes: Start promises early, await late in API routes

    line 39
  4. Distinctive:

    async-suspense-boundaries: Use Suspense to stream content

    line 40
  5. Distinctive:

    Key pattern: If two fetches don't depend on each other, run them in parallel:

    line 42
  6. Very specific:

    bundle-barrel-imports: Import directly, avoid barrel files (import { X } from './X' not from './index')

    line 54
  7. Very specific:

    bundle-dynamic-imports: Use next/dynamic for heavy components

    line 55
  8. Very specific:

    server-cache-react: Use React.cache() for per-request deduplication

    line 63
  9. Distinctive:

    server-cache-lru: Use LRU cache for cross-request caching

    line 64
  10. Distinctive:

    server-dedup-props: Avoid duplicate serialization in RSC props

    line 65
  11. Very specific:

    server-after-nonblocking: Use after() for non-blocking operations

    line 68
  12. Distinctive:

    Key pattern: Only send what the client needs:

    line 70
  13. Distinctive:

    client-swr-dedup: Use SWR for automatic request deduplication

    line 81
  14. Distinctive:

    client-passive-event-listeners: Use passive listeners for scroll

    line 83
  15. Distinctive:

    rerender-defer-reads: Don't subscribe to state only used in callbacks

    line 88
  16. Distinctive:

    rerender-dependencies: Use primitive dependencies in effects

    line 91
  17. Very specific:

    rerender-functional-setstate: Use functional setState for stable callbacks

    line 94
  18. Distinctive:

    rerender-simple-expression-in-memo: Avoid memo for simple primitives

    line 96
  19. Distinctive:

    rerender-move-effect-to-event: Put interaction logic in event handlers

    line 97
  20. Very specific:

    rerender-transitions: Use startTransition for non-urgent updates

    line 98
  21. Distinctive:

    rerender-use-ref-transient-values: Use refs for transient frequent values

    line 99
  22. Very specific:

    rendering-content-visibility: Use content-visibility for long lists

    line 115
  23. Distinctive:

    rendering-hydration-no-flicker: Use inline script for client-only data

    line 117
  24. Distinctive:

    rendering-activity: Use Activity component for show/hide

    line 118
  25. Very specific:

    rendering-conditional-render: Use ternary, not && for conditionals

    line 119
  26. Very specific:

    rendering-usetransition-loading: Prefer useTransition for loading state

    line 120
  27. Very specific:

    js-set-map-lookups: Use Set/Map for O(1) lookups

    line 127
  28. Very specific:

    js-tosorted-immutable: Use toSorted() for immutability

    line 129

“Common” is measured: kept by at least 6 in 10 of the 37 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Vercel React Best Practices

Adapted from vercel-labs/agent-skills

Comprehensive performance optimization guide for React and Next.js applications, maintained by Vercel. 57 rules across 8 categories, prioritized by impact.

When to Apply

  • Writing new React components or Next.js pages
  • Implementing data fetching (client or server-side)
  • Reviewing code for performance issues
  • Refactoring existing React/Next.js code
  • Optimizing bundle size or load times

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Eliminating WaterfallsCRITICALasync-
2Bundle Size OptimizationCRITICALbundle-
3Server-Side PerformanceHIGHserver-
4Client-Side Data FetchingMEDIUM-HIGHclient-
5Re-render OptimizationMEDIUMrerender-
6Rendering PerformanceMEDIUMrendering-
7JavaScript PerformanceLOW-MEDIUMjs-
8Advanced PatternsLOWadvanced-

1. Eliminating Waterfalls (CRITICAL)

  • async-defer-await: Move await into branches where actually used
  • async-parallel: Use Promise.all() for independent operations
  • async-dependencies: Use better-all for partial dependencies
  • async-api-routes: Start promises early, await late in API routes
  • async-suspense-boundaries: Use Suspense to stream content

Key pattern: If two fetches don't depend on each other, run them in parallel:

// BAD: Sequential
const user = await getUser(id)
const posts = await getPosts(id)

// GOOD: Parallel
const [user, posts] = await Promise.all([getUser(id), getPosts(id)])

2. Bundle Size Optimization (CRITICAL)

  • bundle-barrel-imports: Import directly, avoid barrel files (import { X } from './X' not from './index')
  • bundle-dynamic-imports: Use next/dynamic for heavy components
  • bundle-defer-third-party: Load analytics/logging after hydration
  • bundle-conditional: Load modules only when feature is activated
  • bundle-preload: Preload on hover/focus for perceived speed

3. Server-Side Performance (HIGH)

  • server-auth-actions: Authenticate server actions like API routes
  • server-cache-react: Use React.cache() for per-request deduplication
  • server-cache-lru: Use LRU cache for cross-request caching
  • server-dedup-props: Avoid duplicate serialization in RSC props
  • server-serialization: Minimize data passed to client components
  • server-parallel-fetching: Restructure components to parallelize fetches
  • server-after-nonblocking: Use after() for non-blocking operations

Key pattern: Only send what the client needs:

// BAD: Passing entire object
<ClientComponent data={fullUserObject} />

// GOOD: Pick only needed fields
<ClientComponent name={user.name} avatar={user.avatar} />

4. Client-Side Data Fetching (MEDIUM-HIGH)

  • client-swr-dedup: Use SWR for automatic request deduplication
  • client-event-listeners: Deduplicate global event listeners
  • client-passive-event-listeners: Use passive listeners for scroll
  • client-localstorage-schema: Version and minimize localStorage data

5. Re-render Optimization (MEDIUM)

  • rerender-defer-reads: Don't subscribe to state only used in callbacks
  • rerender-memo: Extract expensive work into memoized components
  • rerender-memo-with-default-value: Hoist default non-primitive props
  • rerender-dependencies: Use primitive dependencies in effects
  • rerender-derived-state: Subscribe to derived booleans, not raw values
  • rerender-derived-state-no-effect: Derive state during render, not effects
  • rerender-functional-setstate: Use functional setState for stable callbacks
  • rerender-lazy-state-init: Pass function to useState for expensive values
  • rerender-simple-expression-in-memo: Avoid memo for simple primitives
  • rerender-move-effect-to-event: Put interaction logic in event handlers
  • rerender-transitions: Use startTransition for non-urgent updates
  • rerender-use-ref-transient-values: Use refs for transient frequent values

Key pattern: Derive state during render, not in effects:

// BAD: Effect to derive state
const [items, setItems] = useState([])
const [filteredItems, setFilteredItems] = useState([])
useEffect(() => { setFilteredItems(items.filter(i => i.active)) }, [items])

// GOOD: Derive during render
const [items, setItems] = useState([])
const filteredItems = items.filter(i => i.active)

6. Rendering Performance (MEDIUM)

  • rendering-content-visibility: Use content-visibility for long lists
  • rendering-hoist-jsx: Extract static JSX outside components
  • rendering-hydration-no-flicker: Use inline script for client-only data
  • rendering-activity: Use Activity component for show/hide
  • rendering-conditional-render: Use ternary, not && for conditionals
  • rendering-usetransition-loading: Prefer useTransition for loading state

7. JavaScript Performance (LOW-MEDIUM)

  • js-batch-dom-css: Group CSS changes via classes or cssText
  • js-index-maps: Build Map for repeated lookups
  • js-combine-iterations: Combine multiple filter/map into one loop
  • js-set-map-lookups: Use Set/Map for O(1) lookups
  • js-early-exit: Return early from functions
  • js-tosorted-immutable: Use toSorted() for immutability

8. Advanced Patterns (LOW)

  • advanced-event-handler-refs: Store event handlers in refs
  • advanced-init-once: Initialize app once per app load
  • advanced-use-latest: useLatest for stable callback refs

Reference

For full rule explanations with detailed code examples, install the original skill:

npx skills add https://github.com/vercel-labs/agent-skills --skill vercel-react-best-practices

Individual rule files are available at rules/<rule-name>.md in the original repo.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.