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.
git clone --depth 1 https://github.com/openstory-so/openstoryWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/openstory-so/openstory/react-rules)<a href="https://agentmods.dev/rules/openstory-so/openstory/react-rules"><img src="https://agentmods.dev/badge/rules/openstory-so/openstory/react-rules/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/openstory-so/openstory/react-rules"><img src="https://agentmods.dev/badge/rules/openstory-so/openstory/react-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What 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.1 | $0.00989 | $0.00989 |
| Opus 5.5 | $0.00396 | $0.00396 |
| Sonnet 5.5 | $0.00198 | $0.00198 |
| Haiku 4.5 | $0.00099 | $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 1mo 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.
- 1mo 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 (676 stars, last pushed yesterday), licensed MIT. It adds 989 tokens to every session, about $0.0040 per session on Opus 5.5. 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
windsurfrules
Create detailed components with these requirements.
backend
Backend development rules for TT Studio - AI model management backend.
tanstack-start-guide
TanStack Start best practices emphasizing client-first architecture, type safety, and modern React patterns.
project-structure
Folder layout for Next.js App Router and Vite + React variants.
rendering-and-memoization
React anti-patterns R9, R11, R12 — index-as-key in dynamic lists, context overuse for frequent updates, inline functions breaking memoization. Load on a review hit for any of these codes, or when tuning render performance.
react-basics-state
A set of React rules for managing shared application state with Context API and useReducer. React is a JavaScript library for building user interfaces; shared state is information used by multiple parts of an interface.