Communitygithub.com

组件与UI设计技能 (component-design)

一个结构化的UX/UI发现和规范工作流,用于设计Web和应用程序组件、区块和页面。生成可供视觉原型设计工具(如 stitch-design)和代码实施工作流使用的生产级设计规范(design-spec.md)。

组件与UI设计技能 (component-design) 是什么?

该技能提供了一个严格的、以设计令牌为驱动的UX/UI规范工作流,专为AI助手(如Claude Code、Cursor)设计,用于系统化地设计和记录Web组件。它通过强制一个“零编码”护栏来确保专注于纯设计输出——不生成React组件或安装命令——并在允许任何组件设计之前,通过验证 docs/project.json 中的设计令牌来强制执行“令牌优先”规则。该工作流分为五个步骤:动态上下文发现与令牌验证、自适应多轮组件打磨、为用户生成视觉资产提示、搭建结构化的 design-spec.md(包含9个必填部分),以及通过 invoke_subagent 进行独立子代理审计。最终输出是一个复杂的、令牌驱动的设计规范,准备向下游移交,用于视觉原型制作(例如 Google Stitch)或代码实施,确保AI代理能够在不危险地进入实施领域的情况下,跨越整个设计生命周期。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/BIGboss248/nextjs-wordpress/tree/HEAD/.agents/skills/component-design

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

组件与UI设计技能 (component-design) 是做什么的?

一个结构化的UX/UI发现和规范工作流,用于设计Web和应用程序组件、区块和页面。生成可供视觉原型设计工具(如 stitch-design )和代码实施工作流使用的生产级设计规范(design-spec.md)。


护栏与核心原则

[!IMPORTANT] 1. 零编码护栏(纯设计范围):本技能严格关注UX、UI、布局架构、排版和视觉令牌。绝不输出React组件、Next.js指令、TypeScript prop接口或包安装命令(无shadcn/Radix CLI命令)。代码实施由下游开发工作流处理。

[!CAUTION] 2. 设计令牌前提门(令牌优先规则):没有经过验证的规范性设计令牌在 docs/project.json 中,任何组件都不能被设计。缺失的令牌必须在起草组件设计之前进行打磨和持久化。请参阅 token-verification-matrix.md。

[!TIP] 3. 令牌守恒规则(禁止在技能内直接生成图像):绝不要直接调用 generate_image。为用户制定结构化的图像生成提示,由用户生成并放入项目目录。

[!NOTE] 4. 选择性模式查找(令牌守恒):检查 references/component-design-patterns.md 中的路由表,并只加载 references/patterns/ 下匹配的组件文件(例如 hero.md)。如果匹配,在自适应访谈中追问用户是否希望实现该模式。


工作流概览

flowchart TD
    Start["调用 /component-design<br/>(页面 + 组件名称)"] --> Step1["步骤1:动态上下文与令牌门<br/>(扫描 docs/**, CONTEXT.md、令牌及目标模式)"]
    Step1 --> CheckTokens{"docs/project.json中的<br/>设计令牌是否完整?"}
    CheckTokens -- "令牌缺失" --> GrillTokens["打磨缺失令牌<br/>(3个上下文驱动的选项)"]
    GrillTokens --> SaveTokens["持久化到 docs/project.json"]
    SaveTokens --> Step2
    CheckTokens -- "已验证" --> Step2["步骤2:多轮自适应打磨<br/>(第1-3轮 + 目标模式打磨)"]
    Step2 --> Step3["步骤3:视觉资产提示制定<br/>(提供立即可用的图像提示)"]
    Step3 --> Step4["步骤4:搭建并编写 design-spec.md<br/>(docs/design/components/[page]/[component]/)"]
    Step4 --> Step5["步骤5:子代理审计与自动修复<br/>(invoke_subagent 检查护栏与令牌)"]
    Step5 --> Finish["规范准备就绪,可向下游移交<br/>(视觉原型制作 / 实施)"]

执行运行手册

步骤1:动态上下文发现与设计令牌验证门

  1. 扫描项目上下文:动态检查 docs/ 和根目录 CONTEXT.md 中的所有文件,以提取目标用户画像、业务目标和现有设计书签。
  2. 扫描支持的语言环境:读取 docs/project.json 中的 project_context_and_metadata.supported_languages。
  3. 验证设计令牌:根据 token-verification-matrix.md 审查 docs/project.json 中的 "design_system"。
  4. 打磨缺失令牌:如果令牌缺失,制定3个针对项目的选项(其中一个标记为 (推荐)),询问用户,并将其持久化到 "design_system" 下。
  5. 目标设计模式查找:扫描 references/component-design-patterns.md 中的路由表,并且如果存在与正在设计的组件匹配的模式,则只查看 references/patterns/ 下特定的组件模式文件。

步骤2:渐进式多轮组件打磨

使用 ask_question(或交互式聊天)执行自适应3轮访谈,在每轮之间暂停以接收用户答案。关于完整的提问表述,请参阅 adaptive-grilling-rounds.md:

  • 如果在 references/patterns/ 中找到了匹配的模式,将其问卷纳入第1轮或第2轮,明确询问用户是否希望实现该模式。
  • 第1轮(意图与故事):明确组件目的、用户待完成的任务以及情感基调。
  • 第2轮(空间层次与网格):根据第1轮的回复,定制多列布局、密度比例和焦点视线流。
  • 第3轮(交互与强调):根据第1轮和第2轮的结果,建立悬停/焦点状态动态、媒体资产以及双向(BiDi)/从右到左(RTL)细节。

步骤3:主动式视觉资产提示制定

如果组件需要定制图形、背景或图标,为用户制定结构化的生成提示,而不是调用 generate_image。提示块格式请参阅 adaptive-grilling-rounds.md。

步骤4:搭建组件文件夹与 design-spec.md

  1. 创建目录:docs/design/components/[页面名称]/[组件名称]/
  2. 使用 design-spec.template.md 中的规范性9部分布局搭建 design-spec.md:
    • §1 执行摘要与故事
    • §2 视觉层次与空间流
    • §3 布局网格与响应式断点(移动端、平板、桌面端)
    • §4 设计令牌与颜色映射(浅色与深色)
    • §5 排版缩放(每个支持的语言环境)
    • §6 交互状态矩阵(默认、悬停、激活、焦点、禁用、骨架屏)
    • §7 双向(RTL)适配
    • §8 可访问性与人机工程学(WCAG AA/AAA,触摸目标 $≥ 44\text{px}$)
    • §9 推荐的视觉资产与提示

步骤5:独立子代理质量审计 (invoke_subagent)

为了保证无偏的质量,在向用户展示结果之前,调用一个独立的评审子代理:

  1. 生成审计子代理(TypeName: "self",Role: "Independent Design & UX Auditor",Model: "inherit")。
  2. 使用 subagent-audit-protocol.md 中的结构化审计提示。
  3. 如果 ISSUES_FOUND,在得出结论之前立即解决 design-spec.md 中所有标记的问题。

下游移交

一旦 design-spec.md 获得批准并验证:

  1. 视觉原型制作:触发 stitch-design 以在Google Stitch中生成UI屏幕和布局变体。
  2. 代码实施:将 design-spec.md 提供给组件实施技能(例如 nextjs-component-dev / nextjs-create-component)。

执行验证清单

在完成执行之前,确认:

  • 交付物中不存在代码或库安装命令(无React、Next.js、shadcn CLI)。
  • docs/project.json 中的规范性设计令牌已验证且完整。
  • 输出目录结构为 docs/design/components/[页面]/[组件]/。
  • 打磨选项是动态合成的,没有硬编码的仓库假设。
  • 组件打磨遵循了渐进式自适应轮次。
  • 未直接调用 generate_image;资产提示已提供给用户。
  • design-spec.md 包含所有9个必需的章节。
  • 已通过 invoke_subagent 调用独立子代理审计,并且所有问题已解决。

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

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

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

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

相关技能