Communitygithub.com

LIKELION-CAPSULE/Landing_Page

將指定元件的每一種狀態呈現在一個臨時頁面上,搭配模擬資料與狀態切換器,方便逐一處理各狀態的外觀。

Landing_Page 是什麼?

這個技能會選定一個元件,在專案內建立一個臨時路由,將該元件的所有可能狀態(如載入中、空資料、錯誤、典型資料、分頁、權限差異等)逐一以模擬資料呈現。它會自動掃描元件的程式碼與資料 hook,找出所有實際存在的分支狀態,並為每個狀態準備符合產品實際樣貌的資料(真實名稱、時間戳、金額等),然後透過固定的狀態切換器(以 `__state` 查詢參數控制)讓開發者能快速切換檢視。支援 React/Next.js 等框架,特別注意伺服器端與客戶端元件的邊界問題(使用 `"use client"` 確保模擬資料正常傳遞)。頁面本身只新增容器、固定資料與切換器,不修改原始元件,且移除時只需刪除一個資料夾即可完全清理。

相容平台~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. 應用程式自身的資料縫隙:如預先填充的快取、模擬 provider 或專案中的請求模擬

將模擬資料透過 props 傳遞五層深度的做法,會測試到正式環境中從未發生的路徑。如果唯一的方式是修改元件本身,則應先告知使用者並取得同意,再新增資料縫隙。

讓模擬資料看起來像真實產品:使用真實的使用者名稱、時間戳、金額,以及使用者實際會有的資料筆數。三行「測試項目」會讓每個狀態看起來都差不多。

載入中與等待中的狀態應保持靜止。讓它們持續處於等待狀態,直到切換器切換為止,不要設定計時器自動結束。

5. 新增切換器

一個固定的控制元件透過 __state 查詢參數切換狀態,因此每個狀態對應的都是一個可分享的連結。雙底線前綴確保它不與應用程式版面配置讀取的其他參數衝突。switcher.md 包含完整的規格說明。

6. 確認每個狀態都能正常渲染,然後移交

在現有的瀏覽器中載入頁面一次,逐一切換每個狀態。確認元件顯示的是模擬資料,而非真實資料或空白區域。模擬資料從未出現是最常見的失敗情況。即時同步、快取重新擷取覆蓋了預先填充的資料,或伺服器邊界丟棄模擬資料,都可能導致此問題。在移交前先修正這些資料傳遞問題。

如果手邊沒有瀏覽器,應告知使用者,並將 URL 交給使用者自行檢查。

然後移交 URL、狀態清單與切換器按鍵。到這裡即可停止。調整狀態的外觀是使用者的下一個需求,不屬於本次任務。

每次修改後重新檢查所有狀態

每次進行視覺變更後,都要重新逐一檢查所有狀態,因為修正一個狀態的問題時,經常會破壞另一個狀態。

等待使用者指示後,一次刪除

刪除頁面資料夾,以及使用者同意的任何資料縫隙。然後搜尋整個程式碼庫中是否還有殘留的路由名稱與模擬資料名稱,確認 diff 沒有修改其他與此設定無關的檔案。只有當使用者要求時才提交程式碼。

完成前的檢查清單

常見錯誤修正方式
修改了元件以接收模擬資料從頁面透過 props 或應用程式的資料縫隙提供資料;新增縫隙前先詢問
在頁面上重新建立了一個外觀相似的元件從專案中匯入真實的元件
頁面重新設定了元件的樣式或主題保持應用程式原有的版面配置、字型與設計 token
將模擬資料以 props 傳遞到深層元件在元件接收資料的位置提供資料
為顯示某個狀態而新增分支到元件中跳過程式碼無法達到的狀態,並列出缺失的狀態
「項目 1」、「測試使用者」、三行資料使用產品形狀的資料與真實數量
載入狀態在計時器後自動結束保持等待狀態直到切換器切換
未載入每個狀態就移交載入每個狀態;空白或顯示真實資料代表資料傳遞有問題
切換器使用了專案的設計 token讓切換器明顯不屬於設計系統
未經要求就修改視覺移交並等待指示
在建立頁面的同一輪中將其刪除只在使用者要求時才移除
殘留路由或模擬資料名稱移除後搜尋程式碼庫確認

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.

相關技能