agentleFS
bybren-llcbybren-llc/safe-agentic-workflow/.cursor/rules/11-frontend-react.mdc

safe-agentic-workflow / rules

Cursor rule419 starsChanged 4 months agoMITView on GitHub

Frontend development rules for React 18, Electron, ShadCN UI, and Tailwind CSS.

The file

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

12 rules. About 0 are common, 12 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use functional components with hooks (no class components)

    line 21
  2. Distinctive:

    Use TypeScript interfaces for all props

    line 22
  3. Distinctive:

    Follow ShadCN UI component patterns for consistency

    line 23
  4. Distinctive:

    Use Tailwind utility classes for styling (avoid custom CSS)

    line 24
  5. Distinctive:

    Use React hooks for local state

    line 40
  6. Distinctive:

    Use context for shared state within feature boundaries

    line 41
  7. Distinctive:

    Avoid prop drilling beyond 2 levels

    line 42
  8. Distinctive:

    All API calls must handle loading, error, and success states

    line 46
  9. Distinctive:

    Use proper error boundaries so analytics/API failures do not crash the app

    line 47
  10. Distinctive:

    All interactive elements must be keyboard-navigable

    line 52
  11. Distinctive:

    Use semantic HTML elements

    line 53
  12. Distinctive:

    Follow ShadCN UI's built-in accessibility patterns

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 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
11-frontend-react.mdc
---
description: "Frontend development rules for React 18, Electron, ShadCN UI, and Tailwind CSS."
globs: "sdk/**/*.tsx,sdk/**/*.ts,sdk/**/*.jsx,sdk/**/*.js"
alwaysApply: false
---

# Frontend React Rules

These rules apply when working on frontend code in `sdk/`.

## Technology Stack

- **Framework**: React 18
- **Desktop**: Electron
- **UI Library**: ShadCN UI components
- **Styling**: Tailwind CSS
- **Type Safety**: TypeScript (strict mode)

## Component Patterns

- Use functional components with hooks (no class components)
- Use TypeScript interfaces for all props
- Follow ShadCN UI component patterns for consistency
- Use Tailwind utility classes for styling (avoid custom CSS)

### Authenticated Pages

For pages requiring authentication, see `patterns_library/ui/authenticated-page.md`.

### Forms

For forms with validation, see `patterns_library/ui/form-with-validation.md` (React Hook Form + Zod).

### Data Tables

For paginated data tables, see `patterns_library/ui/data-table.md`.

## State Management

- Use React hooks for local state
- Use context for shared state within feature boundaries
- Avoid prop drilling beyond 2 levels

## API Integration

- All API calls must handle loading, error, and success states
- Use proper error boundaries so analytics/API failures do not crash the app
- Handle authentication token refresh transparently

## Accessibility

- All interactive elements must be keyboard-navigable
- Use semantic HTML elements
- Include ARIA labels where needed
- Follow ShadCN UI's built-in accessibility patterns

## Validation Commands

```bash
# TypeScript validation
{{TYPE_CHECK_COMMAND}}

# Linting
{{LINT_COMMAND}}

# Build verification
{{BUILD_COMMAND}}
```

## Key References

- See `patterns_library/ui/` for UI component patterns
- See `docs/security/SECURITY_FIRST_ARCHITECTURE.md` for client-side security
- See `CONTRIBUTING.md` for full workflow details

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.