platform-ui
Choose the platform element, the layout, the color scheme, and the first paint when building a web UI. Use when adding or changing a control, a layout, a theme, or the first screen of a page.
- License 许可
- MIT
- 所属仓库
- muratovv/ai-hats
- 最近更新
- 2026-11-05
- Stars
- ★ 3
- Forks
- 1
01 前言 Front Matter
- name
- platform-ui
- license
- MIT
- description
- Choose the platform element, the layout, the color scheme, and the first paint when building a web UI. Use when adding or changing a control, a layout, a theme, or the first screen of a page.
03 SKILL.md 正文
Platform UI
Build the control, the layout, the scheme, and the first screen with the platform.
When to Use
- Quality of the result is
ui-ux-review. The scenario gate iswebapp-testing. - Naming the schemes on a prototype is
design-direction. This skill declares the schemes that prototype already named. - Skip for backend work, scripts, and a change with no HTML, CSS, or first-paint surface.
- A mark is
logo-design. This skill does not draw one.
Procedure
- Element. Use the platform element that already does the job. A custom widget covers only the gap that element does not.
- A modal (it blocks the page) is a
dialogopened withshowModal. The page behind is inert, focus stays inside,Esccloses it, and focus returns to the opener. Light dismiss, when the design asks for it, isclosedby="any". - A non-modal overlay is a
popover. - A disclosure is
detailsandsummary. - Data collection is a
form. A change usesmethod="POST". Every control has aname. Related controls sit in afieldsetwith alegend. The submit button names the action.
- A modal (it blocks the page) is a
- Layout. Size the component from its container with
@container, and the type from the user's font size withrem. When the browser chrome changes the visible height, usedvh. Give media anaspect-ratioso loading does not move the page. - Scheme. Put the schemes the design named on the root before first paint: a
<meta name="color-scheme">in the document head andcolor-schemeonhtml. A piece with one scheme declares that one. - First paint. The first screen's image and font are in the initial HTML. The image is not
loading="lazy"; it carriesfetchpriority="high". A web font usesfont-display: swap. A script that is not needed for that first paint usesdeferorasync. A long list paints the visible rows. - Field error.
aria-invalidand the visible error arrive together, when the field matches:user-invalid. They wait until the user has left the field.
Completion
- The element, the layout, the scheme, and the first paint each follow the step that applies. A step that the change does not touch is left as it was.
ui-ux-reviewstill judges the result.webapp-testingstill gates it.
Validation scenario (RED). Asked for a confirm-delete on a chat, the agent builds a div overlay, sets the body font in px, lazy-loads the first image, and sets aria-invalid when an empty required field receives focus. GREEN: a dialog opened with showModal, type in rem, color-scheme on html before paint, the first image present in the HTML with fetchpriority="high", and aria-invalid only once the field matches :user-invalid.
Anti-Patterns
- A custom overlay, menu, or disclosure where
dialog,popover, ordetailsalready does the job. - A second color scheme the design did not name.
- A passing
webapp-testingrun treated as the element choice. - An external guide pasted into the answer. The steps above are the procedure.
Attribution
Procedure written for this catalog. The element, layout, scheme, and first-paint choices are distilled from GoogleChrome/modern-web-guidance (Apache-2.0) at 4f2b13e25c5815b3f080ca0d983e828d96561a0f, and the first-paint fixes from ChromeDevTools/chrome-devtools-mcp skills/debug-optimize-lcp (Apache-2.0) at af2834411a564d366f9cab63efb046d9084f4dba. Their text is not copied.
04 同仓库更多 Skills
tool-evaluation-protocol
Time-bounded protocol for evaluating new tools, libraries, or methodologies before adoption. Use when evaluating a candidate dependency for the project, researching a methodology (e.g. ML/LLM frameworks, testing approaches), or following up on a hype-driven recommendation.
systematic-debugging
4-phase bug-fix protocol (evidence, pattern, hypothesis, verify). Use when investigating any error, failure, or unexpected behavior, handling bug reports from users or monitoring, or diagnosing test failures with non-obvious causes.
skill-template
Canonical template and validation guide for ai-hats skills. Use when creating a new skill, reviewing an existing one for structural compliance, or deciding which pattern fits a new behavior.
skill-optimization
Audit and refactor library components to eliminate redundancy and staleness. Use during periodic library maintenance, after adding multiple new skills or rules, when a role's token budget is too high, or after retrospectives identify component issues.
silent-fallback-gate
PreToolUse hook — refuses an Edit or Write that adds an inert broad except. Use when a Python edit was blocked for a silent fallback.
retro-to-framework
Convert an observation about agent behavior — from a retrospective or from a single incident — into a framework-level change (hook, rule, skill, skill update). Use after a retrospective identifies problems that are not project-specific, after an incident where an agent misapplied a component it had read, when CLAUDE.md band-aids accumulate (more than 3 per-project rules that could be generic), or when the same problem recurs across multiple projects.