react-ts-vite / rules
Cursor rule1 starsChanged 25 days agoMITView on GitHub
TypeScript, React and module conventions that keep the codebase readable as it grows.
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 4,183 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/rtv-architecture.mdcCursor rule
- .cursor/rules/rtv-design-system.mdcCursor rule
- .cursor/rules/rtv-git-workflow.mdcCursor rule
- .cursor/rules/rtv-testing.mdcCursor rule
- accessibility-auditSkill
- ci-cd-dockerSkill
- clean-code-reviewSkill
- dependency-upgradeSkill
- deployment-insightsSkill
- project-architectureSkill
- react-componentSkill
- scaffold-featureSkill
- tailwind-design-systemSkill
- testing-vitestSkill
The file
We split this rtv-code-style.mdc into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
Modules: import through aliases; order imports as external packages → aliases → relative, separated by blank lines.
≈ “Common” is an estimate: at least 1 in 5 of the 6,668 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
--- description: "TypeScript, React and module conventions that keep the codebase readable as it grows." globs: alwaysApply: true --- <!-- rtv:generated --> <!-- Generated from .agent/rules/code-style.md by `npm run agent:sync`. --> # Code style - **Formatting is Prettier's job** (`.prettierrc.json`: no semicolons, single quotes, trailing commas, 100 columns, Tailwind class sorting). Never hand-format or discuss style in reviews. - **TypeScript**: `strict` is on. No `any` (use `unknown` and narrow), no non-null assertions unless the invariant is explained in a comment, `import type` for type-only imports, `satisfies` for typed literals. Prefer `type` aliases for props and unions; `interface` only for extensible object contracts. - **Components**: one component per file, named `PascalCase`, folder `ComponentName/index.tsx` for anything with more than one file. Props are a `type ComponentNameProps`. Components are **named exports**; pages (route-level) and `App` are **default exports**. Keep a component under ~150 lines: split by responsibility, not by line count. - **Hooks** are `useSomething` and own stateful or side-effectful logic. Components stay presentational; data access goes through hooks, hooks call services. Follow the React Compiler-era lint rules (`react-hooks/*`): no `setState` inside effects, no mutation of props or state, derive values during render. - **Services** are plain TypeScript modules (no React, no JSX) with explicit return types. Errors are thrown as `Error` subclasses or returned as typed results; never swallow them silently. - **Modules**: import through aliases; order imports as external packages → aliases → relative, separated by blank lines. No default exports from barrels; `index.ts` re-exports only. - **Naming**: files mirror their export (`useTheme.ts`, `Button/index.tsx`, `formatCurrency.ts`); booleans read as predicates (`isOpen`, `hasError`); event handlers are `handleX` inside and `onX` as props. - **Comments** explain _why_, never _what_. No commented-out code, no `console.log` in committed code, no TODO without an owner or issue link. - **Dead code** is deleted, not kept "just in case". Git remembers. - **Small, reversible changes**: one concern per commit, generated files regenerated by their tool, not edited.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

