- name
SKILL.md
技能檔案保留在發布者的儲存庫中。
在終端機中貼上複製的指令。它會將這個 SKILL.md 安裝到對應的代理中。
npx skills add nucliweb/webperf-snippets --skill webperf-media -a cursor -y在終端機中貼上複製的指令。它會將這個 SKILL.md 安裝到對應的代理中。
npx skills add nucliweb/webperf-snippets --skill webperf-media -a claude-code -y在終端機中貼上複製的指令。它會將這個 SKILL.md 安裝到對應的代理中。
npx skills add nucliweb/webperf-snippets --skill webperf-media -a codex -y在終端機中貼上複製的指令。它會將這個 SKILL.md 安裝到對應的代理中。
npx skills add nucliweb/webperf-snippets --skill webperf-media -a grok -y在 Grok Bot 聊天中傳送複製的訊息。Bot 會從 GitHub 取得這個 SKILL.md,並加入你所有 Bot 共用的技能中。
Install this skill: https://github.com/nucliweb/webperf-snippets/tree/HEAD/skills/webperf-media來自發布者
JavaScript snippets for measuring web performance in Chrome DevTools.
mcp__chrome-devtools__evaluate_script, passing the file instead of its code: sourcePath with the absolute path of scripts/<Name>.js in this skill, and format: "script", since a script runs by itself and is not a function. Read the object it returns. The scripts have no console output, so the returned object is the result: script, status and the metric data (value, rating, details, items, issues), as described in references/schema.md.status is "tracking", the script keeps observing the page. After the interactions, call the function named in getDataFn with another mcp__chrome-devtools__evaluate_script call, as an arrow function in function, for example () => getINP(), and read the object it returns.status is "error" or "unsupported", read error: the page may not have loaded yet, or the browser lacks the API.sourcePath and format need Chrome DevTools MCP 1.11.0 or later, and the server only reads files inside its workspace roots: the project, the temp folder and each --workspace=<folder> in its arguments. When it answers Access denied, as it does for a skill installed outside the project, such as in ~/.claude/skills/, read the file and pass its code in function, still with format: "script". A --workspace with the real folder of the skills makes the path work; the server follows symlinks, so a link to the folder is not enough.
Without Chrome DevTools MCP, run the same snippet with the webperf-snippets CLI, which loads the page in headless Chromium and prints the same result objects: npx webperf-snippets <url> --snippet <Name> --json, where <Name> is the script name without .js. It needs Playwright and Chromium (npm install --save-dev webperf-snippets playwright, then npx playwright install chromium), and tracking snippets take --interact-script <file> to drive the interactions.
scripts/Image-Element-Audit.js — Image element auditscripts/Oversized-Images.js — Oversized imagesscripts/SVG-Embedded-Bitmap-Analysis.js — SVG embedded bitmap analysisscripts/Video-Element-Audit.js — Video element auditWhen the user asks for media optimization or "audit images and videos":
When the user asks "optimize images" or "check image performance":
When the user asks about images larger than needed, wasted bytes, blurry images, or srcset/sizes problems:
srcset usage of the flagged imagesWhen the user asks "optimize videos" or "check video performance":
When LCP is an image and needs optimization:
When CLS is caused by images without dimensions:
When the user asks about SVG performance or file sizes are large:
Use this decision tree to automatically run follow-up snippets based on results:
If images missing width/height attributes → Layout shift risk, run:
If images using wrong format (JPEG for graphics, PNG for photos) → Recommend:
If images much larger than display size → Recommend:
If above-the-fold images are lazy-loaded → Run:
If LCP image lacks fetchpriority="high" → Run:
If below-the-fold images are NOT lazy-loaded → Run:
If images have both loading="lazy" AND fetchpriority="high" → Run:
If images competing with critical resources → Run:
If images missing alt text → Accessibility issue, recommend adding descriptive alt text
If oversized images found → Recommend:
srcset with several widths and an accurate sizes attributeIf an oversized image is the LCP element → Run webperf-core-web-vitals:LCP.js and LCP-Subparts.js (large files inflate resource load duration)
If undersized (blurry) images found → Recommend a source with at least the needed pixels and a 2x candidate for high-density screens
If skipped images are lazy-loaded → Scroll to the end of the page and run the snippet again
If video is LCP candidate → Run:
If video missing poster → Recommend:
If video uses preload="auto" → Bandwidth concern, evaluate:
If autoplay video without muted → Browser will block, recommend:
If video missing multiple formats → Recommend:
If large video files (>5MB) → Recommend:
If bitmap images found in SVGs → Recommend:
If large embedded bitmaps (>100KB) → Critical inefficiency:
If multiple small bitmaps in SVG → Consider:
Use these thresholds to trigger recommendations:
Image File Sizes:
Image Formats:
Image Dimensions:
Video File Sizes:
Lazy Loading:
Priority Hints:
references/snippets.md — Descriptions and thresholds for each scriptreferences/schema.md — Return value schema for interpreting script outputIntelligent media optimization with automated workflows for images, videos, and SVGs. Includes decision trees that detect LCP images (triggers format/lazy-loading/priority analysis), identify layout s
---name: webperf-mediadescription: Intelligent media optimization with automated workflows for images, videos, and SVGs. Includes decision trees…---# skills/webperf-media/SKILL.md總覽
Intelligent media optimization with automated workflows for images, videos, and SVGs. Includes decision trees that detect LCP images (triggers format/lazy-loading/priority analysis), identify layout shift risks (missing dimensions), and flag lazy loading issues (above-fold lazy or below-fold eager). Features workflows for complete media audit, LCP image investigation, video performance (poster optimization), and SVG embedded bitmap detection. Cross-skill integration with Core Web Vitals (LCP/CLS impact) and Loading (priority hints, resource preloading). Provides performance budgets and format recommendations based on content type. Use when the user asks about image optimization, LCP is an image/video, layout shifts from media, or media loading strategy. Compatible with Chrome DevTools MCP.
常見問題
從發布者下載 skills/webperf-media/SKILL.md,或複製路徑後開啟儲存庫。PlugMCP 只收錄這項技能,不代管檔案。
發布者將它存放在 https://github.com/nucliweb/webperf-snippets。
Claude、Cursor、Codex 和 Grok Build 可以讀取你從發布者儲存庫加入的 SKILL.md。在聊天中傳送技能的 GitHub 資料夾連結,Grok Bot 就會安裝它。