Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/nedcodes-ok/cursor-doctor/reactgit clone --depth 1 https://github.com/nedcodes-ok/cursor-doctorWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00565 | $0.00565 |
| Opus 5 | $0.00282 | $0.00282 |
| Sonnet 5 | $0.00113 | $0.00113 |
| Haiku 4.5 | $0.00056 | $0.00056 |
Grade A, and why
react scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
This is a copy
100% identical to react — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 55 lines — stays where its author put it; the contents beside it link to each section on GitHub.
React Cursor Rules
You are an expert React developer. Follow these rules:
Components
- Functional components only. No class components
- Keep under 150 lines. Extract hooks and sub-components early
- Named exports, one component per file
- Descriptive names: UserProfileCard not Card
- Colocate styles, tests, and types with the component file
- Props interface named
{ComponentName}Props, defined above the component - Default props via destructuring defaults, not
defaultProps - Avoid spreading props blindly (
{...props}). Be explicit about what's passed
State Management
- useState for local UI state, useReducer for complex logic with multiple related values
- Lift state only as high as needed — avoid prop drilling beyond 2 levels
- Context for global concerns (theme, auth, locale). Never for frequently updating values
- Server state belongs in TanStack Query or SWR, not useState/useReducer/Context
- Derive values from existing state instead of syncing with useEffect
- URL is state too: use searchParams for filters, pagination, selected tabs
- Form state: use controlled inputs for validation, uncontrolled (refs) for simple forms
Hooks
- Follow Rules of Hooks. Use ESLint plugin
- Extract reusable logic into custom hooks (use* prefix)
- useMemo/useCallback only with demonstrated performance need — profile first
- Complete dependency arrays. Never disable exhaustive-deps
- useEffect is for synchronization with external systems, not for derived state
- Cleanup functions in useEffect for subscriptions, timers, event listeners
- Custom hooks should return objects (not arrays) when returning 3+ values
Patterns
- Composition over configuration: children/render props over config objects
- Handle loading, error, and empty states in every data component
- ErrorBoundary at route/feature boundaries, not around individual components
- React.lazy + Suspense for route-level code splitting
- Container/presenter split: logic hooks in containers, pure rendering in presenters
- Avoid conditional hooks. Move conditions inside the hook or split components
- Render lists in their own component to isolate re-renders
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 55 lines · 565 tokens per session scan A 022a2f18c45b
react is a cursor rule published in the GitHub repository nedcodes-ok/cursor-doctor (9 stars, last pushed 5mo ago), licensed MIT. It adds 565 tokens to every session, about $0.0028 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to react, differing in 0 lines, and is treated as a copy.
Other cursor rules, from other repositories
angular
Angular: signals, standalone components, RxJS patterns.
django
Django: models, views, ORM best practices.
java
Modern Java: records, sealed classes, streams, virtual threads.
javascript
Modern JavaScript: ES2023+, async patterns, common traps.
rust
Rust patterns: ownership, Result types, iterators.
accessibility
Accessibility: semantic HTML, ARIA, keyboard navigation, testing.