← スキル一覧に戻る

nextjs-ssr-optimization
by zero-rehq
⭐ 0🍴 0📅 2026年1月16日
SKILL.md
name: nextjs-ssr-optimization description: Optimiza rendering performance para Next.js applications (SSR, SSG, ISR, streaming). compatibility: opencode
Skill: Next.js SSR Optimization
Status: Template para nuevo skill (detectado por skills-router-agent como gap)
Para qué sirve
- Optimizar rendimiento de rendering en Next.js
- Implementar patrones: SSR, SSG, ISR, Server Components
- Reducir Time to First Byte (TTFB) y First Contentful Paint (FCP)
- Streaming para mejor perceived performance
Casos de uso
- Páginas lentas en SSR (TTFB > 1s)
- Necesidad de caching incremental (ISR)
- Migración de CSR a SSR/SSG
- Implementación de Server Components
- Optimización de data fetching en server
Recomendaciones principales
- Server Components por defecto (no "use client" innecesario)
- Streaming para slow data fetching (Suspense boundaries)
- ISR para datos que cambian poco (revalidate every X segundos)
- SSG para datos estáticos (generateStaticParams)
- Parallel data fetching en server (Promise.all, no waterfalls)
- LRU cache para DB queries cross-request
- React.cache() para memoizar server fetches
- Preloading de datos critical (preload(), prefetch())
Checklist de optimización
- Usar Server Components donde aplica
- Implementar Suspense boundaries para streaming
- Configurar ISR para datos semi-estáticos
- Usar generateStaticParams para rutas dinámicas estáticas
- Parallel data fetching (Promise.all)
- React.cache() para server fetches duplicados
- LRU cache para cross-request caching
- preload() para critical resources
Métricas a mejorar
- TTFB (Time to First Byte)
- FCP (First Contentful Paint)
- LCP (Largest Contentful Paint)
- TTI (Time to Interactive)
- CLS (Cumulative Layout Shift)
Integración con react-best-practices
- React-best-practices reglas CRITICAL aplican
- Reglas SSR-specific:
- no-serializable-props: Minimizar data serializada a Client Components
- server-first-fetching: Fetch en server, no en Client Components
- streaming-suspense: Suspense boundaries para slow data
Ejemplo de uso
// ❌ MAL: Client fetching en browser
'use client';
export default function Page() {
const [data, setData] = useState(null);
useEffect(() => {
fetch('/api/data').then(r => r.json()).then(setData);
}, []);
return <div>{data?.name}</div>;
}
// ✅ BIEN: Server fetching con streaming
async function getData() {
return fetch('https://api.example.com/data').then(r => r.json());
}
export default async function Page() {
const data = await getData(); // Server-side
return <div>{data.name}</div>;
}
// ✅ MEJOR: Streaming con Suspense
import { Suspense } from 'react';
async function SlowComponent() {
const data = await fetch('https://api.example.com/slow').then(r => r.json());
return <div>{data.name}</div>;
}
export default function Page() {
return (
<div>
<h1>Fast content loads immediately</h1>
<Suspense fallback={<div>Loading slow content...</div>}>
<SlowComponent />
</Suspense>
</div>
);
}
Implementación pendiente
- Scripts de análisis SSR
- Reglas específicas para SSR
- Workflows para migración CSR→SSR
- Templates para ISR patterns
Generated as gap template from skills-router-agent
スコア
総合スコア
50/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です