nextjs-architecture
Next.js architecture specialist. Use when designing Next.js applications, migrating to App Router, implementing Server Components, or optimizing Next.js performance. Covers App Router, Server Components, and best practices.
Оригинален текст · няма потвърден превод на българскиПърво прочетете инструкцията.
Файлът се зарежда от посочения източник само по ваше действие. Можете да го прочетете тук, да го копирате или да го запазите като .md.
GitHub хранилище- Звезди на репото
- 428
- Лиценз
- Не е посочен. Проверете в репозитория.
- Последна проверка на записа
- Няма посочена дата
Добавете в своя инструмент.
Командата отваря избора на skills от репозитория. Прочетете файла и условията на автора преди изпълнение.
npx skills add aiskillstore/marketplaceСтраницата копира текст. Не инсталира и не изпълнява нищо на устройството ви.
Откъс от SKILL.md
Началото на файла на автора, без превод.
Next.js Architecture
This skill provides Next.js architecture expertise including App Router, Server Components, performance optimization, and migration strategies.
When to Use This Skill
- When designing Next.js application architecture
- When migrating from Pages Router to App Router
- When implementing Server Components
- When optimizing Next.js performance
- When making Next.js architecture decisions
- When building full-stack Next.js applications
What This Skill Does
- Architecture Design: Designs Next.js application structure
- App Router: Implements App Router patterns and routing
- Server Components: Uses Server Components effectively
- Performance: Optimizes Next.js for production
- Migration: Migrates from Pages Router to App Router
- Best Practices: Applies Next.js best practices
How to Use
Design Architecture
Design the architecture for this Next.js application
Migrate this Pages Router app to App Router
Specific Patterns
Implement Server Components for this feature
Architecture Patterns
App Router Structure
app/
├── (auth)/
│ ├── login/page.tsx
│ └── register/page.tsx
├── dashboard/
│ ├── layout.tsx
│ ├── page.tsx
│ └── analytics/page.tsx
├── api/
│ └── users/route.ts
└── layout.tsx
Server Components
Pattern:
- Server Components by default
- Client Components with 'use client'
- Direct database access in Server Components
- Streaming with Suspense
Performance
Strategies:
- Static generation for known content
- ISR for frequently changing content
- Streaming for slow queries
- Image optimization
- Code splitting
Examples
Example 1: App Router Migration
Input: Migrate Pages Router to App Router
Output:
## Next.js Migration: Pages Router → App Router
### Migration Steps
**1. Convert Layout**
```typescript
// Before: pages/_app.tsx
export default function App({ Component, pageProps }) {
return <Component {...pageProps} />;
}
// After: app/layout.tsx
export default function RootLayout({ children }) {
return (
<html>
<body>{children}</body>
</html>
);
}
2. Convert Pages
// Before: pages/users/[id].tsx
export default function UserPage({ user }) {
return <UserProfile user={user} />;
}