Communitygithub.com

marnixGeerkens/rocketlauncher-claude-code

Next.js App Router 원칙: 서버 컴포넌트, 데이터 페칭, 라우팅 패턴.

rocketlauncher-claude-code란 무엇인가요?

이 스킬은 Next.js App Router 개발에 대한 모범 사례를 체계적으로 정리한 지침서입니다. 개발자는 서버 컴포넌트와 클라이언트 컴포넌트를 언제 사용해야 하는지, 데이터 페칭 전략(정적, ISR, 동적)을 어떻게 선택할지, 라우팅 및 레이아웃 구성을 위한 파일 규칙(page.tsx, layout.tsx 등)을 명확히 이해할 수 있습니다. 또한 API 라우트 핸들러, 이미지 최적화, 번들 최소화, 메타데이터 설정, 캐싱 계층 전략, 서버 액션 사용법과 함께 자주 발생하는 안티패턴을 피하는 방법까지 다룹니다. Next.js 프로젝트에서 성능과 유지보수성을 높이려는 개발자에게 유용하며, Claude Code, Cursor, Codex 등 다양한 AI 에이전트 플랫폼에서 활용할 수 있는 참고 자료입니다.

지원 대상✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/marnixGeerkens/rocketlauncher-claude-code/tree/HEAD/components/skills/development/nextjs-best-practices

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Next.js 모범 사례

Next.js App Router 개발을 위한 원칙.


1. 서버 컴포넌트 vs 클라이언트 컴포넌트

결정 트리

다음이 필요합니까...?
│
├── useState, useEffect, 이벤트 핸들러
│   └── 클라이언트 컴포넌트 ('use client')
│
├── 직접 데이터 페칭, 상호작용 없음
│   └── 서버 컴포넌트 (기본값)
│
└── 둘 다 필요?
    └── 분할: 서버 부모 + 클라이언트 자식

기본값

유형사용처
서버데이터 페칭, 레이아웃, 정적 콘텐츠
클라이언트폼, 버튼, 대화형 UI

2. 데이터 페칭 패턴

페치 전략

패턴사용처
기본값정적 (빌드 시 캐시됨)
RevalidateISR (시간 기반 갱신)
No-store동적 (매 요청마다)

데이터 흐름

소스패턴
데이터베이스서버 컴포넌트 fetch
API캐싱이 있는 fetch
사용자 입력클라이언트 상태 + 서버 액션

3. 라우팅 원칙

파일 규칙

파일용도
page.tsx라우트 UI
layout.tsx공유 레이아웃
loading.tsx로딩 상태
error.tsx에러 경계
not-found.tsx404 페이지

라우트 구성

패턴사용처
라우트 그룹 (name)URL 변경 없이 구성
병렬 라우트 @slot동일 레벨의 여러 페이지
가로채기 (.)모달 오버레이

4. API 라우트

라우트 핸들러

메서드사용처
GET데이터 읽기
POST데이터 생성
PUT/PATCH데이터 업데이트
DELETE데이터 삭제

모범 사례

  • Zod로 입력 유효성 검사
  • 적절한 상태 코드 반환
  • 오류를 우아하게 처리
  • 가능하면 Edge 런타임 사용

5. 성능 원칙

이미지 최적화

  • next/image 컴포넌트 사용
  • 접히는 영역 위의 이미지에는 priority 설정
  • 흐릿한 플레이스홀더 제공
  • 반응형 크기 사용

번들 최적화

  • 무거운 컴포넌트는 동적 임포트
  • 라우트 기반 코드 분할 (자동)
  • 번들 분석기로 분석

6. 메타데이터

정적 vs 동적

유형사용처
정적 내보내기고정 메타데이터
generateMetadata라우트별 동적 생성

필수 태그

  • title (50-60자)
  • description (150-160자)
  • Open Graph 이미지
  • 표준 URL (Canonical URL)

7. 캐싱 전략

캐시 계층

계층제어
요청fetch 옵션
데이터revalidate/tags
전체 라우트라우트 설정

재검증

방법사용처
시간 기반revalidate: 60
요청 시revalidatePath/Tag
캐시 없음no-store

8. 서버 액션

사용 사례

  • 폼 제출
  • 데이터 변경
  • 재검증 트리거

모범 사례

  • 'use server'로 표시
  • 모든 입력 유효성 검사
  • 타입이 있는 응답 반환
  • 오류 처리

9. 안티패턴

❌ 하지 말 것✅ 할 것
모든 곳에 'use client'기본적으로 서버 사용
클라이언트 컴포넌트에서 fetch서버에서 fetch
로딩 상태 생략loading.tsx 사용
에러 경계 무시error.tsx 사용
큰 클라이언트 번들동적 임포트 사용

10. 프로젝트 구조

app/
├── (marketing)/     # 라우트 그룹
│   └── page.tsx
├── (dashboard)/
│   ├── layout.tsx   # 대시보드 레이아웃
│   └── page.tsx
├── api/
│   └── [resource]/
│       └── route.ts
└── components/
    └── ui/

기억하세요: 서버 컴포넌트는 이유가 있어 기본값입니다. 거기서 시작하고, 필요한 경우에만 클라이언트를 추가하세요.

Individual skills in this repo

This repo contains 13 individual skills — each has its own dedicated page.

marnixGeerkens/rocketlauncher-claude-code

When the user wants to optimize, improve, or increase conversions on any marketing page — including homepage, landing pages, pricing pages, feature pages, or blog posts. Also use when the user says "CRO," "conversion rate optimization," "this page isn't converting," "improve conversions," or "why isn't this page working." For signup/registration flows, see signup-flow-cro. For post-signup activation, see onboarding-cro. For forms outside of signup, see form-cro. For popups/modals, see popup-cro.

marnixGeerkens/rocketlauncher-claude-code

Balance visual design with ATS compatibility for creative roles. Use when the user is in design, art, writing, marketing creative, or any visual/creative field and needs a resume that looks distinctive but still parses.

marnixGeerkens/rocketlauncher-claude-code

Transform resume bullets into detailed portfolio case studies with context, action, and outcome. Use when the user mentions portfolio, case study, project write-up, or expanding a resume bullet into a longer narrative.

marnixGeerkens/rocketlauncher-claude-code

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities. Use when: portfolio, personal website, showcase work, developer portfolio, designer portfolio.

marnixGeerkens/rocketlauncher-claude-code

Tailwind CSS v4 principles. CSS-first configuration, container queries, modern patterns, design token architecture.

marnixGeerkens/rocketlauncher-claude-code

Frontend development patterns for React, Next.js, state management, performance optimization, and UI best practices.

marnixGeerkens/rocketlauncher-claude-code

Frontend development guidelines for React/TypeScript applications. Modern patterns including Suspense, lazy loading, useSuspenseQuery, file organization with features directory, MUI v7 styling, TanStack Router, performance optimization, and TypeScript best practices. Use when creating components, pages, features, fetching data, styling, routing, or working with frontend code.

marnixGeerkens/rocketlauncher-claude-code

Expert integration of Supabase Auth with Next.js App Router Use when: supabase auth next, authentication next.js, login supabase, auth middleware, protected route.

marnixGeerkens/rocketlauncher-claude-code

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

marnixGeerkens/rocketlauncher-claude-code

Create API handoff documentation for frontend developers. Use when backend work is complete and needs to be documented for frontend integration, or user says 'create handoff', 'document API', 'frontend handoff', or 'API documentation'.

marnixGeerkens/rocketlauncher-claude-code

Document frontend data needs for backend developers. Use when frontend needs to communicate API requirements to backend, or user says 'backend requirements', 'what data do I need', 'API requirements', or is describing data needs for a UI.

marnixGeerkens/rocketlauncher-claude-code

Comprehensive Python library for astronomy and astrophysics. This skill should be used when working with astronomical data including celestial coordinates, physical units, FITS files, cosmological calculations, time systems, tables, world coordinate systems (WCS), and astronomical data analysis. Use when tasks involve coordinate transformations, unit conversions, FITS file manipulation, cosmological distance calculations, time scale conversions, or astronomical data processing.

marnixGeerkens/rocketlauncher-claude-code

Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.

관련 스킬