Communitygithub.com

marnixGeerkens/rocketlauncher-claude-code

Next.js App Router-Prinzipien. Server-Komponenten, Datenabruf, Routing-Muster.

Was ist rocketlauncher-claude-code?

Dieses Skill bietet eine umfassende Anleitung für die Entwicklung mit dem Next.js App Router. Es erklärt die grundlegenden Prinzipien, wann Server- und wann Client-Komponenten verwendet werden sollten, und bietet eine Entscheidungsmatrix zur einfachen Identifizierung des richtigen Komponententyps. Darüber hinaus behandelt das Skill Datenabrufmuster mit verschiedenen Fetch-Strategien (statisch, ISR, dynamisch) und beschreibt, wie Daten aus Datenbanken, APIs und Benutzereingaben effizient verarbeitet werden. Es enthält außerdem Richtlinien für Routing, API-Routen, Performance-Optimierung, Metadaten, Caching und Server-Aktionen. Das Skill ist für Entwickler gedacht, die Next.js-Anwendungen mit dem App Router erstellen, und unterstützt gängige Entwicklungsumgebungen wie Claude Code, Cursor und Codex. Die Empfehlungen basieren auf den offiziellen Next.js-Best-Practices und helfen, häufige Anti-Patterns zu vermeiden.

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

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Next.js Best Practices

Prinzipien für die Entwicklung mit dem Next.js App Router.


1. Server- vs. Client-Komponenten

Entscheidungsbaum

Braucht es...?
│
├── useState, useEffect, Event-Handler
│   └── Client-Komponente ('use client')
│
├── Direkter Datenabruf, keine Interaktivität
│   └── Server-Komponente (Standard)
│
└── Beides?
    └── Aufteilen: Server-Elternkomponente + Client-Kindkomponente

Standardmäßig

TypVerwendung
ServerDatenabruf, Layout, statischer Inhalt
ClientFormulare, Buttons, interaktive UI

2. Datenabrufmuster

Fetch-Strategie

MusterVerwendung
StandardStatisch (beim Build gecached)
RevalidateISR (zeitbasierte Aktualisierung)
No-storeDynamisch (bei jeder Anfrage)

Datenfluss

QuelleMuster
DatenbankDatenabruf in Server-Komponente
APIfetch mit Caching
BenutzereingabeClient-Status + Server-Aktion

3. Routing-Prinzipien

Dateikonventionen

DateiZweck
page.tsxRouten-UI
layout.tsxGemeinsames Layout
loading.tsxLadezustand
error.tsxFehlergrenze
not-found.tsx404-Seite

Routenorganisation

MusterVerwendung
Routengruppen (name)Organisation ohne URL
Parallele Routen @slotMehrere Seiten auf gleicher Ebene
Abfangen (.)Modale Overlays

4. API-Routen

Routen-Handler

MethodeVerwendung
GETDaten lesen
POSTDaten erstellen
PUT/PATCHDaten aktualisieren
DELETEDaten löschen

Best Practices

  • Eingaben mit Zod validieren
  • Korrekte Statuscodes zurückgeben
  • Fehler ordentlich behandeln
  • Wenn möglich Edge-Runtime verwenden

5. Performance-Prinzipien

Bildoptimierung

  • next/image-Komponente verwenden
  • Priorität für Inhalte oberhalb der Falz setzen
  • Blur-Placeholder bereitstellen
  • Responsive Größen verwenden

Bundle-Optimierung

  • Dynamische Imports für schwere Komponenten
  • Routenbasiertes Code-Splitting (automatisch)
  • Mit Bundle-Analyzer analysieren

6. Metadaten

Statisch vs. Dynamisch

TypVerwendung
Static exportFeste Metadaten
generateMetadataDynamisch pro Route

Essentielle Tags

  • title (50-60 Zeichen)
  • description (150-160 Zeichen)
  • Open Graph-Bilder
  • Kanonische URL

7. Caching-Strategie

Cache-Ebenen

EbeneKontrolle
Anfragefetch-Optionen
Datenrevalidate/tags
Vollständige RouteRoutenkonfiguration

Aktualisierung

MethodeVerwendung
Zeitbasiertrevalidate: 60
On-DemandrevalidatePath/Tag
Kein Cacheno-store

8. Server-Aktionen

Anwendungsfälle

  • Formularübermittlungen
  • Datenänderungen
  • Revalidierungsauslöser

Best Practices

  • Mit 'use server' markieren
  • Alle Eingaben validieren
  • Typisierte Antworten zurückgeben
  • Fehler behandeln

9. Anti-Patterns

❌ Nicht tun✅ Besser so
'use client' überallStandardmäßig Server
Datenabruf in Client-KomponentenDatenabruf im Server
Ladezustände überspringenloading.tsx verwenden
Fehlergrenzen ignorierenerror.tsx verwenden
Große Client-BundlesDynamische Imports

10. Projektstruktur

app/
├── (marketing)/     # Routengruppe
│   └── page.tsx
├── (dashboard)/
│   ├── layout.tsx   # Dashboard-Layout
│   └── page.tsx
├── api/
│   └── [resource]/
│       └── route.ts
└── components/
    └── ui/

Denk dran: Server-Komponenten sind aus gutem Grund der Standard. Fang dort an, füg Client-Komponenten nur hinzu, wenn nötig.

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.

Verwandte Skills