Skip to main content
rule CX Codex

frontend — Claude Code rule: React/Next.js standards

frontend — a rule for React and Next.js projects: shadcn/ui components, Tailwind CSS v4, FSD-lite architecture, Server Components by default.

MIT ★ 1,472 updated 2026-10-29

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add first-fluke/oh-my-agent
/plugin install oma@oh-my-agent
Open on GitHub

What frontend does

This rule enforces coding standards for React and Next.js frontends. It uses shadcn/ui components as the UI foundation and extends them through cva variants and composition instead of custom CSS. Server Components by default, Client Components only for interactivity and API calls. Semantic HTML, ARIA labels, and keyboard navigation are mandatory.

FSD-lite architecture: shared code in src/, features in src/features/[feature]/ with no cross-feature imports. File names in kebab-case follow <domain>-<role>.tsx for components, <domain>.<kind>.ts for everything else. Grab-bag names like index.tsx, utils.ts, or helpers.ts are banned. Absolute imports via @/, import type required for types.

The rule applies only to **/*.{tsx,jsx,css,scss} files and only when explicitly invoked. It needs no FFmpeg, Python, or external APIs — just a set of conventions for your IDE.

What it helps with

  • enforce consistent code style across a React/Next.js team
  • ban prop drilling beyond three levels
  • stop developers from creating grab-bag files like utils.ts
  • default to Server Components for performance
  • validate accessibility in every component during review

Example prompts for the agent

  • Add a product card using shadcn/ui Card and put it in src/features/catalog/components/product-card.tsx
  • Refactor this hook into use-cart-sync.ts, move Jotai atoms to cart.atoms.ts
  • Check that OrderSummaryCard has ARIA labels and keyboard navigation

How to install frontend

1Plugin marketplace

/plugin marketplace add first-fluke/oh-my-agent
/plugin install oma@oh-my-agent

2Manually: put the files in place

.claude/rules/frontend.md

The paths frontmatter field limits the files

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about frontend

How to install frontend in Claude Code?

Run /plugin marketplace add first-fluke/oh-my-agent, then /plugin install oma@oh-my-agent. The rule will appear in .claude/rules/frontend.md.

What does the frontend rule do?

It enforces coding standards for React and Next.js: shadcn/ui components, Tailwind CSS v4, FSD-lite architecture, Server Components by default, consistent file naming, and a ban on grab-bag modules.

Why are utils.ts and helpers.ts files banned?

Grab-bag names hide what a module does. The rule requires domain and role in every filename: format-price.ts, cart.atoms.ts, orders.queries.ts.

Source text

frontend.md · MIT
---
description: React/Next.js frontend coding standards with shadcn/ui, Tailwind CSS v4, and FSD-lite architecture
globs: "**/*.{tsx,jsx,css,scss}"
alwaysApply: false
---

# Frontend Coding Standards

## Core Rules

Apply framework-specific rules only to that framework. Existing project choices take precedence over starter defaults; scoped changes do not authorize migrations.

1. **Component Reuse**: Use `shadcn/ui` components first. Extend via `cva` variants or composition. Avoid custom CSS.
2. **Design Fidelity**: Code must map 1:1 to `DESIGN.md` (Section 9 — Agent Prompt Guide) and Design Tokens. Resolve discrepancies before implementation.
3. **Rendering Strategy**: Default to Server Components for performance. Use Client Components only for interactivity and API integration.
4. **Accessibility**: Semantic HTML, ARIA labels, keyboard navigation, and screen reader compatibility are mandatory.
5. **Tool First**: Check for existing solutions and tools before coding.
7. **Request proxy convention**: when the target project uses Next.js 16+ with `proxy.ts`, preserve that convention. Check the installed framework version and routing before recommending a file rename. Diagnose wiring from code and tests.
7. **No Prop Drilling**: Avoid passing props beyond 3 levels. Use the project's client-state library (Jotai atoms or a Zustand store — see oma-frontend `resources/tech-stack.md`) instead. Avoid React Context.
8. **Auth Boundary**: Client code must not import database adapters or server-only auth code. Keep server-side application logic in the project's existing server boundary.
9. **Animation library**: preserve the project's existing animation library for scoped edits. For new motion-based implementations, use the `motion` package and `motion/react` imports.
10. **Framework version**: preserve the installed framework and dependency ranges for scoped changes. Select versions when scaffolding or when an upgrade is explicitly requested; do not upgrade an existing app to satisfy a starter default.

## Architecture (FSD-lite)

- **Root (`src/`)**: Shared logic (components, lib, types). Hoist common code here.
- **Feature (`src/features/*/`)**: Feature-specific logic. **No cross-feature imports.** Unidirectional flow only.

```
src/features/[feature]/
├── components/           # Feature UI components
│   └── skeleton/         # Loading skeleton components
├── types/                # Feature-specific type definitions
└── utils/                # Feature-specific utilities & helpers
```

## Naming Conventions

### Symbols

- Components/Types/Interfaces: `PascalCase`
- Functions/Vars/Hooks: `camelCase`
- Constants: `SCREAMING_SNAKE_CASE`
- Imports: Absolute `@/` is MANDATORY (no relative `../../`)
- MUST use `import type` for interfaces/types

### File Naming — self-describing names

**Principle: the filename alone must answer "what domain + what role". If a reader has to open the file to know what it is, the name is wrong.**

All files are `kebab-case`. Components use `<domain>-<ui-role>.tsx`; non-component modules use `<domain>.<kind>.ts`.

| Kind | Pattern | Example |
|------|---------|---------|
| Component | `<domain>-<ui-role>.tsx` | `order-summary-card.tsx` → `OrderSummaryCard` |
| Skeleton | `<component>-skeleton.tsx` | `order-summary-card-skeleton.tsx` |
| Hook | `use-<behavior>.ts` | `use-order-polling.ts` |
| TanStack Query | `<domain>.queries.ts` / `<domain>.mutations.ts` | `orders.queries.ts` |
| Jotai atoms | `<domain>.atoms.ts` | `cart.atoms.ts` |
| Zustand store | `<domain>.store.ts` | `cart.store.ts` |
| Zod schema | `<domain>.schema.ts` | `checkout.schema.ts` |
| Types | `<domain>.types.ts` | `order.types.ts` |
| Constants | `<domain>.constants.ts` | `payment.constants.ts` |
| API client | `<domain>.api.ts` | `orders.api.ts` |
| Utility | one capability per file, named as a verb phrase | `format-price.ts`, `parse-tracking-number.ts` |
| Test | colocated `<target>.test.ts(x)` | `format-price.test.ts` |

Rules:

1. **Filename = kebab-case of the main export.** One main export per file; `order-summary-card.tsx` exports `OrderSummaryCard`.
2. **Keep the domain in the name even inside a feature directory.** Editor tabs and search results show only the basename — `cart-summary-card.tsx`, not `summary-card.tsx` inside `features/cart/components/`.
3. **`index.ts` only as a feature public-API barrel** (`src/features/<feature>/index.ts`). Never `index.tsx` as a component file.
4. **Grab-bag filenames are BANNED**: `utils.ts`, `helpers.ts`, `common.ts`, `misc.ts`, `data.ts`, `styles.ts`, and bare `types.ts` / `constants.ts` / `hooks.ts` without a domain prefix. Split them by domain or capability instead.
5. **Version/status suffixes are BANNED**: `*-v2`, `*-new`, `*-old`, `*-final`, `*-copy`, `*-refactored`. Git owns history, not filenames.
6. **No abbreviations** beyond universally known ones (`api`, `db`, `i18n`, `a11y`): `user-profile-card.tsx`, never `usr-prf-crd.tsx`.

## Performance

- Target First Contentful Paint (FCP) < 1s
- Use `next/dynamic` for heavy components, `next/image` for media
- Responsive Breakpoints: 320px, 768px, 1024px, 1440px

© First Fluke · MIT · first-fluke/oh-my-agent

Similar IDE rules

All IDE rules for Frontend and UI →
frontend-architect curiositech frontend-architect — a skill for choosing a frontend framework, deploying to Cloudflare Pages, and building internal tool architectures. Recommends tech stacks, configures shadcn/ui, and bridges design tokens to components. CX Codex +1 191installs frontend-design customware-ai frontend-design is a Claude Code skill that sets visual guidelines for Tailwind and shadcn/ui layouts, banning generic purple SaaS cards, cramped tables, and unneeded sidebars. CX Codex +1 1,600installs typescript-nodejs-nextjs-react-ui-css-cursorrules- PatrickJS typescript-nodejs-nextjs-react-ui-css-cursorrules- — a Cursor rule that pins down how the agent writes TypeScript, Next.js App Router, React and Tailwind code. Useful when generated components drift from your conventions. CX Codex +1 ★ 41,178repo stars typescript-nodejs-nextjs-app-cursorrules-prompt-fi PatrickJS typescript-nodejs-nextjs-app-cursorrules-prompt-fi configures Cursor for Next.js App Router, TypeScript, Tailwind, and Shadcn UI. It enforces React Server Components and keeps client-side state minimal. CX Codex +1 ★ 41,178repo stars next.js-react-typescript-cursor-rules qdleader next.js-react-typescript-cursor-rules — a Claude Code rule for consistent Next.js, React, and TypeScript work. It covers App Router structure, UI conventions, and server-first rendering choices. CX Codex +1 ★ 571repo stars senior-frontend borghei senior-frontend — a skill for Claude Code, Codex, Cursor and other IDE tools builds React apps, components, tests and Storybook files. It also flags costly dependencies. CX Codex +1 357installs

From the same set69

The whole set →
research-explorer research-explorer — a subagent that answers research questions by searching three planes at once: docs and code, market signals, and academic literature. Returns findings with sources and confidence labels. CX Codex ★ 1,472repo stars database Enforces database schema design, normalization, indexing, and migration standards for SQL, NoSQL, and vector stores. Activates on .sql and .prisma files. CX Codex +1 ★ 1,472repo stars docs-curator docs-curator — a subagent that detects documentation drift and updates MD files when code changes. Catches broken references, proposes patches, and keeps docs/**/*.md aligned with the codebase. CX Codex ★ 1,472repo stars i18n-guide The i18n-guide rule sets how agents choose a response language and which project text gets localized. It fits workflows that need consistent language handling across user-facing output and code. CX Codex +1 ★ 1,472repo stars oma-docs Verifies documentation links, syncs docs against Git diffs, and flags translation drift. Runs through the oma docs CLI or falls back to manual markdown parsing. CX Codex +1 ★ 1,472repo stars oma-scm oma-scm — a skill that gives an agent a safe process for commits, branches, merges and conflict resolution. Use it when repository history matters and a careless force-push is not an option. CX Codex +1 ★ 1,472repo stars oma-skill-creation oma-skill-creation is a Claude Code skill for building and refining OMA skills in SSL-lite format for Claude Code and Codex. It runs during authoring, routing reviews, and contract validation. CX Codex +1 ★ 1,472repo stars oma-mobile oma-mobile — a mobile-focused skill: it builds screens and widgets in Flutter or React Native, wires camera, GPS, push and offline handling, then runs the checks. CX Codex +1 ★ 1,472repo stars

Project sponsors

Companies that keep this analytics open