Skip to content
Development
Skill

/frontend-patterns

React, Next.js, TypeScript frontend patterns - component design, state management, performance

From plugin
vibecosystem
541200 skills138 agents7 hooks

Claude Code

$ npx -y skills add vibeeval/vibecosystem --skill frontend-patterns --agent claude-code

SKILL.md

frontend-patterns.SKILL.md
name: frontend-patterns
description: React, Next.js, TypeScript frontend patterns - component design, state management, performance

Frontend Patterns

Component Design

Composition over Inheritance

// DOGRU: Composition
function Card({ children, header }: { children: ReactNode; header: ReactNode }) {
  return (
    <div className="card">
      <div className="card-header">{header}</div>
      <div className="card-body">{children}</div>
    </div>
  );
}

// Kullanim
<Card header={<h2>Title</h2>}>
  <p>Content here</p>
</Card>

Container/Presenter Pattern

// Container: Data fetching + logic
function UserListContainer() {
  const { data, isLoading } = useQuery(['users'], fetchUsers);
  if (isLoading) return <Skeleton />;
  return <UserList users={data} />;
}

// Presenter: Pure rendering
function UserList({ users }: { users: User[] }) {
  return (
    <ul>
      {users.map(u => <UserItem key={u.id} user={u} />)}
    </ul>
  );
}

State Management

| Cozum | Ne Zaman | Karmasiklik | |-------|----------|-------------| | useState | Local component state | Dusuk | | useReducer | Complex local state | Orta | | Context | Theme, auth, locale | Dusuk-Orta | | Zustand | Global client state | Orta | | React Query | Server state | Orta | | URL params | Navigation state | Dusuk |

Performance

// React.memo: Expensive render onleme
const ExpensiveList = React.memo(({ items }: { items: Item[] }) => (
  <ul>{items.map(i => <ListItem key={i.id} item={i} />)}</ul>
));

// useMemo: Expensive hesaplama cache
const filtered = useMemo(
  () => items.filter(i => i.status === status),
  [items, status]
);

// useCallback: Referans stabilitesi
const handleClick = useCallback((id: string) => {
  setSelected(id);
}, []);

Next.js Patterns

| Feature | Ne Zaman | |---------|----------| | Server Component | Data fetch, no interactivity | | Client Component | onClick, useState, useEffect | | Route Handler | API endpoint | | Middleware | Auth, redirect, rewrite | | Streaming | Buyuk data, progressive rendering |

shadcn/ui Best Practices

// Theme config: globals.css'te CSS variable kullan
// shadcn/ui dark mode: class strategy (Tailwind darkMode: 'class')

// Component override: cn() ile extend et, fork etme
import { Button } from '@/components/ui/button'
<Button variant="outline" className={cn('custom-class', className)} />

// Compose, override etme:
function SubmitButton({ children, ...props }: ButtonProps) {
  return <Button type="submit" variant="default" {...props}>{children}</Button>
}

// A11y: shadcn radix tabanli, otomatik ARIA ama kontrol et
// Dark mode: CSS variable'lar otomatik switch eder

Performance Budget

| Metrik | Esik | Olcum | |--------|------|-------| | LCP (Largest Contentful Paint) | < 2.5s | Core Web Vital | | CLS (Cumulative Layout Shift) | < 0.1 | Core Web Vital | | INP (Interaction to Next Paint) | < 200ms | Core Web Vital | | FCP (First Contentful Paint) | < 1.8s | Lighthouse | | TTI (Time to Interactive) | < 3.8s | Lighthouse | | Total JS bundle | < 200KB gzipped | Build analiz |

React Performance Top 10

1. `React.memo` sadece gercekten expensive render'larda 2. `useMemo`/`useCallback` sadece referans stability gerektiginde 3. Code splitting: `React.lazy()` + `Suspense` route bazli 4. Image optimization: `next/image`, lazy loading, WebP/AVIF 5. Virtual scroll: 100+ item listede `@tanstack/virtual` 6. Debounce: Arama input'unda 300ms debounce 7. Skeleton UI: Loading state icin layout shift onleme 8. Bundle analyze: `@next/bundle-analyzer` ile kontrol 9. Prefetch: `<Link prefetch>` kritik navigation'larda 10. Server Component: Default RSC, client sadece interactive icin

Anti-Patterns

| Anti-Pattern | Dogru Yol | |-------------|-----------| | Prop drilling (5+ level) | Context veya state library | | useEffect for derived state | useMemo kullan | | Index as key | Unique ID kullan | | Premature optimization | Profiler ile olc, sonra optimize et |

Read more
@vibeeval
Ships withvibecosystem

Your AI software team. Built on Claude Code. vibecosystem turns Claude Code into a full AI software team — 138 specialized agents that plan, build, review, test, and learn from every mistake. No configuration needed — just install and code.

541200 skills138 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
541
Star history of vibeeval/vibecosystem on GitHub, a chart by star-history.com

Other skills on vibecosystem.

achievements

achievements

Steam-style achievement system with XP, levels, streaks, and skill trees. Gamifies the development workflow. 25 achievements…

agent-benchmark

agent-benchmark

Framework for measuring and tracking agent response quality over time. Detects regressions before they reach production. Use when…

agent-linter

agent-linter

Agent ve skill dosyalarinin yapisal dogrulamasi. Frontmatter kontrol, naming convention, zorunlu bolum kontrolu, tutarlilik…

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc11d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about frontend-patterns.

Which coding agents can use frontend-patterns?
frontend-patterns installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.