MCP HubMCP Hub
スキル一覧に戻る

nextjs

KubrickCode
更新日 Today
246 閲覧
1
1
GitHubで表示
メタapidesigndata

について

このスキルは、App Routerのパターンと実装ガイダンスに焦点を当てたNext.jsアーキテクチャの専門知識を提供します。BFFアーキテクチャ、サーバー/クライアントコンポーネント戦略、キャッシュを活用した最適なデータ取得を徹底します。Next.js 15.5+アプリケーションにおいて、Server Actions、ストリーミングSSR、ルートハンドラ、またはパフォーマンス最適化を実装する際にご利用ください。

クイックインストール

Claude Code

推奨
プラグインコマンド推奨
/plugin add https://github.com/KubrickCode/ai-config-toolkit
Git クローン代替
git clone https://github.com/KubrickCode/ai-config-toolkit.git ~/.claude/skills/nextjs

このコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします

ドキュメント

Next.js Project Architecture Rules

Scope: Project-specific policies and architecture decisions only.

Version: Next.js 15.5+ with App Router


1. BFF Architecture (Mandatory)

Absolute Rules

Next.js serves ONLY as a thin Backend for Frontend (BFF) layer:

Browser ↔ Next.js Server ↔ Backend API ↔ Database

NEVER:

  • ❌ Direct database access from Next.js (no Prisma, no ORMs)
  • ❌ Business logic implementation in Next.js
  • ❌ Data validation beyond input sanitization

ALWAYS:

  • ✅ All business logic in separate backend service
  • ✅ All database operations via backend API
  • ✅ Next.js for: SSR/SSG, API aggregation, session management, caching

2. Component Strategy (Enforced)

Server Components First

Rule: Default to Server Components. 'use client' only at leaf nodes.

Client Component allowed for:

  • Event handlers (onClick, onChange)
  • Browser APIs (localStorage, window)
  • React hooks (useState, useEffect)

Violation: Client Component wrapping Server Components


3. Rendering Strategy (Explicit Declaration Required)

Mandatory Export

Every page MUST explicitly declare rendering intent:

// Required - choose one:
export const dynamic = "force-static"; // SSG
export const dynamic = "force-dynamic"; // SSR
export const revalidate = 3600; // ISR

No implicit rendering. Always be explicit about caching behavior.


4. Data Fetching (Server Actions vs API Routes)

Server Actions (Default for Internal Operations)

Use for:

  • Form submissions
  • Data mutations
  • Internal Next.js operations

Location: app/actions/*.ts or inline with 'use server'

API Routes (External Integration ONLY)

Use for:

  • Webhooks (Stripe, GitHub, etc.)
  • OAuth callbacks
  • Mobile app endpoints
  • Third-party service integrations

Location: app/api/*/route.ts

NEVER: API routes for internal Next.js-to-Next.js communication


5. Caching Policy (Explicit Intent Required)

Mandatory Cache Declaration

All fetch calls MUST explicitly specify caching:

// Required - choose one:
fetch(url, { next: { revalidate: 3600 } }); // Time-based
fetch(url, { cache: "no-store" }); // Dynamic

Use React cache() to prevent duplicate requests within render cycle.

No implicit caching. Always declare intent.


Critical Violations

  1. Direct DB access from Next.js → Architecture violation
  2. API Routes for internal mutations → Use Server Actions
  3. Missing rendering strategy declaration → Add explicit export
  4. Client Component not at leaf → Move 'use client' down
  5. Implicit caching → Add explicit cache declaration
  6. Backend not separated → Mandatory separate service

GitHub リポジトリ

KubrickCode/ai-config-toolkit
パス: .claude/skills/nextjs

関連スキル

content-collections

メタ

This skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.

スキルを見る

creating-opencode-plugins

メタ

This skill provides the structure and API specifications for creating OpenCode plugins that hook into 25+ event types like commands, files, and LSP operations. It offers implementation patterns for JavaScript/TypeScript modules that intercept and extend the AI assistant's lifecycle. Use it when you need to build event-driven plugins for monitoring, custom handling, or extending OpenCode's capabilities.

スキルを見る

evaluating-llms-harness

テスト

This Claude Skill runs the lm-evaluation-harness to benchmark LLMs across 60+ standardized academic tasks like MMLU and GSM8K. It's designed for developers to compare model quality, track training progress, or report academic results. The tool supports various backends including HuggingFace and vLLM models.

スキルを見る

polymarket

メタ

This skill enables developers to build applications with the Polymarket prediction markets platform, including API integration for trading and market data. It also provides real-time data streaming via WebSocket to monitor live trades and market activity. Use it for implementing trading strategies or creating tools that process live market updates.

スキルを見る