一键导入
frontend-patterns
React, Next.js, TypeScript frontend patterns - component design, state management, performance
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
React, Next.js, TypeScript frontend patterns - component design, state management, performance
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
OpenAI Codex CLI + Claude Code (Hizir) birlikte kullanim rehberi. Is dagitim pattern'leri, GitHub Actions workflow ornekleri, review dongusu ve iki AI yazilim asistaninin guclu yanlarini birlestiren orchestration stratejileri.
Create handoff document for transferring work to another session
Otonom deney dongusu. Kod degisikligi yap, olc, karsilastir, kabul et veya geri al. Metrik bazli karar verme ile performans, boyut veya kalite optimizasyonu. Tek basina veya agent ile kullan.
Planning agent that creates implementation plans and handoffs from conversation context
Use this skill when writing new features, fixing bugs, or refactoring code. Enforces test-driven development with 80%+ coverage including unit, integration, and E2E tests.
Pre-push API key and credential scanner - blocks git push if secrets found
| name | frontend-patterns |
| description | React, Next.js, TypeScript frontend patterns - component design, state management, performance |
// 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: 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>
);
}
| 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 |
// 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);
}, []);
| 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 |
// 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
| 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.memo sadece gercekten expensive render'lardauseMemo/useCallback sadece referans stability gerektigindeReact.lazy() + Suspense route bazlinext/image, lazy loading, WebP/AVIF@tanstack/virtual@next/bundle-analyzer ile kontrol<Link prefetch> kritik navigation'larda| 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 |