Communitygithub.com

BIGboss248/nextjs-wordpress

Next.js App RouterのReactコンポーネント、Suspenseスケルトン、セマンティックOKLCHトークン、Jest + RTLのユニットテスト、Playwrightのビジュアル/ハイドレーションチェック、Tailwindの論理プロパティを使用したスタイリングを構築します。"/nextjs-component-dev"、"create component"、"new component"、"build component"、"develop component" でトリガーされます。

nextjs-wordpress とは?

このスキルは、Next.js App Routerを使用した本番環境対応のReactコンポーネント(RSCとクライアントコンポーネント)を開発するための、高度に特殊化されたワークフローを提供します。Suspenseスケルトンによるストリーミング、Jest + RTLとPlaywrightを用いた二層構造のTDDテスト、next-intlによる国際化、セマンティックなOKLCHカラートークン、そしてnext-devtools MCPによるランタイム診断を統合しています。 主な特徴として、node_modules/next/dist/docsを直接検索して最新のNext.js API情報を参照するため、古いパターンや誤った情報に依存することを防ぎます。また、開発中はnext-devtools MCPを介して開発サーバーの状態を確認し、必要に応じて自動起動します。コンポーネント開発時は、実装前に詳細な計画書(implementation_plan.md)を生成し、ユーザーの承認を得てからコードを書き始める安全なゲートプロセスを採用しています。 テスト戦略は、Jest + RTLによる高速なユニットテスト(プロップバリエーション、ユーザーインタラクション、アクセシビリティチェック)と、Playwrightによる実ブラウザでの統合・ハイドレーション・ビジュアルテストを二層で実行します。特に、@next/playwrightのinstantヘルパーを使用して、動的コンテンツのストリーミング前に静的シェルが即座にレンダリングされることを検証し、CLS(累積レイアウトシフト)を防止します。 さらに、TanStack Queryを使用したサーバーサイドプリフェッチ、Vercelのreact-transition-progressによるインスタントナビゲーション、'use cache'ディレクティブとcacheLife/cacheTagによる細粒度のキャッシュ戦略をサポートします。論理プロパティ(ms-、ps-など)とセマンティックCSS変数の使用を徹底し、国際化とアクセシビリティに優れたコンポーネントを効率的に開発できます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/BIGboss248/nextjs-wordpress/tree/HEAD/.agents/skills/nextjs-component-dev

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Next.js コンポーネント & スケルトン開発 (nextjs-component-dev)

本番環境対応のReact Server Components (RSC) およびクライアントコンポーネントを作成するための専門ワークフローです。Suspenseスケルトン、二層構造のTDDテスト(Jest + RTLユニットテストとPlaywright統合/ハイドレーション/ビジュアルチェック)、next-intl辞書バックアップ翻訳、セマンティックテーマトークン、そして next-devtools MCPによるライブランタイム診断を備えています。

[!TIP] モジュラーアセットとテンプレート:


アーキテクチャルールと標準

1. 計画のコンテキストとパス

  • docs/project.json を読み取り、package_manager、new_component_dir、style_file_dir、component_library、dictionaries_dir(デフォルト: "messages")、および supported_languages を解決します。
  • すべての内部ルートは @/lib/routes の ROUTES を使用する必要があります。
  • すべての作成者/サイトメタデータは @/lib/site-config の SITE_CONFIG を使用する必要があります。
  • ターゲットパス階層: <new_component_dir>/<page_or_global>/<ComponentName>/
    • カテゴリ: global/ は共有レイアウトクローム用; <page-name>/(例: home/、about/、lab/)はページスコープのセクション用。

2. Next.js内部ドキュメントルックアップ (node_modules/next/dist/docs)

  • Codebase Memory MCPを介したローカルドキュメントの検索: コンポーネント作成時には、codebase-memory MCPツール(search_code、search_graph、get_code_snippet)を使用して、node_modules/next/dist/docs/ にあるローカルのNext.js配布ドキュメントを積極的にクエリし、関連するAPIシグネチャ、ディレクティブ('use cache'、'use client'、'use server')、組み込みコンポーネント(next/image、next/link、next/font、<Form>)、ナビゲーションフック(useRouter、usePathname)、キャッシュポリシー(cacheLife、cacheTag)を調査します。
  • 非推奨パターンとハルシネーションの排除: 想定や時代遅れのNext.jsパターンに決して依存しないでください。インストールされているパッケージバージョンと一致するローカルの node_modules/next/dist/docs が主要な情報源です。references/nextjs-docs-lookup.md を参照してください。

3. 開発サーバーとNext DevToolsプロトコル

  • 開発サーバーのチェックと接続: コンポーネント開発の前/最中に、next-devtools MCPサーバー(nextjs_index)を介してNext.js開発サーバーが実行されているかどうかを確認します。
  • サーバーが実行中の場合: 実行中のサーバーとポートにすぐに接続します。再起動しないでください。
  • サーバーが実行されていない場合: 開発サーバーをバックグラウンドで起動し(pnpm dev、IsDaemon: true)、nextjs_index で接続を確認します。
  • ランタイムデバッグ: コンポーネント実装後、next-devtools(nextjs_call)をクエリしてエラーを検査し、ビルドステータスを確認し、ランタイムの問題をすぐに診断します。references/next-devtools-debugging.md を参照してください。

4. RSC境界とリーフクライアントプッシュダウン

  1. デフォルトでサーバーコンポーネント: コンポーネントはサーバーレンダリング(async function)に保ちます。
  2. "use client" をプッシュダウン: インタラクティブなハンドラー(ボタン、トグル、フォーム入力)を小さなリーフクライアントコンポーネントに分離します。
  3. RSC構成: サーバーコンポーネントを children またはプロップとしてクライアントラッパーに渡します。"use client" ファイル内でサーバーコンポーネントをインポートしないでください。

5. スタイリング、論理プロパティ、テーマトークン

  • セマンティックトークン: app/globals.css で定義されたセマンティックCSS変数(bg-background、text-foreground、border-border、text-muted-foreground)のみを使用します。ハードコードされた16進数カラー(#FAFAFA)や生のカラースケール(bg-blue-500)は禁止です。
  • クラス結合: 常に cn(...)(clsx + tailwind-merge)を使用してクラスを結合します。
  • 論理プロパティ(BiDi): Tailwindの論理プロパティ(ms-、pe-、ps-、me-、start、end)のみを使用します。物理的な方向クラス(ml-、mr-、pl-、pr-、left-、right-)は禁止です。
  • プログレスリンク: 主要ナビゲーション、ヒーローCTA、インタラクティブカードには @vercel/react-transition-progress の <Link> を使用します。静的ユーティリティリンクには標準の next/link を使用します。
  • 画像: 常に next/image を明示的な寸法または fill、レスポンシブ sizes、およびファーストビューのLCPアセットには priority と共に使用します。

6. インスタントナビゲーション、詳細なSuspense、キャッシュアーキテクチャ

  • インスタントコンポーネントのための3つのレバー:
    1. プッシュダウン: リクエスト固有の非同期操作(await params、await searchParams、cookies()、headers()、キャッシュされていないDB/API呼び出し)を、<Suspense> でラップされたリーフサブコンポーネントに抽出します。静的な親と兄弟は、直接静的/App Shellに引き上げられます。
    2. キャッシュ: 関数/コンポーネントレベルで 'use cache' と cacheLife、cacheTag を組み合わせます。セッションブリッジングパターンを使用します:
      • パターンA(抽出して渡す): cookies() からセッション属性(例: team_id、role、tier)を抽出し、'use cache' 関数に引数として渡すことで、キャッシュされたデータが一致する属性を持つすべてのユーザー間で共有されるようにします(コストはユーザーセッション数ではなく、チーム/属性数に応じてスケーリングされます)。
      • パターンB("use cache: private"): 厳密にユーザー固有のセッションルックアップには、App Shellと共に移動する stale >= 5m のブラウザのみのセッションキャッシュを使用します。
    3. プリフェッチ戦略と密度の高いグリッド:
      • デフォルトのApp Shellプリフェッチ(<Link> / prefetch={null}): ルートごとに1つの共有静的/App Shellをプリフェッチします。コストは制限されています($O( ext{routes})$)、リンクあたりのサーバー呼び出しはゼロです。密度の高いフィード、カードグリッド(50枚以上のカード)、一括ナビゲーションに使用します。
      • リンクごとのプリフェッチ(<Link prefetch={true}>): ナビゲーション前に動的URLデータ(params、searchParams)を解決し、表示されているリンクごとに1回のサーバー呼び出しを行います。意図性の高い主要なCTA、ヒーローアクション、またはスケルトンのフラッシュを排除する必要があるマスターディテールリストアイテムに控えめに使用します。
      • 密度の高いカードグリッド: フィード内の多数のカードにわたって無差別に prefetch={true} を使用しないでください。デフォルトの <Link> を保持するか、ホバー/フォーカスインテントプリフェッチ(router.prefetch())を使用します。
  • 詳細なローディング状態(全画面フラッシュ防止): コンポーネントまたはページ全体を、全面スケルトンを表示する単一のトップレベル <Suspense> バウンダリでラップしないでください。タイトル、レイアウトフレーム、キャッシュされたコンテンツはすぐに表示できるようにし、<Suspense> は動的ストリーミングスロットの周囲に厳密に配置します。
  • ネイティブNext.js 16キャッシュディレクティブ: references/instant-navigation-and-prefetching.md および references/caching-and-revalidation.md を参照してください。

7. TanStack Queryとサーバープリフェッチ

  • 統一キャッシュコントラクト: 明示的な staleTime(例: 30_000 ms)と共に key、tag、queryOptions を定義します。
  • サーバープリフェッチ: 内部のDB関数を直接呼び出して、未完了のプリフェッチ(void queryClient.prefetchQuery(...))をトリガーします(サーバー上の相対フェッチはゼロ)。<HydrationBoundary> でデハイドレートします。
  • ストリームドコンポーネント: <Suspense fallback={<[ComponentName]Skeleton />}> 内で useSuspenseQuery を使用します。
  • 楽観的ミューテーション: onMutate キャッシュスナップショットと onError ロールバックを備えた useMutation を使用します。updateTag(cache.tag) でサーバーアクションを呼び出します。

8. 二層テストの役割分担 (Jest vs. Playwright)

  • Jest + RTL ([ComponentName].test.tsx):
    • jsdom での高速フィードバックループ。
    • プロップのバリエーション、条件付きUI要素、空/null状態。
    • @testing-library/user-event を介したユーザーインタラクション(fireEvent は使用しない)。
    • Next.jsルーティングモック(next/navigation の useRouter、usePathname、useSearchParams)。
    • NextIntlClientProvider 内での next-intl 辞書補間および複数形チェック。
    • アクセシブルなロールクエリ(screen.getByRole)と自動化されたa11yチェック(jest-axe)。
  • Playwright ([ComponentName].spec.ts またはページレベルのスペック):
    • 実際のブラウザ実行(Chromium/WebKit/Firefox)。
    • インスタントシェルアサーション(@next/playwright): instant(page, ...) ヘルパーを使用して、動的サーバーストリーミングが解決される前に、静的シェルとプリフェッチされたApp Shellが即座にレンダリングされることをアサートします。
    • ゼロハイドレーションミスマッチ: ブラウザコンソールイベント(page.on('console'))をリッスンして、React SSRハイドレーションの警告を検出し、テストを失敗させます。
    • ビジュアルとBiDiのリグレッション: テーマ(ライト/ダークOKLCH変数)とテキスト方向(dir="ltr" 対 dir="rtl")にわたって expect(page).toHaveScreenshot() を使用します。
    • ネットワーク回復力: page.route() を使用して、低速なネットワーク応答(Suspenseスケルトンがジオメトリと一致してCLSを防ぐことを確認)および500エラーバウンダリをテストします。
  • 詳細なテスト標準: references/testing-architecture-guide.md を参照してください。

フェーズ0: 実装計画と承認ゲート

[!IMPORTANT] 実行前の計画: 書き込み操作、辞書の変更、またはリポジトリへのコンポーネント作成を実行する前に、常に implementation_plan.md アーティファクトを生成して提示し、計画されたすべてのファイル作成、変更、TypeScriptコントラクト、翻訳辞書の追加、およびTDDテストケースを文書化してください。実行を続行する前に、ユーザーの確認/承認を待ってください。

実装計画は以下をカバーする必要があります:

  1. ターゲットアーキテクチャとパス: 完全なターゲットディレクトリ(<new_component_dir>/<page_or_global>/<ComponentName>/)と分類(RSC 対 クライアントリーフコンポーネント)。
  2. 参照されたNext.jsローカルドキュメント: node_modules/next/dist/docs/ で確認された特定のドキュメントパス(例: 04-api-reference/04-components/image.md、03-directives/use-cache.md、04-api-reference/02-functions/use-router.md)。
  3. TypeScriptコントラクト: 厳密な英語のTSDocアノテーションを持つプロップインターフェースと型。
  4. 辞書戦略: docs/project.json のすべての supported_languages にわたって messages/[locale].json に追加する明示的な翻訳名前空間とキー(ハードコードされた文字列やファイル内モック辞書はゼロ)。
  5. テーマトークンとスタイリング: 特定されたセマンティックOKLCH CSS変数と論理レイアウトクラス。
  6. テストと診断戦略:
    • Jestユニットテスト([ComponentName].test.tsx): モック設定(next/navigation)、プロップバリエーション、コールバックアサーション、NextIntlClientProvider 統合、a11yロールクエリ。
    • Playwright統合シナリオ([ComponentName].spec.ts): ビジュアルスナップショットターゲット(ライト/ダークテーマトークン、LTR vs RTL論理レイアウト)、ネットワークスロットリング/スケルトンジオメトリチェック、ハイドレーション検証リスナー。
    • Next DevTools診断: next-devtools を介したランタイムエラーとコンパイルチェック。
  7. 検証ゲート: 実行する正確な検証コマンド(verify-dev.ps1、対象のユニットテスト、Playwright e2eスペック)。

ワークフローステップ

  • ステップ 0: 実装計画の生成と承認ゲート

    • codebase-memory MCP(search_code、search_graph)を介して node_modules/next/dist/docs を検索し、計画されたコンポーネントで使用されるNext.js API、ディレクティブ、フック、またはコンポーネントを確認し、最新のコンテキストを確保します。
    • コンポーネント要件を統合し、docs/project.json をスキャンし、参照されたドキュメントとコントラクトを文書化した implementation_plan.md を生成します。
    • アーティファクトに request_feedback = true と user_facing = true を設定します。
    • コードを書き始める前に、ユーザーのレビューと明示的な承認を待ちます。
  • ステップ 1: 開発サーバーの確認とNext DevTools接続

    • next-devtools MCPを nextjs_index を介してクエリし、実行中のNext.js開発サーバーインスタンスを検出します。
    • 開発サーバーが実行中の場合: アクティブなポートとサーバーインスタンスに接続します。再起動せずに開発を続行します。
    • 開発サーバーが実行されていない場合: 開発サーバーをバックグラウンドで起動し(pnpm dev、IsDaemon: true)、nextjs_index でディスカバリを確認します。
  • ステップ 2: 辞書の投入とTypeScriptコントラクトの定義

    • docs/project.json を読み取り、dictionaries_dir(デフォルトは messages)と supported_languages を解決します。
    • コンポーネントの翻訳名前空間とキーを定義します。
    • JSXを書く前に、すべての辞書ファイル(messages/en.json、messages/fa.json など)に、サポートされているすべての言語に対して本物の翻訳を投入します。
    • 厳密な英語TSDocアノテーション(@param、@defaultValue、@returns)を持つプロップインターフェースを定義します。
    • サポートされている言語が複数ある場合、コンポーネントは最初に翻訳をフェッチし、失敗した場合はフォールバックを使用する必要があります。
  • ステップ 3: TDDベースラインユニットテスト(Jest + RTLを使用した [ComponentName].test.tsx)

    • コンポーネントを実装する前に [ComponentName].test.tsx を記述します。
    • next/navigation フック(useRouter、usePathname、useSearchParams)をモックします。
    • レンダリングされたコンポーネントを、辞書 messages とアクティブな locale を提供する NextIntlClientProvider でラップします。
    • 方向属性(dir="rtl" 対 dir="ltr")、デフォルトのプロップ、インタラクティブなコールバック(@testing-library/user-event)、Suspenseスケルトンフォールバック、セマンティックARIAロールをテストします。
  • ステップ 4

…

[翻訳のため省略]

Individual skills in this repo

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

BIGboss248/nextjs-wordpress

Create, configure, manage, and validate Google Antigravity customizations including skills, rules, MCP servers, lifecycle hooks, plugins, and custom JSON configs. Use when adding new capabilities to Antigravity, configuring MCP servers, writing rules, creating skills, setting up hooks, or modernizing legacy workflows.

BIGboss248/nextjs-wordpress

Spawn multiple agents into a shared conversation where they debate, disagree, and converge on a solution via a shared chat.json file. Use for architecture decisions, code review debates, design trade-offs, or any problem that benefits from adversarial reasoning. Triggers on "chatroom", "agent debate", "have agents discuss", "agent chatroom", "debate this", or /agent-chatrooms. Also triggers on phrases like "have 3 agents argue about", "multi-agent discussion", or "let them debate".

BIGboss248/nextjs-wordpress

Always-active code intelligence, search, and navigation skill utilizing the codebase-memory MCP server. Enforces an index-first protocol (verifying and refreshing the knowledge graph via index_repository or index_status before searching, required because background auto_watch is disabled to eliminate editor stutter and system lag), followed by graph-first exploration (search_graph, trace_path, get_code_snippet, query_graph, get_architecture, detect_changes) instead of naive text grep or full-file reads. Always activate before searching the codebase, inspecting unknown architecture, finding symbols, or tracing callers/callees.

BIGboss248/nextjs-wordpress

>- Discover, interview, and craft comprehensive UX/UI design specifications (design-spec.md) and design tokens for web components. Triggers on "/component-design", "design component", "design section", "design UI", "wireframe component", or "create design spec".

BIGboss248/nextjs-wordpress

>- Configure and query WooCommerce APIs including WPGraphQL, WooGraphQL, and JWT auth for headless frontends. Use when connecting Next.js to WooCommerce or fetching store catalog data.

BIGboss248/nextjs-wordpress

Orchestrate parallel browser automation using multiple Chrome DevTools MCP instances. Use when a task requires doing the same browser action across many targets simultaneously (e.g., submitting contact forms, filling applications, scraping pages that need JS rendering). Spin up 1-5 parallel Chrome agents.

BIGboss248/nextjs-wordpress

Workflow for spawning an independent subagent to conduct unbiased code reviews and inject adversarial edge-case tests ([ComponentName].edge.test.tsx).

BIGboss248/nextjs-wordpress

>- Bootstrap, configure, and verify the complete Next.js App Router development environment, developer tooling, testing suites, MCP servers, Docker containerization, and CI/CD. Triggers on "/nextjs-dev-setup", "setup nextjs dev environment", "start a nextjs project", or "containerize nextjs app".

BIGboss248/nextjs-wordpress

>- Configure production health monitoring endpoints (/api/health), Docker Compose probes, and runtime metrics in Next.js App Router applications. Use when asked to "setup health check", "add health endpoint", "docker compose healthcheck nextjs", "configure health monitor", or "/nextjs-healthcheck".

BIGboss248/nextjs-wordpress

Bootstrap, configure, and verify next-intl App Router internationalization (proxy.ts/middleware.ts, next/root-params, [locale] layout, routing). Triggers on "/nextjs-i18n-setup", "setup i18n", "install next-intl", "configure next-intl", "add internationalization", "setup locale routing", "migrate to [locale]".

BIGboss248/nextjs-wordpress

Read/write translation dictionaries (messages/[locale].json), next-intl hooks (getTranslations/useTranslations), providers (Storybook/tests/subtrees), and BiDi styling. Triggers on "/nextjs-i18n-usage", "i18n dictionary", "use translations", "read dictionary", "i18n provider", "next-intl hooks", "storybook i18n", "test i18n", "add translation keys", "localize component", "create a component", "update a component".

BIGboss248/nextjs-wordpress

>- Configure, test, and verify OpenTelemetry (OTel) observability in Next.js App Router applications. Triggers on "/nextjs-otel", "setup otel", "configure opentelemetry", "test otel", or "verify opentelemetry".

BIGboss248/nextjs-wordpress

Step-by-step workflow for designing and building Next.js App Router pages (RSC page.tsx, loading skeleton, metadata, JSON-LD schema, and dynamic static params). Triggers on "/nextjs-page-dev", "create page", "new page", "develop page", "build route", or "implement page".

BIGboss248/nextjs-wordpress

>- Orchestrate end-to-end planning for Next.js App Router projects, generating canonical specifications, design systems, and a 7-phase modular implementation roadmap in docs/plan/. Triggers on "/nextjs-plan", "plan a nextjs project", "plan nextjs app", "create nextjs project plan", "outline nextjs architecture", or "generate plan".

BIGboss248/nextjs-wordpress

Workflow and engineering standards for crafting co-located Storybook CSF3 stories ([ComponentName].stories.tsx) with interactive controls, action spies, and 4 canonical theme variants.

BIGboss248/nextjs-wordpress

>- Build Next.js e-commerce frontends backed by WooCommerce APIs, handling ISR catalogs, cart sessions, and JWT authentication. Use when building or querying Next.js stores with WooCommerce.

BIGboss248/nextjs-wordpress

Self-correcting rules engine and feedback loop that learns from user corrections, mistakes, and project-specific constraints by maintaining a persistent autofix ruleset. Scans learned rules before starting any task, resolves conflicts, and automatically appends new rules upon corrections. Triggers on user corrections ("no, do it this way", "never do X", "always use Y"), /learn, "self repair", "add rule", "update rules", or when diagnosing assumptions and bugs. CRITICAL ALWAYS-ACTIVE LIFECYCLE SKILL. Must always be kept in context, loaded at session start, and consulted before starting ANY task to read and apply active constraints from autofix.json. MUST ALWAYS be triggered immediately whenever the user provides ANY correction, preference, criticism, rejection of an approach, or adjustment ("no", "don't do X", "use Y", "remember", "prefer"), or when any mistake/bug is identified. Automatically and immediately formulates and appends the new imperative rule to the project's autofix.json ruleset file.

BIGboss248/nextjs-wordpress

Setup, automate, and execute SEO audits, CI/CD pre-push/pre-deploy checks, and ranking optimizations using the seo CLI and MCP server.

BIGboss248/nextjs-wordpress

End-to-end repository onboarding and development environment setup skill. Scans repository structure, configures project metadata (docs/project.json), sets up the codebase-memory-mcp code intelligence knowledge graph server (in workspace mcp.json and globally for AGY only), configures git hooks with Husky and Commitlint, establishes multi-stage production Docker containerization, and automates credit-optimized Release Please CI/CD with multi-arch (AMD64 & ARM64) GHCR package deployment. Triggers on "/setup-repository", "setup repository", "setup repo", "initialize repository", "new repo setup", or when preparing any repository for development and AI agent workflows.

BIGboss248/nextjs-wordpress

AI screen scaffolding, layout generation, and variant exploration workflow powered by Google Stitch (StitchMCP). Consumes a component design specification (docs/design/components/[page name]/[component name]/design-spec.md), verifies and reuses the central Stitch project in docs/project.json (or creates/persists one if absent), seeds the project's design system into Stitch, synthesizes layout prompts to generate a screen and create one variant of the given design spec file, downloads and saves Stitch JPG screenshots and HTML code files directly into docs/design/components/[page name]/[component name]/stitch/ using binary-safe PowerShell Invoke-WebRequest, outputs image prompts to the user if visual assets are needed (without calling generate_image to conserve tokens), updates design-spec.md with Stitch layout benchmarks, and audits asset download integrity with an independent subagent. Triggers on "/stitch-design", "generate stitch screen", "create stitch variant", "scaffold screen with stitch", or "stitch...

関連スキル