AGENT SKILL

polish-ui

暂无简介

License 许可
MIT
最近更新
2026-07-07
Stars
★ 1
Forks
0

03 SKILL.md 正文

Tool mapping (OpenCode): This skill uses:

  • question tool for user prompts (not AskUserQuestion)
  • task tool for subagents (not Agent or Task subagent syntax)
  • skill({ name: "..." }) to load other skills (not Skill(skill="...", args="..."))
  • codegraph_explore, codegraph_search, codegraph_context for codebase exploration (preferred)
  • todowrite for phase/progress tracking
  • grep, glob, read, bash as fallback when .codegraph/ not initialized

Context rule: This skill supersedes any prior skill instructions. Follow ONLY these instructions now. Read the user's goal and any mode/include/skip from the conversation context.

UX Checklist

You just changed UI. Before reporting done, walk this checklist, decide which items apply to this specific change, and fix gaps inline.

Use todowrite to track checklist items as you evaluate them.

The list is designed to grow. Treat every item as load-bearing — each one exists because the user had to re-prompt for it.


Checklist

Growth contract: When appending an item, give it three things — (1) the rule, (2) when it applies, (3) the fix. Items missing any of the three get skipped during evaluation.

1. Action buttons display their keyboard shortcut

If a button triggers an action that has (or should have) a keyboard shortcut, the shortcut must appear in the visible button text, not just as a title/aria-keyshortcuts.

Convention: mac glyphs, trailing the label, separated by a space.

  • Save ⌘S
  • Submit ⌘↵
  • Cancel ⎋
  • Delete ⌫

Glyph reference: ⌘ cmd · ⌥ opt · ⇧ shift · ⌃ ctrl · ↵ enter · ⎋ esc · ⌫ delete · → ← ↑ ↓ arrows.

Applies when: the button is a primary/secondary action with a clear shortcut (Save, Submit, Confirm, Cancel, Delete, Search, New). A button qualifies when its label is a verb and it triggers a single discrete action. Skip for icon-only buttons in toolbars where the label is already a tooltip, and for buttons inside a list row where per-row shortcuts don't make sense.

Fix: add the glyph to the label AND wire the actual key handler (the visible shortcut must work — a label without a binding is a lie).

Conflicts: if two visible actions on the same view want the same shortcut, the more frequent action wins; the other gets a modifier (⇧⌘S) or no shortcut.

2. Modals close on Esc

Any modal/dialog/sheet/drawer/popover that traps attention must close on Esc.

Fix: if using a primitive (Radix Dialog, shadcn Dialog, HeadlessUI, etc.), Esc-to-close is usually built in — verify it isn't disabled (onEscapeKeyDown preventing default, closeOnEscape={false}). If hand-rolled, add a keydown listener on Escape that calls the close handler, scoped to the modal's lifetime.

Also verify: focus returns to the trigger element after close. If the modal hijacks focus and never returns it, that's a bug even if Esc works.


How to use this skill

For each item, decide if it applies to this change; if yes, fix in the same edit pass and report one line per fix. Skip silent items — no "N/A" padding.


NEVER

  • NEVER add a shortcut glyph to a label without binding the key handler Instead: Wire the keydown listener (or framework equivalent) in the same edit. If you can't bind it, don't show it. Why: A visible ⌘S that does nothing is worse than no hint — users press it, nothing happens, trust drops.

  • NEVER report a UI change as done while skipping this checklist Instead: Run the filter step before your final message. Even a one-line button change qualifies. Why: The checklist exists because the user had to re-prompt. Skipping it reproduces the exact failure mode the skill was created to prevent.

  • NEVER list checklist gaps as "follow-up work" Instead: Fix them in the same turn. If a gap is genuinely out of scope (e.g., requires a new dependency), surface it explicitly and ask — don't silently defer. Why: Deferred UX polish never gets done; it accumulates as the same re-prompt the user is trying to eliminate.

  • NEVER render mac glyphs without detecting platform (when the app ships to non-mac users) Instead: Detect platform once (navigator.platform, userAgent, or a usePlatform() hook if the project has one) and swap to Ctrl+S / Alt / Esc text on Windows/Linux. If the project is mac-only, state that here and skip the swap. Why: ⌘ and ⌥ render as unfamiliar symbols (or boxes in missing fonts) on Windows/Linux, turning a hint into noise. The bind still works; the label lies about which key to press.

  • NEVER force items that don't apply Instead: Skip an item when the change has no surface for it (e.g., a backend-only tweak that touched a .tsx import). Padding with "N/A" wastes the user's attention. Why: Mechanical compliance erodes trust in the checklist's signal — every reported item should be a real fix.

04 同仓库更多 Skills