RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cursor rules/markstev/mark-starter

Cursor rule

.cursor/rules/frontend.mdc

Useful for building react full stack applicationsj

Cursor rules

Quality

99/100

Scores the file, not the repository.

Length

1,124 words

20 headings · 1 code blocks

Repository

0

— · pushed 304 days ago

Last changed

3 days ago

First indexed 3 days ago.
markstev/mark-starter/.cursor/rules/frontend.mdcRawGitHub
1---
2description: Useful for building react full stack applicationsj
3globs: web/*.{ts,tsx,js,jsx}
4alwaysApply: false
5---
6You are an expert TypeScript software engineer and architect with over 10 years of industry experience. Your expertise spans the entire stack, including React, Next.js 15 (with App Router), Tailwind CSS, shadcn/ui, Radix, Cloudflare (hono), Bun, Postgres andDrizzle .
7 
8 
9### Code Style and Structure
10 
11- Write concise, technical TypeScript code with accurate examples.
12- Use functional and declarative programming patterns; avoid classes.
13- Prefer iteration and modularization over code duplication.
14- Use descriptive variable names with auxiliary verbs (e.g., `isLoading`, `hasError`).
15- Structure files: exported component, subcomponents, helpers, static content, types.
16 
17### Frontend Components
18 
19- Prefer Server Components over Client Components when possible to reduce client-side JavaScript.
20- Avoid using `useEffect` unless absolutely necessary for client-side-only logic or interactions.
21- When `useEffect` is needed in Client Components, clearly justify its use and consider alternatives.
22- Implement proper error boundaries and loading states for better user experience.
23- Using default shadcn/ui color theme (I.e not hardcoded)
24- Some shadcn/ui components have been improved.
25 
26### Component colocation
27When building Next.js applications, follow component co-location principles for better maintainability and code organization. Co-locate simple, feature-specific components (used only within a single page/feature) in a `_components` directory within that feature's folder. For shared components, use two main categories: UI components (from your component library like shadcn/ui) and app-specific reusable components. The folder structure should look like this:
28apps/
29 └── frontend/
30 └── src/
31 ├── app/
32 │ └── [feature]/
33 │ ├── page.tsx
34 │ └── _components/ # highly specific feature components (e.g., dashboard-stats.tsx)
35 └── components/
36 ├── ui/ # Component library components (shadcn/ui)
37 │ ├── button.tsx
38 │ └── card.tsx
39 └── layout/ # App specific, shared components, or if the feature is very large/complex put, create its own folder
40 ├── header.tsx
41 └── footer.tsx
42 └── forms/
43 
44Note sometimes, when a feature gets large and complex, it makes more sense to put it in the `component` folder instead, since it is more maintainable.
45 
46### Folder Structure
47Within the frontend, using nextjs, you can leverage route grouping using `(group)`
48The root layout component should be reserved only for providers and other configuration.
49 
50 
51### Web app Data Fetching
52 
53- Use TanStack Query as the primary data fetching solution:
54 - Use `useQuery` for GET operations
55 - Use `useMutation` for POST/PUT/DELETE operations
56- Avoid creating custom data fetching hooks (i.e `useFn`) unless absolutely necessary (2 or more separate components need the same data).
57- Instead, react-query within components, until multiple components require the same data.
58- Leverage TanStack Query's built-in features:
59 - Automatic background refetching
60 - Cache invalidation
61 - Optimistic updates
62 - Infinite queries for pagination
63 - Parallel queries when needed
64- Structure query keys consistently:
65 - Use array syntax: ['users', userId]
66 - Include relevant dependencies
67- Handle loading and error states using built-in properties:
68 - isLoading, isError, error, data
69- Use prefetching where appropriate for better UX
70- Implement proper retry and error handling strategies using TanStack Query configuration
71- You can use sonnet toast for handling toast notifications (toast.error, toast.success, toast.info, etc)
72 
73### Client vs Server Components
74Components that require React hooks or are interactive (like buttons, switches, forms) need a "use client" directive at the top of the file to render client-side.
75 
76Otherwise, Next.js will render them as server components, which reduces client-side JavaScript and improves performance.
77 
78### TRPC
79 
80For RPC's, you should use TRPC, which provides type safe, easy-to-use RPC's. For example, you would usually
81start with something like
82 
83```ts
84const trpcClient = useTRPC();
85 const router = useRouter();
86
87 const { data: grids, isLoading, error } = useQuery(
88 trpcClient.gridList.list.queryOptions()
89 );
90```
91 
92### Response types
93Creating response types when using the rpc client is not required. The hono-rpc we use lets us infer the response types safely.
94 
95 
96 
97 
98### Naming Conventions
99- Use lowercase with dashes for directories (e.g., `components/auth-wizard`).
100- Use kebab-case (`example-card.tsx`) for *all* components.
101- Favor named exports for components.
102 
103### TypeScript Usage
104 
105- Use TypeScript for all code; prefer interfaces over types.
106- Avoid enums; use maps instead.
107- Use functional components with TypeScript interfaces.
108 
109### Syntax and Formatting
110 
111- Use the `function` keyword for pure functions.
112- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
113- Never use `React.FC` or arrow functions to define components.
114- Use declarative JSX in web projects and React Native JSX in mobile projects.
115 
116### UI and Styling
117 
118- For React, use Shadcn UI, Radix, and Tailwind for components and styling.
119- Implement responsive design in React using Tailwind CSS, with a mobile-first approach.
120- Use the `cn` utility function from `clsx` or a similar library for joining Tailwind classes, especially for conditional styling.
121- Use new tailwind v4 semantic, i.e. size-4 instead of h-4 w-4 etc.
122 
123 
124### Performance Optimization
125 
126- Use dynamic loading for non-critical components.
127- Optimize images: use WebP format, include size data, implement lazy loading.
128 
129### Key Conventions
130 
131- Use 'nuqs' for URL search parameter state management (where applicable).
132- Optimize Web Vitals (LCP, CLS, FID).
133 
134### Architectural Thinking
135 
136- Always consider the broader system architecture when proposing solutions.
137- Explain your design decisions and trade-offs.
138- Suggest appropriate abstractions and patterns that enhance code reusability and maintainability.
139 
140### Code Quality
141 
142- Write clean, idiomatic TypeScript code with proper type annotations.
143- Implement error handling and edge cases.
144- Use modern ES6+ features appropriately.
145- For methods with more than one argument, use object destructuring: `function myMethod({ param1, param2 }: MyMethodParams) {...}`.
146 
147### Testing and Documentation
148 
149- Suggest unit tests for critical functions using Vitest and React Testing Library.
150- Provide JSDoc comments for complex functions and types.
151 
152### Performance and Optimization
153 
154- Consider performance implications of your code, especially for larger datasets or complex operations.
155- Suggest optimizations where relevant, explaining the benefits.
156 
157### Reasoning and Explanation
158 
159- Explain your thought process and decisions.
160- If multiple approaches are viable, outline them and explain the pros and cons of each.
161 
162### Continuous Improvement
163 
164 - Use functional and declarative programming patterns; avoid classes.
165 - Prefer iteration and modularization over code duplication.
166 - Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
167 - Structure files: exported component, subcomponents, helpers, static content, types.
168 Naming Conventions
169 - Use lowercase with dashes for directories (e.g., components/auth-wizard).
170 - Favor named exports for components.
171 TypeScript Usage
172 - Use TypeScript for all code; prefer interfaces over types.
173 - Avoid enums; use maps instead.
174 - Use functional components with TypeScript interfaces.
175 Syntax and Formatting
176 - Use the "function" keyword for pure functions.
177 - Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
178 - Never use ReactFC or arrow functions to define components
179 - Use declarative JSX.
180 
181<package_management>
182 
183- Use `pnpm` as the primary package manager for the project
184- Install dependencies using `pnpm add [package-name]`
185- Install dev dependencies using `pnpm add -D [package-name]`
186- Install workspace dependencies using `pnpm add -w [package-name]`
187</package_management>

Commands it names

  • pnpm
  • pnpm add [package-name]
  • pnpm add -D [package-name]
  • pnpm add -w [package-name]

Sections

  • Code Style and Structure
  • Frontend Components
  • Component colocation
  • Folder Structure
  • Web app Data Fetching
  • Client vs Server Components
  • TRPC
  • Response types
  • Naming Conventions
  • TypeScript Usage
  • Syntax and Formatting
  • UI and Styling
  • Performance Optimization
  • Key Conventions
  • Architectural Thinking
  • Code Quality
  • Testing and Documentation
  • Performance and Optimization
  • Reasoning and Explanation
  • Continuous Improvement

What it covers

setuptestlint-formatcode-stylearchitecturetypesuiperformancedo-notdocs

Stack — with the evidence

typescript

(1.00)

turborepo

(1.00)

biome

(1.00)

monorepo

(0.85)

pnpm

(0.85)

node

(0.70)

react

(0.70)

nextjs

(0.70)

hono

(0.70)

drizzle

(0.70)

postgres

(0.70)

tailwind

(0.70)

vitest

(0.70)

eslint

(0.70)

vercel

(0.70)

javascript

(0.60)

Glob targeting

  • web/*.{ts
  • tsx
  • js
  • jsx}

Format

Cursor rules

The most expressive format here. Many small .mdc files, each with frontmatter declaring when it should load, so a rule about migrations only enters context when a migration is open. Costs the most to maintain and only one editor reads it.

What the corpus says about it

Repository

Owner
markstev
Language
—
License
—
Archived
no

All configs in this repo

Also in markstev/mark-starter

Diff this repo’s formats

One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
markstev/mark-starter.cursor/rules/backend.mdc · 0Cursor rulestypescriptturborepo+14setuptesttypessecurity+386/1003 days ago
markstev/mark-starter.cursor/rules/db.mdc · 0Cursor rulestypescriptturborepo+14no sections44/1003 days ago
markstev/mark-starter.cursor/rules/rls.mdc · 0Cursor rulestypescriptturborepo+14no sections24/1003 days ago
markstev/mark-starter.cursor/rules/trpc.mdc · 0Cursor rulestypescriptturborepo+14no sections30/1003 days ago
Diff against .cursor/rules/backend.mdc Diff against .cursor/rules/db.mdc Diff against .cursor/rules/rls.mdc Diff against .cursor/rules/trpc.mdc

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45Cursor rulestypescriptpytest+15testlint-formatstylearch+5100/1003 days ago
hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126Cursor rulesgobun+5setupbuildtestlint-format+6100/1003 days ago
Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+13setuptestlint-formatstyle+799/1003 days ago
dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+15setuptestlint-formatstyle+799/1003 days ago
deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1Cursor rulestypescriptnextjs+5setuptestlint-formatstyle+799/1003 days ago
TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45Cursor rulestypescriptpytest+15teststyletesting-strategysecurity+397/1003 days ago
langflow-ai/langflow.cursor/rules/docs_development.mdc · 153kCursor rulespythonnode+16setupbuildtestlint-format+797/1003 days ago
skillrecordings/egghead-next.cursor/rules/gh-task-plan.mdc · 1.4kCursor rulestypescriptnode+14teststylearchtypes+296/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack