agentleFS
JohuniqJohuniq/jolyui/.cursor/rules/react-guidelines.mdc

jolyui / rules

Cursor rule265 starsChanged 12 months agoMITView on GitHub

You are an expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI and Tailwind. Make sure not to start the dev server or run type of lint checking on agent mode.

We split this react-guidelines.mdc into the rules it gives an agent

20 rules. About 0 are common, 19 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈19

    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. Distinctive:

    Write concise, technical TypeScript code with accurate examples.

    line 12
  2. Distinctive:

    Use functional and declarative programming patterns.

    line 13
  3. Distinctive:

    Prefer iteration and modularization over code duplication.

    line 14
  4. Distinctive:

    Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).

    line 15
  5. Distinctive:

    Use console.log({ value }) instead of console.log(value)

    line 17
  6. Distinctive:

    Use onCallback instead of handleCallback

    line 18
  7. Distinctive:

    Use flex and gap instead of space-x-n and space-y-n

    line 19
  8. Distinctive:

    Use cn to compose class names

    line 20
  9. Distinctive:

    Use lowercase with dashes for directories (e.g., components/auth-wizard).

    line 25
  10. Distinctive:

    Use TypeScript for all code.

    line 30
  11. Distinctive:

    Avoid enums; use maps instead.

    line 31
  12. Distinctive:

    Use functional components with TypeScript interfaces.

    line 32
  13. Distinctive:

    Use the "function" keyword for pure functions.

    line 36
  14. Distinctive:

    Avoid unnecessary curly braces in conditionals.

    line 37
  15. Distinctive:

    Use Shadcn UI, Radix, and Tailwind for components and styling.

    line 42
  16. Distinctive:

    Use dynamic loading for non-critical components.

    line 49
  17. Distinctive:

    Use only for Web API access in small components.

    line 57
  18. Distinctive:

    Avoid for data fetching or state management.

    line 58
  19. Very specific:

    Follow Next.js docs for Data Fetching, Rendering, and Routing.

    line 59
  20. Distinctive:

    Make sure not to start the dev server or run type of lint checking on agent mode.

    line 61

≈ “Common” is an estimate: at least 1 in 5 of the 6,350 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
react-guidelines.mdc
---
description: 
globs: 
alwaysApply: true
---
# Expert Guidelines

You are an expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI and Tailwind.

## Code Style and Structure

- Write concise, technical TypeScript code with accurate examples.
- Use functional and declarative programming patterns; avoid classes.
- Prefer iteration and modularization over code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
- Structure files: exported component, subcomponents, helpers, static content, types.
- Use console.log({ value }) instead of console.log(value)
- Use onCallback instead of handleCallback
- Use flex and gap instead of space-x-n and space-y-n
- Use cn to compose class names
- Just pass ref directly to the component because of react 19

## Naming Conventions

- Use lowercase with dashes for directories (e.g., components/auth-wizard).
- Favor named exports for components.

## TypeScript Usage

- Use TypeScript for all code; prefer interfaces over types.
- Avoid enums; use maps instead.
- Use functional components with TypeScript interfaces.

## Syntax and Formatting

- Use the "function" keyword for pure functions.
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
- Use declarative JSX.

## UI and Styling

- Use Shadcn UI, Radix, and Tailwind for components and styling.
- Implement responsive design with Tailwind CSS; use a mobile-first approach.

## Performance Optimization

- Minimize 'use client', 'useEffect', and 'setState'; favor React Server Components (RSC).
- Wrap client components in Suspense with fallback.
- Use dynamic loading for non-critical components.
- Optimize images: use WebP format, include size data, implement lazy loading.

## Key Conventions

- Optimize Web Vitals (LCP, CLS, FID).
- Limit 'use client':
  - Favor server components and Next.js SSR.
  - Use only for Web API access in small components.
  - Avoid for data fetching or state management.
- Follow Next.js docs for Data Fetching, Rendering, and Routing.

Make sure not to start the dev server or run type of lint checking on agent mode.

Download now (ZIP)

  • 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 3,978 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 repository2 other files it gives its agents.

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.