Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

react-server-components-framework

БесплатноЗапускает вложенные скриптыНе проверен

Design and implement React Server Components with Next.js 15 App Router. Master server-first architecture, streaming SSR, Server Actions, and modern data…

aiskillstoreот aiskillstore★ 509 звёзд на GitHub

Об этом скилле

React Server Components Framework

Overview

React Server Components (RSC) represent a paradigm shift in React architecture, enabling server-first rendering with client-side interactivity. This skill provides comprehensive patterns, templates, and best practices for building modern Next.js 15 applications using the App Router with Server Components, Server Actions, and streaming.

When to use this skill:

  • Building Next.js 15+ applications with the App Router
  • Designing component boundaries (Server vs Client Components)
  • Implementing data fetching with caching and revalidation
  • Creating mutations with Server Actions
  • Optimizing performance with streaming and Suspense
  • Implementing Partial Prerendering (PPR)
  • Designing advanced routing patterns (parallel, intercepting routes)

Why React Server Components Matter

RSC fundamentally changes how we think about React applications:

  • Server-First Architecture: Components render on the server by default, reducing client bundle size
  • Zero Client Bundle: Server Components don't ship JavaScript to the client
  • Direct Backend Access: Access databases, file systems, and APIs directly from components
  • Automatic Code Splitting: Only Client Components and their dependencies are bundled
  • Streaming & Suspense: Progressive rendering for instant perceived performance
  • Type-Safe Data Fetching: End-to-end TypeScript from database to UI
  • SEO & Performance: Server rendering improves Core Web Vitals and SEO

Core Concepts

1. Server Components vs Client Components

Server Components (default):

  • Can be async and use await
  • Direct database access
  • Cannot use hooks or browser APIs
  • Zero client JavaScript

Client Components (with 'use client'):

  • Can use hooks (useState, useEffect, etc.)
  • Browser APIs available
  • Cannot be async
  • Ships JavaScript to client

Key Rule: Server Components can render Client Components, but Client Components cannot directly import Server Components (use children prop instead).

Detailed Patterns: See references/component-patterns.md for:

  • Complete component boundary rules
  • Composition patterns
  • Props passing strategies
  • Common pitfalls and solutions

2. Data Fetching

Next.js extends the fetch API with powerful caching and revalidation:

// Static (cached indefinitely)
await fetch(url, { cache: 'force-cache' })

// Revalidate every 60 seconds
await fetch(url, { next: { revalidate: 60 } })

// Always fresh
await fetch(url, { cache: 'no-store' })

// Tag-based revalidation
await fetch(url, { next: { tags: ['posts'] } })

Patterns:

  • Parallel fetching: Promise.all([fetch1, fetch2, fetch3])
  • Sequential fetching: When data depends on previous results
  • Route segment config: Control static/dynamic rendering

Detailed Implementation: See references/data-fetching.md for:

  • Complete caching strategies
  • Revalidation methods (revalidatePath, revalidateTag)
  • Database queries in Server Components
  • generateStaticParams for SSG
  • Error handling patterns

3. Server Actions

Server Actions enable mutations without API routes:

// app/actions.ts
'use server'

export async function createPost(formData: FormData) {
  const title = formData.get('title') as string
  const post = await db.post.create({ data: { title } })

  revalidatePath('/posts')
  redirect(`/posts/${post.id}`)
}

Progressive Enhancement: Forms work without JavaScript, then enhance with client-side states.

Detailed Implementation: See references/server-actions.md for:

  • Progressive enhancement patterns
  • useFormStatus and useFormState hooks
  • Optimistic UI with useOptimistic
  • Validation with Zod
  • Inline vs exported Server Actions

4. Streaming with Suspense

Stream components independently for better perceived performance:

import { Suspense } from 'react'

export default function Dashboard() {
  return (
    <div>
      <Suspense fallback={<ChartSkeleton />}>
        <RevenueChart />
      </Suspense>

      <Suspense fallback={<InvoicesSkeleton />}>
        <LatestInvoices />
      </Suspense>
    </div>
  )
}

Benefits:

  • Show content as it's ready
  • Non-blocking data fetching
  • Better Core Web Vitals

Templates: Use templates/ServerComponent.tsx for streaming patterns

5. Advanced Routing

Parallel Routes: Render multiple pages simultaneously

app/
  @team/page.tsx
  @analytics/page.tsx
  layout.tsx  # Receives both as props

Intercepting Routes: Show modals while preserving URLs

app/
  photos/[id]/page.tsx      # Direct route
  (..)photos/[id]/page.tsx  # Intercepted (modal)

Partial Prerendering (PPR): Mix static and dynamic content

export const experimental_ppr = true

// Static shell + dynamic Suspense boundaries

Detailed Implementation: See references/routing-patterns.md for:

  • Parallel routes layout implementation
  • Intercepting routes for modals
Полный SKILL.md на GitHub

Установить react-server-components-framework в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

checklists/rsc-implementation-checklist.mdexamples/blog-app-example.tsxreferences/component-patterns.mdreferences/data-fetching.mdreferences/migration-guide.mdreferences/routing-patterns.mdreferences/server-actions.mdskill-report.jsontemplates/client-component-template.tsxtemplates/server-action-template.tstemplates/server-component-template.tsx

FAQ

Что делает скилл react-server-components-framework?

Design and implement React Server Components with Next.js 15 App Router. Master server-first architecture, streaming SSR, Server Actions, and modern data fetching patterns for 2025+ frontend development.

Как установить скилл react-server-components-framework?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл react-server-components-framework запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить react-server-components-framework с