Communitygithub.com

plugin87/性能优化

针对核心网页指标(LCP、INP、CLS)优化UI性能,提供加载/代码拆分策略、布局偏移预防及动画性能规则。当用户希望提升速度、修复卡顿或布局偏移、达到网页指标预算、或让界面在低端设备上感觉流畅时使用。

性能优化 是什么?

该技能专注于优化UI性能,确保界面快速且稳定,将性能视为可访问性问题——慢速或卡顿的界面首先会损害低端设备体验。它遵循系统性的步骤:首先读取 `workflows/performance.md` 文档,了解核心网页指标目标、加载策略、布局偏移预防、动画性能以及设计系统运行时成本。然后,以中端移动设备配置(慢速4G网络 + 4倍CPU节流)为基准进行诊断,确保 LCP ≤ 2.5秒、INP ≤ 200毫秒、CLS ≤ 0.1。关键优化手段包括:优先渲染首屏内容(SSR/服务端组件)、按路由和重量级组件进行代码拆分、懒加载非首屏/交互触发的内容(如Astro Islands或Qwik)、预加载一种关键字体、使用现代响应式图片。同时,通过为骨架屏设置精确尺寸、使用 `aspect-ratio` 保留媒体空间、避免在现有内容之上注入内容来彻底消除布局偏移。动画方面,仅使用 `transform` 和 `opacity` 属性,谨慎使用 `will-change`,动画时长控制在100-300毫秒,并遵循 `prefers-reduced-motion` 用户偏好。为降低INP,优先使用CSS状态样式而非JavaScript,并进行摇树优化及按组件导入。该技能支持Claude Code、Cursor、Codex等主流AI代理平台,通过结构化工作流和清晰的验证标准(包括Lighthouse实验室数据与实际字段数据)确保优化效果可衡量、可复现。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/plugin87/ux-ui-agent-skills/tree/main/.claude/skills/performance

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

技能:性能优化

确保用户界面快速且稳定。将性能视为可访问性问题——缓慢或卡顿的界面会首先影响低端设备用户。

步骤

  1. 读取 workflows/performance.md(核心网页指标目标、加载策略、布局偏移、动画性能、设计系统运行时成本)。
  2. 根据预算进行诊断:LCP ≤ 2.5秒、INP ≤ 200毫秒、CLS ≤ 0.1。在中端移动设备配置(慢速4G网络 + 4倍CPU节流)下进行测量。
  3. 加载:优先渲染首屏内容(SSR/服务端组件),按路由和重量级组件进行代码拆分,懒加载非首屏/交互触发的内容(Astro Islands / Qwik),预加载一种关键字体,使用现代响应式图片。
  4. 消除布局偏移:将骨架屏尺寸设为最终尺寸,通过 aspect-ratio 属性保留媒体空间(tokens/sizing.json),切勿在现有内容之上注入新内容。
  5. 动画:仅使用 transform 和 opacity 属性,谨慎使用 will-change,动画时长为100-300毫秒(tokens/motion.json),遵循 prefers-reduced-motion 用户偏好。优先使用CSS状态样式而非JavaScript以降低INP;进行摇树优化并按组件导入。

验证(完成标准)

  • Lighthouse实验室数据或实际字段数据满足:LCP ≤ 2.5秒,INP ≤ 200毫秒,CLS ≤ 0.1(以中端移动设备为基准)。
  • 首次交互在慢速4G网络 + 4倍CPU节流条件下保持响应。
  • 骨架屏和媒体元素预留空间(加载时零CLS);循环动画中无非合成器属性变化。

Individual skills in this repo

This repo contains 7 individual skills — each has its own dedicated page.

plugin87/design-tokens

Generate, extend, or audit design tokens in DTCG format with the 3-tier architecture (primitive → semantic → component). Use when the user wants a color palette, type scale, spacing/shadow/radius/motion tokens, multi-brand theming, or wants to validate token files. Covers colors, typography, spacing, shadows, borders, breakpoints, motion, gradients, opacity, blur, sizing, states, theming.

plugin87/governance

Govern how the design system evolves — SemVer for tokens/components, the contribution workflow, deprecation policy, and change communication. Use when the user wants to add/promote/deprecate a component or token, decide a version bump, set up a contribution process, or keep the system from fragmenting.

plugin87/image-to-code

Turn a reference image, screenshot, or mockup into token-driven, accessible code — infer the design system from the reference (palette, type scale, spacing, radius, layout archetype), map it to the 3-tier tokens, rebuild it, then verify with the kit's gates. Use when the user provides a design/screenshot and wants matching UI code.

plugin87/prototype

Move an idea up the fidelity ladder (content-first → wireframe → low-fi → high-fi → code) with a validation plan at each level, plus user-journey mapping and usability-testing scripts. Use when the user wants to prototype, wireframe, map a user flow, or plan/run usability testing.

plugin87/redesign

Upgrade an existing website or app to premium quality without breaking functionality — audit the current design, identify generic/AI tells, then apply taste and system rules surgically. Use when the user wants to improve, modernize, polish, or "make better" an existing UI/codebase.

plugin87/token-build

Set up or run the token build pipeline — transform the DTCG tokens/*.json (source of truth) into platform artifacts (CSS variables, Tailwind @theme, JS/TS, iOS Asset Catalog, Android, Compose) with Style Dictionary / Tokens Studio / W3C DTCG export. Use when the user wants to generate platform theme files from tokens, wire token CI, or multi-platform token output.

plugin87/ux-writing

Write or review UI copy — buttons, errors, empty states, microcopy, notifications, labels — using the voice & tone system (clear, concise, useful, human, honest) with the what→why→how error formula and inclusive-language rules. Use when the user needs interface copy, error messages, empty-state text, or a copy review.

相关技能