RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cursor rules/KAMAL20201/SneakerMarketplace

Cursor rule

.cursor/rules/react-patterns.mdc
Cursor rules

Quality

58/100

Scores the file, not the repository.

Length

336 words

10 headings · 1 code blocks

Repository

0

— · pushed 0 days ago

Last changed

3 days ago

First indexed 3 days ago.
KAMAL20201/SneakerMarketplace/.cursor/rules/react-patterns.mdcRawGitHub
1# React Patterns and Best Practices
2 
3## Component Structure
4 
5- Use functional components with hooks
6- Place components in appropriate directories:
7 - `src/components/ui/` for reusable UI components
8 - `src/components/` for feature-specific components
9 - `src/pages/` for page-level components
10- Use PascalCase for component names and files
11 
12## Context Usage
13 
14- Use React Context for global state (Auth, Cart, Payment)
15- Wrap providers in `src/Provider.tsx`
16- Access context values using custom hooks (e.g., `useAuth()`, `useCart()`)
17- Keep context providers lightweight and focused
18 
19## Custom Hooks
20 
21- Create custom hooks in `src/hooks/` directory
22- Use descriptive names starting with `use` (e.g., `useMobile`, `useAddressStorage`)
23- Keep hooks focused on single responsibility
24- Return objects with clear property names
25 
26## State Management
27 
28- Use `useState` for local component state
29- Use `useReducer` for complex state logic
30- Minimize `useEffect` usage - prefer event-driven updates
31- Use context for cross-component state sharing
32 
33## Form Handling
34 
35- Use React Hook Form with Zod validation
36- Define validation schemas in `src/lib/validations/`
37- Use controlled components for form inputs
38- Handle form submission with proper error handling
39 
40## Event Handling
41 
42- Use descriptive handler names (e.g., `handleAddToCart`, `handleFormSubmit`)
43- Pass event objects to handlers when needed
44- Use proper event types for TypeScript
45- Prevent default behavior when appropriate
46 
47## Component Composition
48 
49- Use composition over inheritance
50- Pass children as props when appropriate
51- Use render props or function children for complex logic
52- Keep components focused and single-purpose
53 
54## Performance Considerations
55 
56- Use `React.memo` for expensive components
57- Use `useCallback` for event handlers passed to child components
58- Use `useMemo` for expensive calculations
59- Lazy load routes and heavy components
60 
61## Example Patterns
62 
63```typescript
64// Good: Functional component with proper typing
65export const ProductCard: React.FC<ProductCardProps> = ({
66 product,
67 onAddToCart,
68}) => {
69 const handleClick = useCallback(() => {
70 onAddToCart(product.id);
71 }, [product.id, onAddToCart]);
72 
73 return <div className="product-card">{/* component content */}</div>;
74};
75 
76// Good: Custom hook usage
77const { user, signIn } = useAuth();
78const { addToCart } = useCart();
79```
80 
81description:
82globs:
83alwaysApply: false
84 
85---
86 

Sections

  • React Patterns and Best Practices
  • Component Structure
  • Context Usage
  • Custom Hooks
  • State Management
  • Form Handling
  • Event Handling
  • Component Composition
  • Performance Considerations
  • Example Patterns

What it covers

code-stylearchitectureuiperformance

Stack — with the evidence

typescript

(1.00)

supabase

(1.00)

vite

(1.00)

eslint

(1.00)

vercel

(1.00)

react

(0.70)

tailwind

(0.70)

aws

(0.70)

javascript

(0.60)

github-actions

(0.60)

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
KAMAL20201
Language
—
License
—
Archived
no

All configs in this repo

Also in KAMAL20201/SneakerMarketplace

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
KAMAL20201/SneakerMarketplace.cursor/rules/api-patterns.mdc · 0Cursor rulestypescriptsupabase+8styletypessecuritydatabase+158/1003 days ago
KAMAL20201/SneakerMarketplace.cursor/rules/development-workflow.mdc · 0Cursor rulestypescriptsupabase+8buildteststyletypes+481/1003 days ago
KAMAL20201/SneakerMarketplace.cursor/rules/project-conventions.mdc · 0Cursor rulestypescriptsupabase+8buildteststylearch+477/1003 days ago
KAMAL20201/SneakerMarketplace.cursor/rules/project-overview.mdc · 0Cursor rulestypescriptsupabase+8stylearchtypes52/1003 days ago
KAMAL20201/SneakerMarketplace.cursor/rules/typescript-standards.mdc · 0Cursor rulestypescriptsupabase+8styletypesapiui+161/1003 days ago
KAMAL20201/SneakerMarketplace.cursor/rules/ui-components.mdc · 0Cursor rulestypescriptsupabase+8archui54/1003 days ago
KAMAL20201/SneakerMarketplaceAGENTS.md · 0AGENTS.mdtypescriptsupabase+8stylesecuritydo-not45/1003 days ago
Diff against .cursor/rules/api-patterns.mdc Diff against .cursor/rules/development-workflow.mdc Diff against .cursor/rules/project-conventions.mdc Diff against .cursor/rules/project-overview.mdc Diff against .cursor/rules/typescript-standards.mdc Diff against .cursor/rules/ui-components.mdc Diff against AGENTS.md

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126Cursor rulesgobun+5setupbuildtestlint-format+6100/1003 days ago
TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45Cursor rulestypescriptpytest+15testlint-formatstylearch+5100/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
markstev/mark-starter.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+14setuptestlint-formatstyle+699/1003 days ago
Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+13setuptestlint-formatstyle+799/1003 days ago
langflow-ai/langflow.cursor/rules/docs_development.mdc · 153kCursor rulespythonnode+16setupbuildtestlint-format+797/1003 days ago
TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45Cursor rulestypescriptpytest+15teststyletesting-strategysecurity+397/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