Token导航 LogoToken导航

Agent Skill · 研究检索

component-patterns-code(组件模式代码)

component-patterns-code 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

component-patterns-code 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 68,015。

总安装 238周安装 10GitHub Stars 3下载 83核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:component-patterns-code(组件模式代码)
来源仓库:https://github.com/phazurlabs/ux-ui-mastery
仓库路径:skills/component-patterns-code
安装命令:
npx skills add https://github.com/phazurlabs/ux-ui-mastery --skill component-patterns-code
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/phazurlabs/ux-ui-mastery --skill component-patterns-code

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

专注于生产级 UI 工程中的组件思维与实现模式。将组件视为状态机,涵盖状态设计、测试与真实条件适配。适用于高可靠性界面开发,避免静态视觉元素导致的缺陷。安装前建议确认项目是否采用类似工程实践标准。component-patterns-code 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

提供组件生命周期、网络与交互异常处理指导原则。

来源仓库内路径:skills/component-patterns-code

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/phazurlabs/ux-ui-mastery --skill component-pat…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

component-patterns-code 怎么安装?

在终端执行 npx skills add https://github.com/phazurlabs/ux-ui-mastery --skill component-patterns-code。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

component-patterns-code 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

component-patterns-code 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

component-patterns-code 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

component-patterns-code 用的人多吗?

公开数据是累计安装 238 次,近一周安装 10 次,下载 83 次,GitHub 3 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

component-patterns-code 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
component-patterns-code

组件模式代码 · 本页

2383需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Component Patterns & Code — Production-Ready UI Engineering

The Component Mindset

"A component is not a visual artifact. It is a state machine with a visual output." Every button, input, modal, and card exists in a matrix of states that must be designed, implemented, and tested. Developers and designers who treat components as static visual elements inevitably ship incomplete interfaces that break under real-world conditions — when the network is slow, when the user tabs instead of clicks, when the content is unexpectedly long, when the screen is 320px wide.

Production-quality component engineering demands three disciplines simultaneously: visual fidelity (the component looks correct across every state), behavioral completeness (the component responds correctly to every interaction), and semantic correctness (the component communicates its purpose and state to all users, including those using assistive technology).

Component State Matrix Methodology

Every component exists in far more states than the typical design file represents. The State Matrix is a systematic enumeration of every possible visual and behavioral state a component can occupy. Before writing a single line of code, enumerate the full matrix.

The Universal State Set

These states apply to virtually every interactive component:

  1. Default — the resting state, no user interaction, content loaded normally
  2. Hover — pointer device is over the component, visual feedback indicates interactivity
  3. Focus — the component has keyboard focus, visible focus ring is mandatory (WCAG 2.4.7)
  4. Active/Pressed — the component is being activated (mousedown, touch start)
  5. Disabled — the component is non-interactive, visually muted, removed from tab order
  6. Loading — the component or its content is being fetched, skeleton or spinner is shown
  7. Error — something went wrong, the error is communicated visually and to screen readers
  8. Success — an operation completed successfully, confirmation feedback is shown
  9. Skeleton — content has not yet loaded, a placeholder shape indicates the forthcoming layout
  10. Empty — no data to display, guidance or action is offered to the user
  11. Read-only — content is visible but not editable, visually distinct from disabled
  12. Selected — the component is chosen within a selection group (checkbox checked, row highlighted)
  13. Dragging — the component is being repositioned, visual affordance communicates movability
  14. Overflow — content exceeds bounds, truncation or scroll behavior activates

Compound States

States combine. A text input can be simultaneously focused and in an error state. A button can be loading and disabled. A table row can be selected and hovered. Your component API must handle compound states gracefully without combinatorial explosion. The recommended pattern is to model each state dimension independently:

  • Interaction state: default, hover, focus, active (mutually exclusive for pointer, but focus persists alongside hover)
  • Validation state: none, error, warning, success (one at a time)
  • Content state: loaded, loading, skeleton, empty, error (one at a time)
  • Selection state: selected, unselected
  • Availability state: enabled, disabled, read-only

This dimensional model yields a manageable API surface rather than an unwieldy union of every possible combination.

State Matrix Audit Checklist

Before any component ships:

  • Are all 14 universal states accounted for in design and code?
  • Do compound states resolve without visual conflicts?
  • Is every state transition animated appropriately (not jarring, not distracting)?
  • Does every state have a screen reader equivalent (aria-busy, aria-invalid, aria-disabled, aria-selected)?
  • Has every state been tested on mobile (touch) and desktop (pointer + keyboard)?

Component Taxonomy

Organizing components into functional categories creates a shared vocabulary for the team and ensures coverage. The taxonomy below covers the foundational set that virtually every product needs.

Action Components

Components that trigger operations. The user clicks, taps, or activates them to cause something to happen.

  • Button — the primary action trigger; variants include primary, secondary, ghost, danger, icon-only
  • IconButton — a button with only an icon and an accessible label; used where space is constrained
  • FAB (Floating Action Button) — a persistent action button layered over content, common on mobile
  • SegmentedControl — a group of buttons where exactly one is selected, acting as a toggle between views

Input Components

Components that accept user data.

  • TextField — single-line text entry with optional label, helper text, validation, and character count
  • TextArea — multi-line text entry with auto-resize and character limit
  • Select — a dropdown menu for choosing one option from a predefined list
  • Combobox — a searchable select that combines text input with option filtering
  • Checkbox — a binary or indeterminate toggle for non-exclusive options
  • RadioGroup — a set of mutually exclusive options
  • Toggle/Switch — an on/off binary control with immediate effect
  • Slider — a draggable track for selecting a numeric value within a range
  • DatePicker — a calendar-based date selection with keyboard support

Feedback Components

Components that communicate status, results, or system state to the user.

  • Toast/Snackbar — a temporary, non-blocking notification that auto-dismisses
  • Banner — a persistent message pinned to a region of the interface
  • Dialog/Modal — a focused overlay requiring user attention and response
  • ProgressBar — a visual indicator of completion percentage for a known-duration operation
  • Skeleton — a placeholder shape indicating content is loading

Navigation Components

Components that move the user between views, sections, or pages.

  • Tabs — horizontal or vertical tab strips for switching between panels of content
  • Breadcrumb — a hierarchical trail showing the user's location within a navigation structure
  • Sidebar/Drawer — a vertical navigation panel, collapsible on smaller screens
  • Pagination — page controls for navigating multi-page data sets
  • BottomNav — a mobile navigation bar anchored to the screen bottom

Content Components

Components that present or contain information.

  • Card — a bounded container for a cohesive unit of content and related actions
  • Avatar — a circular or rounded image representing a user, entity, or placeholder
  • Badge — a small indicator attached to another element showing count or status
  • Chip/Tag — a compact element representing an attribute, filter, or selection
  • Tooltip — a small overlay providing supplementary text on hover or focus
  • Accordion — a vertically stacked set of collapsible sections

Data Components

Components optimized for displaying structured datasets.

  • Table — a two-dimensional grid of rows and columns with sortable headers, pagination, and row selection
  • List — a vertical sequence of related items with optional actions
  • Grid — a responsive multi-column layout of repeated content items
  • Chart — a visual representation of data (bar, line, pie, scatter)

Design Token Integration

Every component must consume design tokens rather than hardcoded values. Tokens are the contract between design and code. They ensure that when the design system changes a color, spacing value, or font, every component updates automatically.

Token Categories in Components

  • Color tokens: --color-primary, --color-surface, --color-on-surface, --color-error, --color-border
  • Spacing tokens: --space-xs, --space-sm, --space-md, --space-lg, --space-xl
  • Typography tokens: --font-family-body, --font-size-sm, --line-height-normal, --font-weight-medium
  • Radius tokens: --radius-sm, --radius-md, --radius-lg, --radius-full
  • Shadow tokens: --shadow-sm, --shadow-md, --shadow-lg
  • Motion tokens: --duration-fast, --duration-normal, --easing-standard, --easing-decelerate
  • Size tokens: --size-touch-target (44px minimum), --size-icon-sm, --size-icon-md

Token Usage Rules

  1. Never use raw hex colors, pixel values, or font stacks in component CSS.
  2. Component-level tokens alias global tokens: --button-bg: var(--color-primary).
  3. State variations reference the token system: --button-bg-hover: var(--color-primary-hover).
  4. Dark mode is a token swap, not a component rewrite.
  5. Token overrides via CSS custom properties enable theming without code changes.

Accessibility-First Component Engineering

Accessibility is not an enhancement. It is a baseline requirement. Components built with accessibility from the start are cheaper to maintain, more robust, and usable by everyone.

Keyboard Navigation

  • Every interactive component must be reachable via Tab key.
  • Custom widgets must implement the expected keyboard pattern from WAI-ARIA Authoring Practices: arrow keys for menus, tabs, and radio groups; Enter/Space for activation; Escape for dismissal.
  • Focus order must match the visual order. If CSS reorders elements visually, ensure tabindex or DOM order reflects the intended sequence.
  • Focus must never become trapped (except intentionally in modals, where a focus trap is required).
  • The visible focus indicator must meet 3:1 contrast and should not rely solely on browser defaults.

ARIA Roles and States

  • Use semantic HTML first (<button>, <input>, <dialog>, <nav>). ARIA is a supplement, not a replacement.
  • Dynamic state changes require ARIA state updates: aria-expanded, aria-selected, aria-checked, aria-busy, aria-invalid, aria-disabled.
  • Live regions (aria-live="polite" or aria-live="assertive") announce dynamic content changes (toast notifications, form validation messages, loading completions).
  • Every icon-only button requires aria-label. Every image requires alt text or aria-hidden="true" if decorative.

Screen Reader Announcements

  • Toast notifications must use role="status" or aria-live="polite" so screen readers announce them without interrupting the current task.
  • Error messages should be linked to their inputs via aria-describedby.
  • Loading states should use aria-busy="true" on the loading region.
  • Route changes in SPAs should announce the new page title via a live region or focus management.

Responsive Component Patterns

Container Queries Over Media Queries

Media queries respond to the viewport. Container queries respond to the component's container. Since components are reused in different layout contexts (sidebar, main content, modal), container queries produce correct results where media queries fail.

.card-container {
  container-type: inline-size;
  container-name: card;
}

@container card (min-width: 400px) {
  .card { flex-direction: row; }
}

@container card (max-width: 399px) {
  .card { flex-direction: column; }
}

Fluid Sizing

Use clamp() for typography and spacing that scales smoothly between breakpoints without abrupt jumps:

font-size: clamp(1rem, 0.5rem + 1.5vw, 1.5rem);
padding: clamp(0.75rem, 2vw, 2rem);

Touch Target Minimums

Per WCAG 2.5.8 (Target Size), interactive elements must be at least 24x24 CSS pixels, with a recommendation of 44x44 pixels. Apple HIG specifies 44pt minimum. Material Design specifies 48dp. Always err on the side of larger targets on touch devices.

This is directly informed by Fitts's Law (see cognitive-psychology-ux): the time to reach a target is a function of distance and target size. Smaller targets increase error rates and frustration, especially under mobile conditions (one-handed use, walking, glare).

Cross-References

  • Cognitive psychology foundations — cognitive-psychology-ux covers Fitts's Law (touch target sizing), Hick's Law (reducing choice overload in selects and menus), Miller's Law (chunking in data tables and forms), and the gestalt principles that inform component grouping and layout.
  • Accessibility compliance — accessibility-inclusive-design provides the full WCAG 2.2 checklist, assistive technology testing procedures, and inclusive design patterns that component code must satisfy.
  • Design token architecture — ui-visual-design-system details the token naming conventions, scale generation, and semantic mapping that components consume.
  • Animation and interaction — interaction-motion-design covers easing curves, duration scales, reduced-motion handling, and spring physics that component transitions use.
  • Design-to-code workflow — figma-design-tool-workflows describes how component designs in Figma translate to code, including auto-layout to flexbox mapping, variant properties to component props, and design token export.
  • System governance — design-systems-architecture explains how components are documented, versioned, tested, and distributed across teams.

Key Sources

  • WAI-ARIA Authoring Practices 1.2 — W3C component keyboard and ARIA patterns
  • Inclusive Components — Heydon Pickering (component accessibility patterns)
  • Material Design 3 Component Guidelines — Google
  • Apple Human Interface Guidelines — Components
  • React Aria (Adobe) — accessible React component primitives
  • Radix UI — unstyled, accessible component primitives
  • Open UI — web platform component standards research

平台分布

Codex

35.1%
按下载量换算29

Claude

30.41%
按下载量换算25

Cursor

17.22%
按下载量换算14

Gemini CLI

9.03%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills