agentleFS
luigi-dvluigi-dv/react-ts-vite/.cursor/rules/rtv-code-style.mdc

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.

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
  1. Very specific:

    Modules: import through aliases; order imports as external packages → aliases → relative, separated by blank lines.

    line 16

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
rtv-code-style.mdc
---
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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.