Skip to content
cccskills
FreePublished on GitHub

frontend-patterns

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

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md3.9 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

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

CozumNe ZamanKarmasiklik
useStateLocal component stateDusuk
useReducerComplex local stateOrta
ContextTheme, auth, localeDusuk-Orta
ZustandGlobal client stateOrta
React QueryServer stateOrta
URL paramsNavigation stateDusuk

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

FeatureNe Zaman
Server ComponentData fetch, no interactivity
Client ComponentonClick, useState, useEffect
Route HandlerAPI endpoint
MiddlewareAuth, redirect, rewrite
StreamingBuyuk 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

MetrikEsikOlcum
LCP (Largest Contentful Paint)< 2.5sCore Web Vital
CLS (Cumulative Layout Shift)< 0.1Core Web Vital
INP (Interaction to Next Paint)< 200msCore Web Vital
FCP (First Contentful Paint)< 1.8sLighthouse
TTI (Time to Interactive)< 3.8sLighthouse
Total JS bundle< 200KB gzippedBuild 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-PatternDogru Yol
Prop drilling (5+ level)Context veya state library
useEffect for derived stateuseMemo kullan
Index as keyUnique ID kullan
Premature optimizationProfiler ile olc, sonra optimize et

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

WCAG 2.2 AA compliance, ARIA patterns, keyboard navigation, screen reader optimization

The English summary is being prepared. Showing the original description.

vibeeval/vibecosystem538Updated Aug 9, 2026

axe-core integration, WCAG 2.2 AA checklist, keyboard navigation testing, screen reader testing, and ARIA pattern validation.

The English summary is being prepared. Showing the original description.

vibeeval/vibecosystem538Updated Aug 9, 2026

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

The English summary is being prepared. Showing the original description.

vibeeval/vibecosystem538Updated Aug 9, 2026

Framework for measuring and tracking agent response quality over time. Detects regressions before they reach production. Use when evaluating agent changes, auditing quality, or establishing performance baselines.

The English summary is being prepared. Showing the original description.

vibeeval/vibecosystem538Updated Aug 9, 2026

Agent Context Isolation

The English summary is being prepared. Showing the original description.

vibeeval/vibecosystem538Updated Aug 9, 2026

Agent ve skill dosyalarinin yapisal dogrulamasi. Frontmatter kontrol, naming convention, zorunlu bolum kontrolu, tutarlilik denetimi. Yeni agent/skill eklendiginde veya mevcut dosyalar duzenlediginde otomatik calistirilir.

The English summary is being prepared. Showing the original description.

vibeeval/vibecosystem538Updated Aug 9, 2026

See all skills by vibeeval

Report a problem with this skill