Communitygithub.com

BIGboss248/nextjs-wordpress

>- Build Next.js App Router React components with Suspense skeletons, semantic OKLCH tokens, Jest + RTL unit tests, Playwright visual/hydration checks, and Tailwind logical styling. Triggers on "/nextjs-component-dev", "create component", "new component", "build component", or "develop component".

What is nextjs-wordpress?

nextjs-wordpress is a Claude Code agent skill that >- Build Next.js App Router React components with Suspense skeletons, semantic OKLCH tokens, Jest + RTL unit tests, Playwright visual/hydration checks, and Tailwind logical styling. Triggers on "/nextjs-component-dev", "create component", "new component", "build component", or "develop component".

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

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Next.js Component & Skeleton Development (nextjs-component-dev)

Specialized workflow for creating production-ready React Server Components (RSC) and Client Components with Suspense skeletons, dual-layer TDD testing (Jest + RTL unit tests and Playwright integration/hydration/visual checks), next-intl dictionary-backed translations, semantic theme tokens, and live runtime diagnostics via next-devtools MCP.

[!TIP] Modular Assets & Templates:


Architectural Rules & Standards

1. Planning Context & Paths

  • Read docs/project.json to resolve package_manager, new_component_dir, style_file_dir, component_library, dictionaries_dir (default: "messages"), and supported_languages.
  • All internal routes MUST use ROUTES from @/lib/routes.
  • All author/site metadata MUST use SITE_CONFIG from @/lib/site-config.
  • Target path hierarchy: <new_component_dir>/<page_or_global>/<ComponentName>/
    • Category: global/ for shared layout chrome; <page-name>/ (e.g. home/, about/, lab/) for page-scoped sections.

2. Next.js Internal Docs Lookup (node_modules/next/dist/docs)

  • Search Local Docs via Codebase Memory MCP: For any component creation, actively query and inspect the local Next.js distribution docs at node_modules/next/dist/docs/ using codebase-memory MCP tools (search_code, search_graph, get_code_snippet) for relevant API signatures, directives ('use cache', 'use client', 'use server'), built-in components (next/image, next/link, next/font, <Form>), navigation hooks (useRouter, usePathname), and caching policies (cacheLife, cacheTag).
  • Eliminate Deprecations & Hallucinations: Never rely on assumptions or outdated Next.js patterns; the local node_modules/next/dist/docs matching the installed package version is the primary source of truth. Consult references/nextjs-docs-lookup.md.

3. Dev Server & Next DevTools Protocol

  • Dev Server Check & Tune-In: Before/during component development, check if the Next.js dev server is running via next-devtools MCP server (nextjs_index).
  • If Server Running: Tune into the running server and port immediately; do not restart.
  • If Server Not Running: Start the dev server in the background (pnpm dev, IsDaemon: true) and verify connection via nextjs_index.
  • Runtime Debugging: After implementing components, query next-devtools (nextjs_call) to inspect errors, check build status, and diagnose runtime issues immediately. Consult references/next-devtools-debugging.md.

4. RSC Boundaries & Leaf Client Push-Down

  1. Server Components by Default: Keep components server-rendered (async function).
  2. Push "use client" Down: Isolate interactive handlers (buttons, toggles, form inputs) into small leaf Client Components.
  3. RSC Composition: Pass Server Components as children or props into Client wrappers. Never import Server Components inside "use client" files.

5. Styling, Logical Properties & Theme Tokens

  • Semantic Tokens: Exclusively use semantic CSS variables defined in app/globals.css (bg-background, text-foreground, border-border, text-muted-foreground). Hardcoded hex colors (#FAFAFA) or raw color scales (bg-blue-500) are FORBIDDEN.
  • Class Merging: Always merge classes using cn(...) (clsx + tailwind-merge).
  • Logical Properties (BiDi): Exclusively use Tailwind logical properties (ms-, pe-, ps-, me-, start, end). Physical directional classes (ml-, mr-, pl-, pr-, left-, right-) are FORBIDDEN.
  • Progress Links: Use <Link> from @vercel/react-transition-progress for primary navigation, hero CTAs, and interactive cards; use standard next/link for static utility links.
  • Images: Always use next/image with explicit dimensions or fill, responsive sizes, and priority for above-the-fold LCP assets.

6. Instant Navigation, Granular Suspense & Caching Architecture

  • The Three Levers for Instant Components:
    1. Push Down: Extract request-specific async operations (await params, await searchParams, cookies(), headers(), uncached DB/API calls) into leaf sub-components wrapped in <Suspense>. Static parents and siblings lift directly into the static/App Shell.
    2. Cache: Pair 'use cache' with cacheLife and cacheTag at function/component level. Use Session Bridging patterns:
      • Pattern A (Extract & Pass): Extract session attributes (e.g. team_id, role, tier) from cookies() outside and pass as arguments to 'use cache' functions so cached data is shared across all users with matching attributes (cost scales with team/attribute count, not user session count).
      • Pattern B ("use cache: private"): For strictly user-specific session lookups, use browser-only session caching with stale >= 5m that travels with the App Shell.
    3. Prefetching Strategy & Dense Grids:
      • Default App Shell Prefetching (<Link> / prefetch={null}): Prefetches one shared static/App Shell per route. Bounded cost ($O(\text{routes})$), zero server invocations per link. Use for dense feeds, card grids (50+ cards), and bulk navigation.
      • Per-Link Prefetching (<Link prefetch={true}>): Resolves dynamic URL data (params, searchParams) before navigation with 1 server invocation per visible link. Use sparingly for high-intent primary CTAs, hero actions, or master-detail list items where skeleton flashing must be eliminated.
      • Dense Card Grids: NEVER use blanket prefetch={true} across dozens of cards in feeds. Retain default <Link> or use hover/focus intent prefetching (router.prefetch()).
  • Granular Loading States (Anti-Full-Page Flash): Never wrap an entire component or page in a single top-level <Suspense> boundary that flashes full skeletons. Keep titles, layout frames, and cached content visible immediately; place <Suspense> strictly around dynamic streaming slots.
  • Native Next.js 16 Caching Directives: Consult references/instant-navigation-and-prefetching.md and references/caching-and-revalidation.md.

7. TanStack Query & Server Prefetching

  • Unified Cache Contract: Define key, tag, and queryOptions with explicit staleTime (e.g. 30_000 ms).
  • Server Prefetch: Trigger unawaited prefetch (void queryClient.prefetchQuery(...)) calling internal DB functions directly (zero relative fetch on server). Dehydrate with <HydrationBoundary>.
  • Streamed Components: Use useSuspenseQuery inside <Suspense fallback={<[ComponentName]Skeleton />}>.
  • Optimistic Mutations: Use useMutation with onMutate cache snapshots and onError rollbacks; call Server Actions with updateTag(cache.tag).

8. Dual-Layer Testing Division of Labor (Jest vs. Playwright)

  • Jest + RTL ([ComponentName].test.tsx):
    • Fast feedback loop in jsdom.
    • Prop permutations, conditional UI elements, and empty/null states.
    • User interactions via @testing-library/user-event (never fireEvent).
    • Next.js routing mocks (useRouter, usePathname, useSearchParams from next/navigation).
    • next-intl dictionary interpolation and pluralization checks inside NextIntlClientProvider.
    • Accessible role queries (screen.getByRole) and automated a11y checks (jest-axe).
  • Playwright ([ComponentName].spec.ts or page-level specs):
    • Real browser execution (Chromium/WebKit/Firefox).
    • Instant Shell Assertions (@next/playwright): Use instant(page, ...) helper to assert that static shells and prefetched App Shells render immediately before dynamic server streaming resolves.
    • Zero-Hydration Mismatches: Listen to browser console events (page.on('console')) to detect and fail tests on React SSR hydration warnings.
    • Visual & BiDi Regression: Use expect(page).toHaveScreenshot() across themes (light vs. dark OKLCH variables) and text directions (dir="ltr" vs. dir="rtl").
    • Network Resilience: Use page.route() to test slow network responses (verifying Suspense skeletons match geometry to prevent CLS) and 500 error boundaries.
  • Detailed Testing Standards: Consult references/testing-architecture-guide.md.

Phase 0: Implementation Plan & Approval Gate

[!IMPORTANT] Plan Before Execution: Always generate and present an implementation_plan.md artifact detailing all planned file creations, modifications, TypeScript contracts, translation dictionary additions, and TDD test cases before executing any write operations, modifying dictionaries, or creating components in the repository. Wait for user confirmation/approval before proceeding with execution.

The implementation plan must cover:

  1. Target Architecture & Path: Full target directory (<new_component_dir>/<page_or_global>/<ComponentName>/) and classification (RSC vs. Client leaf component).
  2. Next.js Local Docs Consulted: Specific doc paths checked under node_modules/next/dist/docs/ (e.g. 04-api-reference/04-components/image.md, 03-directives/use-cache.md, 04-api-reference/02-functions/use-router.md).
  3. TypeScript Contracts: Prop interfaces and types with strict English TSDoc annotations.
  4. Dictionary Strategy: Explicit translation namespaces and keys to add to messages/[locale].json across all supported_languages in docs/project.json (zero hardcoded strings or in-file mock dictionaries).
  5. Theme Tokens & Styling: Identified semantic OKLCH CSS variables and logical layout classes.
  6. Testing & Diagnostics Strategy:
    • Jest Unit Tests ([ComponentName].test.tsx): Mock configurations (next/navigation), prop variations, callback assertions, NextIntlClientProvider integration, and a11y role queries.
    • Playwright Integration Scenarios ([ComponentName].spec.ts): Visual snapshot targets (light/dark theme tokens, LTR vs. RTL logical layouts), network throttling/skeleton geometry checks, and hydration verification listeners.
    • Next DevTools Diagnostics: Runtime error and compilation checks via next-devtools.
  7. Verification Gate: Exact verification commands to run (verify-dev.ps1, targeted unit tests, and Playwright e2e specs).

Workflow Steps

  • Step 0: Implementation Plan Generation & Approval Gate

    • Search and inspect node_modules/next/dist/docs via codebase-memory MCP (search_code, search_graph) for any Next.js APIs, directives, hooks, or components utilized by the planned component to ensure up-to-date context.
    • Synthesize component requirements, scan docs/project.json, and generate implementation_plan.md documenting consulted docs and contracts.
    • Set request_feedback = true and user_facing = true on the artifact.
    • Wait for user review and explicit approval before writing any code.
  • Step 1: Dev Server Verification & Next DevTools Connection

    • Query next-devtools MCP via nextjs_index to detect running Next.js dev server instances.
    • If Dev Server is running: Tune into the active port and server instance; continue developing without restarting.
    • If Dev Server is NOT running: Start the dev server in the background (pnpm dev, IsDaemon: true) and verify discovery with nextjs_index.
  • Step 2: Dictionary Population & TypeScript Contract Definition

    • Read docs/project.json to resolve dictionaries_dir (messages is default) and supported_languages.
    • Define the component's translation namespace and keys.
    • Populate all dictionary files (messages/en.json, messages/fa.json, etc.) with authentic translations for every supported language before writing JSX.
    • Define prop interfaces with strict English TSDoc annotations (@param, @defaultValue, @returns).
    • If there are more than one supported language, component must fetch the translation first and if failed use fallbacks.
  • Step 3: TDD Baseline Unit Tests ([ComponentName].test.tsx via Jest + RTL)

    • Write [ComponentName].test.tsx BEFORE implementing the component.
    • Mock next/navigation hooks (useRouter, usePathname, useSearchParams).
    • Wrap rendered components in NextIntlClientProvider supplying the dictionary messages and active locale.
    • Test directional attributes (dir="rtl" vs. dir="ltr"), default props, interactive callbacks (@testing-library/user-event), Suspense skeleton fallbacks, and semantic ARIA roles.
  • Step 4: Component & Skeleton Implementation

    • Create primary component [ComponentName].tsx (RSC or Client Component) consuming translations via next-intl (getTranslations or useTranslations) with zero hardcoded placeholders or in-file mock dictionary objects.
    • Create matching Suspense skeleton [ComponentName]Skeleton.tsx mirroring layout geometry and classes to prevent CLS.
    • Create clean barrel export index.ts.
  • Step 5: Runtime Diagnostics & Verification Gate

    • Next DevTools Runtime Inspection & Navigation Inspector: Use next-devtools MCP server (nextjs_call) to check for compilation errors, runtime exceptions, hydration issues, or broken routes. Use Navigation Inspector ("Pause on navigations") to verify the static shell and App Shell render instantly with granular fallbacks.
    • Targeted Unit Test Execution: Run verification script to check companion files, dictionary compliance, and execute unit tests:
      • Windows (PowerShell):
        pwsh .agents/skills/nextjs-component-dev/scripts/verify-dev.ps1 -ComponentPath <target_component_dir>
        
      • Linux / macOS (Bash):
        bash .agents/skills/nextjs-component-dev/scripts/verify-dev.sh <target_component_dir>
        
    • Playwright Instant Navigation & Hydration Check: Run targeted Playwright component/integration spec:
      pnpm test:e2e [ComponentName]
      
    • Validate that instant() tests pass for hard page load and client navigation, visual snapshots pass across themes, and console listeners register 0 hydration mismatch errors.
    • Fix any syntax errors, missing dictionary keys, visual discrepancies, or test regressions until all assertions pass.
  • Step 6: Implementation Plan Checklist Synchronization

    • Check off the completed component item (- [x]) in docs/plan/05-pages-and-components.md.
    • If all sub-components and page infrastructure tasks for the parent page are completed, check off the parent page item (- [x]).

Edge Cases & AI Pitfalls

  • Local Docs Verification via Codebase Memory MCP: Always search node_modules/next/dist/docs/ using codebase-memory MCP tools (search_code, search_graph) before authoring components. Never assume deprecated Next.js API signatures or outdated caching mechanisms; local docs reflect the exact runtime version installed.
  • Zero In-File i18n Fallbacks: Never hardcode dictionary objects or fallbacks (const DEFAULT_CONTENT = {...}) in TSX files. All text must come from messages/[locale].json.
  • Hydration Warning Detection: Browser-only globals (window, localStorage) accessed during SSR cause hydration mismatch crashes. Guard them behind useEffect or client checks.
  • Strict Logical Styling (BiDi): Never use physical directions (ml-, mr-, pl-, pr-, left-, right-). Always use logical alternatives (ms-, me-, ps-, pe-, start, end).
  • Targeted Test Execution: Always run tests targeting specific component files to conserve tokens and reduce execution time (do not run full project test suites during component iterations).
  • Storybook Story Separation: Do not author .stories.tsx or run Storybook builds during standard component development unless the nextjs-storybook-story skill is specifically requested. Consult references/storybook-reference.md.

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...

Related Skills