Home / All Skills / Workflow & Core Tools / performance-optimization
Workflow & Core Tools · addyosmani/agent-skills

performance-optimization

Audits and optimizes web application performance across frontend rendering, bundle sizing, network waterfall, database queries, and memory footprints. Use when investigating slow pages, high latency, or poor Web Vitals.

L1 Basic · Source registration onlyV1 Commit-PinnedDual-pass Audit
💬 Chat Trial
Author addyosmaniGitHub addyosmani/agent-skills ↗Stars 113872License MITCommit 301b02b12b
Control levels describe skill capabilities and suggested control measures; they do not represent quality or safety certifications, nor do they dictate usability. Usage decisions rest entirely with users and administrators. Different agent hosts apply varying constraints; do not assume hosts provide automatic protection. Third-party skill copyrights belong to their original authors. Use at your own risk.

1How It Works & Mechanism

Full-stack performance profiling covering Core Web Vitals, memory leaks, and query latency.

skills/performance-optimization/SKILL.md
Measure before optimizing. Performance work without measurement is guessing — and guessing leads to premature optimization that adds complexity without improving what matters. Profile first, identify the actual bottleneck, fix it, measure again.
End-to-end performance diagnostic.

Bundle analysis identifying tree-shaking failures, duplicate dependencies, and bloated modules.

skills/performance-optimization/SKILL.md
- **Synthetic (Lighthouse, DevTools Performance tab):** Controlled conditions, reproducible. … - **RUM (web-vitals library, CrUX):** Real user data in real conditions.
Code size reduction.

Critical rendering path optimization (CSS containment, font loading, layout shift prevention).

skills/performance-optimization/SKILL.md
What is slow? … First page load … Large bundle? --> Measure bundle size, check code splitting … Slow server response? --> Measure TTFB in DevTools Network waterfall
Rendering speed boost.

Database query plan audit detecting N+1 queries and missing composite indices.

skills/performance-optimization/SKILL.md
- **N+1 queries.** One query per row is the most common backend bottleneck. Fetch the relation in the same query (join/include) instead of in the loop.
Backend latency eradication.

明确连接池耗尽排查原则与容量上限:单进程连接池须保证实例数乘最大连接数不超出数据库承载上限,禁止用无脑调大连接池掩盖连接泄漏。

skills/performance-optimization/SKILL.md
- **Connection pool exhaustion.** Signature: *every* endpoint slows at once, time is spent waiting for a connection rather than executing, and the database shows mostly idle sessions.
这里在做什么:阐述连接池瓶颈特征与排查规则,建议在无界扩缩容场景下引入 pgbouncer 或 RDS Proxy 复用连接。

构建严谨的缓存设计与防击穿防穿透纪律:要求显式指定失效策略、缓存键必须包含所有影响响应的输入(租户/语言/权限),并加设并发合并或陈旧响应守卫。

skills/performance-optimization/SKILL.md
- **Missing caching.** Cache what is expensive to produce and read far more often than it changes … Every input that changes the response belongs in the key … Guard hot keys against the stampede
这里在做什么:给出缓存层级选型建议(进程内/分布式/CDN)与安全失效策略,严禁将强时效与余额权限数据缓存。

前端深度优化图片与资源加载:给所有图片显式标注宽高消除 CLS,LCP 图片配置高优先级加载与多分辨率响应式格式,非首屏图片懒加载。

skills/performance-optimization/SKILL.md
- **Missing image optimization.** Every image declares `width` and `height` (CLS). The LCP image gets `fetchpriority="high"`, modern formats (AVIF, WebP) through `<picture>`
这里在做什么:规范现代 Web 前端核心资源加载顺序与标签属性最佳实践,防止排版抖动与首屏渲染延迟。

实行绝对严苛的验证裁决法则:复测必须采用与基线完全一致的环境与命令,收益在波动噪声内(中性结果)必须强制回滚,杜绝积累无效复杂度。

skills/performance-optimization/SKILL.md
**"Neutral" is a revert, not a keep.** This is the step teams skip: the change is already written, throwing it away feels wasteful, so it lands unmeasured, and the codebase accretes complexity that never bought anything.
这里在做什么:定下保留与回滚的铁律矩阵,强制把实验记录(含被回滚的方案与原因)登记归档,防止后人重复尝试失败思路。

2Core Capabilities

01Core Web Vitals diagnostic and optimization
02Frontend bundle size and dependency deduplication
03Critical rendering path and layout shift remediation
04Backend database query and caching optimization
05多级缓存策略选择与热点防击穿(Stale-While-Revalidate / 并发请求折叠)
06前端资源拆包、路由级懒加载与 React 不必要渲染优化
07持续集成性能预算门禁配置(bundlesize 与 Lighthouse CI)

4Recommended Governance & Evidence

Suggested Controls for Safe Operation
For Agent Runtime
Can be auto-loaded
For Administrators
Register source and version
Audit Notes: Performance methodology guidelines and diagnostic criteria; zero intrusive host privileges.

5Second-Pass Verification

  • [ok] 自身目录无自带可执行脚本与外发网络调用 — 经检查,skills/performance-optimization/ 下仅有 SKILL.md 与 references/optimization-patterns.md,全量扫描无网络请求、无凭证读取、无自带 .sh/.js 脚本。
  • [ok] CI 命令仅为工程建议与示例,非 skill 自身打包执行 — 扫描命中的 npx bundlesize 与 npx --package=@lhci/cli lhci autorun 处于 Step 5 Enforce in CI 代码块中,属于推荐用户在工程 CI 流水线中集成的配置示例,skill 自身不带执行钩子。
  • [ok] Core Web Vitals 规范阈值定义真实准确 — SKILL.md 中明确给出 LCP (≤2.5s)、INP (≤200ms)、CLS (≤0.1) 的 Good 级别标准,与 Google 官方 CWV 规范完全一致。
  • [ok] optimization-patterns.md 完整涵盖声明的 6 种优化反模式 — references/optimization-patterns.md 包含 N+1 Queries、Unbounded Data Fetching、Queries That Ignore Their Index、Connection Pool Exhaustion、Missing Image Optimization、Unnecessary Re-renders、Large Bundle Size、Missing Caching 等全部对应模式与代码实现。
  • [ok] 验证与回滚纪律(Keep or Revert 矩阵)有据可循 — SKILL.md Step 4 明确提供 Result vs. baseline 裁决矩阵以及 Neutral is a revert 原则,并要求建立实验台账。

6Verdict & Scenarios

  • Identifies high-impact performance bottlenecks across both frontend and backend layers
  • Provides concrete, measured remediation code rather than vague high-level advice
  • Aligns optimizations directly with Google Core Web Vitals standards
  • Best for: Ideal for software engineers, frontend architects, and DevOps leads troubleshooting slow response times, poor SEO rankings, or heavy infrastructure bills.
    Not for: Not a substitute for dedicated real-time APM monitoring suites like Datadog or New Relic in production.
    💬 Online Trial Chat Sandbox

    Preview this skill in an interactive chat playground. Generic LLM evaluation trial.

    💬 Open Chat Trial (Preview)
    Under construction · Generic sandbox trial
    Install Agent-Ready
    ① Accelerated Distribution dl.bestaiskill.com
    Option A · Direct Zip Download⚡ Download performance-optimization (Zip)
    Edge-accelerated mirror via dl.bestaiskill.com
    Option B · Copy Guide for Agent
    install.json
    Agents automatically download and verify mirrors from this JSON guide.
    ② Upstream GitHub
    GitHub Repo ↗
    Pinned to commit 301b02b12b.