|
| 1 | +--- |
| 2 | +name: react-doctor |
| 3 | +description: Diagnose and fix React codebase health issues. Use when reviewing React code, fixing performance problems, auditing security, or improving code quality. |
| 4 | +version: 1.0.0 |
| 5 | +--- |
| 6 | + |
| 7 | +# React Doctor |
| 8 | + |
| 9 | +Scans your React codebase for security, performance, correctness, and architecture issues. Outputs a 0-100 score with actionable diagnostics. |
| 10 | + |
| 11 | +## Usage |
| 12 | + |
| 13 | +```bash |
| 14 | +npx -y react-doctor@latest . --verbose |
| 15 | +``` |
| 16 | + |
| 17 | +## Workflow |
| 18 | + |
| 19 | +1. Run the command above at the project root |
| 20 | +2. Read every diagnostic with file paths and line numbers |
| 21 | +3. Fix issues starting with errors (highest severity) |
| 22 | +4. Re-run to verify the score improved |
| 23 | + |
| 24 | +## Rules (47+) |
| 25 | + |
| 26 | +- **Security**: hardcoded secrets in client bundle, eval() |
| 27 | +- **State & Effects**: derived state in useEffect, missing cleanup, useState from props, cascading setState |
| 28 | +- **Architecture**: components inside components, giant components, inline render functions |
| 29 | +- **Performance**: layout property animations, transition-all, large blur values |
| 30 | +- **Correctness**: array index as key, conditional rendering bugs |
| 31 | +- **Next.js**: missing metadata, client-side fetching for server data, async client components |
| 32 | +- **Bundle Size**: barrel imports, full lodash, moment.js, missing code splitting |
| 33 | +- **Server**: missing auth in server actions, blocking without after() |
| 34 | +- **Accessibility**: missing prefers-reduced-motion |
| 35 | +- **Dead Code**: unused files, exports, types |
| 36 | + |
| 37 | +## Score |
| 38 | + |
| 39 | +- **75+**: Great |
| 40 | +- **50-74**: Needs work |
| 41 | +- **0-49**: Critical |
0 commit comments