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/openstory-so/openstory/react-rulesgit clone --depth 1 https://github.com/openstory-so/openstoryWhat 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.00000 | $0.00989 |
| Opus 5 | $0.00000 | $0.00495 |
| Sonnet 5 | $0.00000 | $0.00198 |
| Haiku 4.5 | $0.00000 | $0.00099 |
Grade A, and why
react-rules 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 2d ago.
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.
How it starts
The opening of the file, as written. The whole thing — 110 lines — stays where its author put it; the contents beside it link to each section on GitHub.
1. Use as little React as possible
- Keep components small - less than 100 lines
- Views reference components
- Remove as much logic as possible from components and views
- Externalize functions rather and keep external functions vanilla typescript
- Vanilla typescript is easier to test, and package for other uses
2. Avoid using useEffect
- Avoid using useEffect to fetch data or initialise state
- Use hooks, tanstack query, or the new
usefeature in react 19 - use useEffect to update state when something else changes
3. Use useState sparingly
- Using a local variable is often more optimal - even if something has to be calculated
- useState uses reducers under the hood
- If you have more than 3 useStates you might as well use reducers
4. Use React.FC and expand props
- Expand props so that each parameter is named
- It's easier to know which props are not used
5. Avoid globals and global state
- Globals including auth globals, often lead to race conditions
- Global state is only useful in rare cases. SPAs with signifant complexity
- Start with reducers which are passed through props
- If that's too complicated, use React context
- As a last resort for very complicated SPAs - use zustand
6. Use reducers
- Reducers are great - read up on them and understand them
- They keep all state update logic in one place
- They are vanilla typescript - keep them that way
- Use them to update state based on other state.
- Note that updating any part of the state returned from a reducer will cause a re-render if the whole state is a parameter - you can pass just parts of it
7. Avoid passing style to components
- Avoid passing styles to components, or styling your components in views
- Create components that are pre-styled
- Create variants - e.g. small, medium, large - rather than size={18}
- Avoid using styles in views as much as possible
8. Use the theme
- Create constants for your theme or use a consistent structure
- Use the theme fonts and colors
- Avoid naming fonts and inluding color values directly in views and components
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.
- 2d ago First seen · 110 lines · 989 tokens per session scan A 41e965deebf3
react-rules is a cursor rule published in the GitHub repository openstory-so/openstory (519 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 989 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
general
Wonder Blocks design system conventions, component patterns, and coding standards.
react-vite-web
Cursor rule "react-vite-web" from WellApp-ai/Well, covering web rules (react + vite), routing, component structure, state management and api integration.
frontend-patterns
React/TypeScript patterns for src/ code.
new-component
Workflow for creating new React components.
frontend-architecture
Vite + React SPA architecture - directory layout, providers, bundle splitting. Tailwind styling in tailwind.mdc.
component-patterns
React Component Patterns.