Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply 62 React and Next.js performance optimization rules from Vercel Engineering
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
README.md
1# React Best Practices23A structured repository for creating and maintaining React Best Practices optimized for agents and LLMs.45## Structure67- `rules/` - Individual rule files (one per rule)8- `_sections.md` - Section metadata (titles, impacts, descriptions)9- `_template.md` - Template for creating new rules10- `area-description.md` - Individual rule files11- `src/` - Build scripts and utilities12- `metadata.json` - Document metadata (version, organization, abstract)13- __`AGENTS.md`__ - Compiled output (generated)14- __`test-cases.json`__ - Test cases for LLM evaluation (generated)1516## Getting Started17181. Install dependencies:19```bash20pnpm install21```22232. Build AGENTS.md from rules:24```bash25pnpm build26```27283. Validate rule files:29```bash30pnpm validate31```32334. Extract test cases:34```bash35pnpm extract-tests36```3738## Creating a New Rule39401. Copy `rules/_template.md` to `rules/area-description.md`412. Choose the appropriate area prefix:42- `async-` for Eliminating Waterfalls (Section 1)43- `bundle-` for Bundle Size Optimization (Section 2)44- `server-` for Server-Side Performance (Section 3)45- `client-` for Client-Side Data Fetching (Section 4)46- `rerender-` for Re-render Optimization (Section 5)47- `rendering-` for Rendering Performance (Section 6)48- `js-` for JavaScript Performance (Section 7)49- `advanced-` for Advanced Patterns (Section 8)503. Fill in the frontmatter and content514. Ensure you have clear examples with explanations525. Run `pnpm build` to regenerate AGENTS.md and test-cases.json5354## Rule File Structure5556Each rule file should follow this structure:5758```markdown59---60title: Rule Title Here61impact: MEDIUM62impactDescription: Optional description63tags: tag1, tag2, tag364---6566## Rule Title Here6768Brief explanation of the rule and why it matters.6970**Incorrect (description of what's wrong):**7172```typescript73// Bad code example74```7576**Correct (description of what's right):**7778```typescript79// Good code example80```8182Optional explanatory text after examples.8384Reference: [Link](https://example.com)8586## File Naming Convention8788- Files starting with `_` are special (excluded from build)89- Rule files: `area-description.md` (e.g., `async-parallel.md`)90- Section is automatically inferred from filename prefix91- Rules are sorted alphabetically by title within each section92- IDs (e.g., 1.1, 1.2) are auto-generated during build9394## Impact Levels9596- `CRITICAL` - Highest priority, major performance gains97- `HIGH` - Significant performance improvements98- `MEDIUM-HIGH` - Moderate-high gains99- `MEDIUM` - Moderate performance improvements100- `LOW-MEDIUM` - Low-medium gains101- `LOW` - Incremental improvements102103## Scripts104105- `pnpm build` - Compile rules into AGENTS.md106- `pnpm validate` - Validate all rule files107- `pnpm extract-tests` - Extract test cases for LLM evaluation108- `pnpm dev` - Build and validate109110## Contributing111112When adding or modifying rules:1131141. Use the correct filename prefix for your section1152. Follow the `_template.md` structure1163. Include clear bad/good examples with explanations1174. Add appropriate tags1185. Run `pnpm build` to regenerate AGENTS.md and test-cases.json1196. Rules are automatically sorted by title - no need to manage numbers!120121## Acknowledgments122123Originally created by [@shuding](https://x.com/shuding) at [Vercel](https://vercel.com).124