Unhappy

educlopez/ui-craft/cli/assets/gemini/skills/unhappy

作者 educlopezceecc8e1fb0c2befda73da996435900d6dd0c1ac无许可证375 个星标收录于 2026年10月9日更新于 2026年10月9日仓库5周前更新

State-first design pass — inventories and implements all non-happy states (loading, empty, error, partial, conflict, offline) before the happy path, and refactors impossible boolean state to proper state machines. Use when starting a new screen, reviewing an existing one for edge-case gaps, or when the user says "handle the error state" / "add loading states" / "what happens when data is missing". Invoke when the user asks for unhappy on their UI, or mentions 'unhappy' alongside design / UI / frontend work.

AI 生成的概览

在正常路径之前先盘点并实现所有非正常 UI 状态的设计流程。

功能
该技能引导对 UI 目标进行状态优先的设计:盘点每个数据源和交互界面,将各状态(空闲、加载、空、错误、部分、冲突、离线)标记为已设计、缺失或不适用,然后补齐缺口。它还会审查正常路径中未检查资源是否存在的假设,并将不可能出现的布尔状态重构为状态机或 reducer,同时为可能离线的操作加入乐观 UI 与重连后的对账。产出是直接修改代码,并附上 Before/After/Why 审查表,每新增一个状态一行。
适用场景
适用于开始新界面、审查现有界面的边界情况缺口,或被要求处理错误状态、添加加载状态、确定数据缺失时的表现时。它面向需要设计和实现非正常状态的 UI 与前端工作。
运行要求
仅含指令,不附带脚本。它需要以参数形式提供 UI 目标,并引用更广泛的 ui-craft 技能中的配套文件(references/state-design.md、references/loops.md、SKILL.md),以及一个 CRAFT_LEVEL 设置,未知时默认为 7。
<!-- HARNESS MIRROR — do not edit here. Canonical source: skills/ or commands/. After editing source, copy into cli/assets/<harness>/ and repo-root harness mirrors. -->

Context: this sub-skill is one lens of the broader ui-craft skill. If the ui-craft skill is also installed, read its SKILL.md first for Discovery + Anti-Slop + Craft Test, then apply the specific lens below.

Design every non-happy state for the UI at $ARGUMENTS. Load the ui-craft skill and read references/state-design.md.

Step 1 — Inventory. List every data source and interactive surface in the target. For each, enumerate its states:

Surfaceidleloadingemptyerrorpartialconflictoffline

Mark each cell as designed (exists in code), missing (must add), or N/A (not applicable — e.g., a read-only view has no conflict state).

Step 2 — Fill the missing states. For each missing state, either stub it inline or add a follow-up task comment. Use references/state-design.md for:

  • Skeleton sizing (match final layout, 200ms delay, 5s upper bound)
  • Empty-state copy (why empty + next action + visual)
  • Error-state contract (specific cause + one-click recovery + support ID)
  • Offline handling (queue writes + reconcile on reconnect)

Step 3 — Audit the happy path. Flag every spot where the happy path assumes resource presence without checking. Fix with early-returns, state guards, or discriminated-union state handling. Booleans like isLoading && !error && data that allow impossible states are findings — refactor to a proper state machine or reducer.

Step 4 — Optimistic UI + reconciliation. For offline-likely actions (saves, sends, edits, toggles), implement optimistic UI with reconciliation on reconnect. Queue writes locally. Surface any rejected writes — never swallow them.

Knob gating (CRAFT_LEVEL):

CRAFT_LEVELRequired states to stub
≤ 4idle, loading, error
5-7idle, loading, empty, error, success
8+all six — add partial, conflict, offline

If CRAFT_LEVEL is unknown, default to 7.

Convergence note: To iterate until all required states are present, load skills/ui-craft/references/loops.md and run preset state-coverage (budget = the default loop budget defined in loops.md): after stubbing the highest-priority missing required state, re-inventory until all knob-required states are present or budget exhausted. Emit the pre-flight cost notice before iteration 1.

Output: edit the code directly. After each file, print the Review Format table from SKILL.md:

BeforeAfterWhy
no loading state on <ProjectList>skeleton rows matching final layout, 200ms delayprevents "is it broken?" perception; avoids CLS
generic "Error" toastinline error with specific cause + retry + support IDrecoverability (heuristic 9)

One row per state added. No full diffs.

Next step: /harden — implement the states you just designed (rung 1).

来源与署名

来源:educlopez/ui-craft位于cli/assets/gemini/skills/unhappy提交ceecc8e

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架