Communitygithub.com

LIKELION-CAPSULE/Landing_Page

将你选择的组件在一次性页面中渲染出每一个状态,附带模拟数据和切换器,让你可以专注于每个状态。

Landing_Page 是什么?

这是一个用于快速迭代组件视觉状态的技术技能,适合在 Claude Code、Cursor 或 Codex 等 AI 辅助编程环境中使用。该技能的核心思想是:选取一个组件,自动生成一个临时路由页面,在该页面中通过真实项目导入的组件实例和模拟数据,展示组件代码中所有可能的分支状态(如加载、空态、错误、各种用户角色、功能开关等)。它通过 URL 搜索参数 `__state` 实现状态切换,每个状态都是一个可共享的链接。技能文档特别强调了数据边界:优先通过 props 或项目已有的数据 seam 注入数据,避免修改组件本身;同时要求模拟数据必须是产品化的真实形状,而非简单的“测试项”。该技能适用于 Next.js 等框架(客户端组件)以及各种 UI 组件库,支持跨平台(Claude Code、Cursor 等),并且一次性页面的清理只需删除文件夹和搜索确认。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/LIKELION-CAPSULE/Landing_Page/tree/HEAD/.agents/skills/state-machine

在你喜欢的 AI 中提问

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

文档

状态机

该技能接受一个组件,并在一个一次性页面上渲染出它所能呈现的所有状态。每个状态由模拟数据驱动,切换器可以在状态间切换,完成后一键删除页面。

它是一个工作台,而非审查工具。当用户专注于视觉效果时,页面保持显示,一次只展示一个状态,其他状态只需一个按键即可切换。将多种敌对场景堆叠在一个页面上以供一次性查看称为 break,探索备选设计称为 variant,而审查已完成的工作称为 interface-review。

1. 确定范围:一个组件

每次运行只针对一个组件:例如审计日志表格、网络面板、计费卡片。"设置页面"通常包含多个组件,需要列出它们并询问用户选择哪一个。

用一句话概述:该组件展示什么内容、在生产环境中渲染在何处、其数据来源是什么。

2. 在代码中查找状态

状态是组件已有的分支。读取组件及其数据 hook 中每一个可能的状态:

类型状态
数据加载中、空态、错误、单一项、典型集合、足够长需要滚动或分页的集合、部分请求已解决和其他待处理、过期数据重新获取
账户计划层级、角色和权限检查、所有者 vs 成员
功能功能开关、试用期、限额已满、功能禁用或锁定

代码无法达到的状态不是真正的状态。不要为了渲染一个状态而添加分支。如果设计稿中包含了代码中不存在的状态,将其列为缺失状态并忽略。

在构建之前先列出状态清单,每行一个,使用产品中使用的名称:empty、enterprise、member-no-access。用一句话说明你排除了哪些类型及其原因。仅在代码组合了多种类型时(如 member-empty)才进行组合,切勿生成笛卡尔积。

3. 构建一次性页面

在应用的临时路由中存放真实组件,该组件从项目中导入且不做任何修改。该路由免费继承应用布局、字体、全局样式和 provider。

如果框架将服务器组件和客户端组件分开,该页面应为客户端代码,在 Next.js 中需添加 "use client"。否则夹具数据可能会在跨越边界时静默消失,导致页面渲染为空。

在一个容器中渲染一个实例,容器宽度与组件在生产环境中一致。容器、夹具和切换器是该页面新增的全部内容,不引入额外的字体、样式或主题。将页面、夹具和切换器放在同一文件夹中,例如 /states/audit-log,以便一键删除。

4. 在数据边界处供给每个状态

从页面层提供给组件数据,而不修改组件本身。优先级顺序如下:

  1. Props:如果组件通过 props 接收数据。
  2. 应用自身的数据 seam:预填充的查询缓存、模拟 provider 或项目的请求 mock。

一个通过 props 向下穿透五层的夹具,测试的是生产环境中从未出现的路径。如果唯一的方式是编辑组件,请说明情况并在添加 seam 前征求用户同意。

让数据看起来像真实产品。使用真实形状的名称、时间戳、金额和用户实际拥有的条目数量。三行 "Test item" 会让每个状态看起来都一样。

加载和处理中的状态保持静止状态。保持等待状态直到切换器移动,而不是在超时后自动解决。

5. 添加切换器

一个固定的控件切换 __state 搜索参数,因此每个状态都是一个链接。双下划线确保它不会与应用的布局读取的任何参数冲突。switcher.md 中包含了规范。

6. 确认每个状态都能渲染,然后移交

在已有的浏览器中加载页面一次,遍历每个状态。组件应显示模拟数据,而不是真实数据或空白区域。从未出现的模拟数据是常见的失败情况。实时同步、缓存覆盖了种子数据后重新获取或服务器边界丢弃夹具都会导致此问题。在移交前修复管道的连接问题。

如果没有浏览器可用,请说明情况并将 URL 交给用户检查。

然后移交 URL、状态列表和切换器快捷键。到此为止。更改某个状态的视觉呈现是用户的下一个请求,不属于本步骤。

每次改动后重新检查每个状态

在视觉变更后,再次遍历每个状态,因为一个状态的修复常常会破坏另一个状态。

在用户要求时一键删除

删除页面文件夹和用户批准的任何 seam。然后在代码库中搜索路由和夹具名称,并确认 diff 不涉及设置的其他部分。仅在用户要求时才提交。

完成前检查清单

错误修复
组件被修改以接受夹具通过 props 或应用的数据 seam 从页面层供给数据;添加 seam 前征得同意
页面上放置了重新构建的类似组件从项目导入真实组件
页面重新设置样式或主题保持应用布局、字体和 tokens 不变
夹具作为 props 深入传递到组件树在组件接收数据的地方供给数据
为展示状态而向组件添加分支跳过代码无法达到的状态,并列出缺失的状态
"Item 1"、"Test user"、三行数据使用产品形状的数据和真实数量
加载状态在超时后自动解决等待直到切换器移动才解决
移交前未加载每个状态加载每个状态;空白或显示真实数据的状态意味着管道连接有问题
切换器使用项目 tokens 设置样式保持切换器明显在设计系统之外
未经请求就更改视觉效果移交并等待指令
在构建的同一轮中删除页面仅在用户要求时删除
遗留了路由或夹具名称删除后在代码库中搜索两者

Individual skills in this repo

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

LIKELION-CAPSULE/Landing_Page

Reviews and fixes keyboard and focus behavior, ARIA, accessible names, forms, screen-reader announcements, motion and zoom in your project against WCAG 2.2.

LIKELION-CAPSULE/Landing_Page

Helps you build and check a color system for your project. It generates palettes, names semantic tokens, converts between formats and measures contrast.

LIKELION-CAPSULE/Landing_Page

Combines all of the `better-*` skills into a single review across accessibility, layout, writing, typography, color and UI polish.

LIKELION-CAPSULE/Landing_Page

Helps with grouping, alignment, reading order, responsive structure and room for translated text, so a layout holds up when it is resized, translated or mirrored.

LIKELION-CAPSULE/Landing_Page

Sets and reviews how text renders in your product, from the type scale and spacing to font features, wrapping, truncation and punctuation.

LIKELION-CAPSULE/Landing_Page

Polishes the surfaces, icons and motion in your project with exact values for border radius, optical alignment, shadows, icon states and animation.

LIKELION-CAPSULE/Landing_Page

Writes and reviews your interface copy, from labels and errors to empty states and confirmations, so it matches your product's voice and tells people what to do next.

LIKELION-CAPSULE/Landing_Page

Renders a component you choose under every scenario that can reach it on a temporary page and stress tests it.

LIKELION-CAPSULE/Landing_Page

Try to break a piece of UI by feeding it worst-case data — long names, unbreakable emails, one-letter names, missing fields, huge counts, zero items, long labels, non-Latin text, emoji, extreme numbers — then render it behind a "Demo data / Worst case" toggle and report everything that broke, with the fix for each. Use when the user asks to stress-test, break, or find edge cases in a component or screen, or to "try the worst case". For visual design critique use emil-design-eng; for motion use review-animations.

LIKELION-CAPSULE/Landing_Page

Builds UI from a Figma file or a design image so it matches the design, using your project's existing tokens and components.

LIKELION-CAPSULE/Landing_Page

Explains how a website, a visual effect or an animation was built, from a live URL or a screenshot.

LIKELION-CAPSULE/Landing_Page

Reviews a branch, pull request or uncommitted change for the interface problems it introduced or regressed, across accessibility, layout, writing, typography, color and UI.

LIKELION-CAPSULE/Landing_Page

Make a web app feel native on a phone — the small CSS and meta-tag fixes that separate "a website in a browser" from something that feels installed. Covers sticky hover states, tap highlight flashes, the 100vh bug, inputs that zoom the page, laggy taps, pull-to-refresh hijacking scroll, content under the notch, long-press selecting button text, carousels that scroll the wrong way, mismatched status bars, and the rule that you test on real hardware. Use when a web app is being built for or reviewed on mobile, when something "works in Chrome but feels wrong on my phone", when building a PWA, a bottom sheet, a carousel, a full-screen layout, or any touch interaction. For motion itself use animate; for React Native use animate-expo.

LIKELION-CAPSULE/Landing_Page

Builds multiple variants of a component you're working on and helps you iterate and pick one.

相关技能