create-component-nextjs-page

Create Next.js MDX/TSX component demo pages with variants and visual regression tests.

5|Updated Apr 22, 2023
One-click install
npx skills add https://github.com/idealjs/camphora --skill create-component-nextjs-page
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-component-nextjs-page
Source: https://github.com/idealjs/camphora/tree/main/.roo/skills/3-%E5%88%9B%E5%BB%BA%E7%A4%BA%E4%BE%8B%E9%A1%B5
Command: npx skills add https://github.com/idealjs/camphora --skill create-component-nextjs-page

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

本技能用于在网站文档中为组件创建示例页,说明示例页应包含的要素与组织规范:组件定位、可复制运行的基础示例、常见变体、交互与边界条件、可访问性要点以及测试与视觉回归快照路径。示例采用 MDX/TSX 格式并保证代码可直接复制运行。

Core Features & Use Cases

  • 标准化示例页:为组件创建可直接使用的 MDX/TSX 示例页,包含定位、变体、交互与边界条件、可访问性要点。
  • 完整展示场景:支持颜色组、尺寸组、交互状态等变体的分组展示。
  • 测试与快照:集成视觉回归测试示例,便于对比变化。

Quick Start

  • Create a new Next.js MDX/TSX-based component demo page at apps/website/app/(docs)/components/<component>/page.tsx
  • Organize variants into logical groups (color, size) and wrap demos with the shared Preview component for consistent styling
  • Add a Playwright-based visual regression test in the same directory to capture a snapshot of the demo page.

Frequently Asked Questions about create-component-nextjs-page

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a standardized Next.js component demo page with MDX and TSX?

A standardized Next.js component demo page includes the component's positioning, runnable MDX/TSX base examples, variant groups, accessibility notes, and Playwright visual regression test paths to ensure consistent documentation.

What should a Next.js component documentation page include?

A Next.js component documentation page should include the component's positioning, directly runnable MDX/TSX base examples, variant groups for size and color, interaction boundary conditions, accessibility notes, and visual regression snapshot paths.

Do I need external libraries to build Next.js component galleries with visual regression tests?

No external libraries are needed beyond standard Next.js tooling and MDX support to render and validate demos, as visual regression tests utilize Playwright to capture and compare demo page snapshots natively.

How do I organize component variants in a Next.js documentation site?

You organize component variants in a Next.js documentation site by grouping them into logical categories like color, size, and interaction states, then wrapping each demo with a shared Preview component to maintain consistent styling.

How do I add Playwright visual regression tests to a Next.js component demo?

You add Playwright visual regression tests by creating a test file in the same directory as the Next.js component demo page to capture a snapshot of the rendered output and validate visual changes.