Agent Skillsclassroomio/classroomio › add-docs-image

add-docs-image

GitHub

将文档所需的源图片转换为优化后的 WebP 格式,存放至指定目录并插入 MDX 页面引用。

skills/add-docs-image/SKILL.md classroomio/classroomio

触发场景

需要为文档添加截图或图片 需要将 PNG 源图转换为 WebP

安装

npx skills add classroomio/classroomio --skill add-docs-image -g -y
更多选项

不安装直接使用

npx skills use classroomio/classroomio@add-docs-image

指定 Agent (Claude Code)

npx skills add classroomio/classroomio --skill add-docs-image -a claude-code -g -y

安装 repo 全部 skill

npx skills add classroomio/classroomio --all -g -y

预览 repo 内 skill

npx skills add classroomio/classroomio --list

SKILL.md

Frontmatter
{
    "name": "add-docs-image",
    "description": "Add screenshots\/images to ClassroomIO docs — convert source PNGs to optimized WebP, place them in apps\/docs\/public\/, and reference them from the .mdx pages under apps\/docs\/content\/docs\/. Use when a doc page needs annotated screenshots or other images."
}

You are adding images to the ClassroomIO docs site (Fumadocs). Pages live in apps/docs/content/docs/*.mdx and images live in apps/docs/public/, referenced with root-relative paths like /my-image.webp.

The job has three parts: optimize + convert the source image to WebP, drop it in apps/docs/public/, and insert a Markdown image reference at the right spot in the page. Match the existing images exactly so the page stays consistent.

Conventions (match these)

  • Format: WebP. Every docs image is .webp. Never reference a .png/.jpg from a page.
  • Path: root-relative. Reference as ![alt](/name.webp), NOT /apps/docs/public/... and NOT a relative path. The file goes in apps/docs/public/name.webp; the leading / resolves to that folder.
  • Filename: kebab-case, prefixed by the page/feature. e.g. certificates-rules.webp, live-class-session-settings.webp, progression-locked.webp. This keeps apps/docs/public/ self-describing.
  • Size: width capped at 1280px (shrink only), quality ~80, metadata stripped. Existing images land around 20–45 KB at 1280px wide. Source screenshots (often retina, ~1 MB) must be reduced — do not commit raw PNGs.
  • Alt text: descriptive, sentence-case, no period. Describe what the screenshot shows (and the highlight if any), e.g. Certificate rules panel with the download toggle and completion threshold. Some existing alt text notes an annotation, e.g. ... with a red box highlight on the add icon.

Step 1: Find and identify the source images

Source images are usually PNGs the user dropped in ~/Downloads. List them:

ls -lt ~/Downloads/*.png | head

If the user named them to match the target (e.g. certificates-rules.png), the mapping is direct. Otherwise open each with the Read tool (it renders images) and match it to the intended target by content. If you cannot confidently match an image, ask rather than guess.

Step 2: Convert + optimize to WebP

Check the tool (command -v magick cwebp). Prefer ImageMagick. The 1280> only shrinks images wider than 1280 (never upscales):

magick "$SRC" -resize '1280>' -strip -quality 80 "apps/docs/public/$NAME.webp"

cwebp fallback (only pass -resize when the source is wider than 1280, since cwebp -resize upscales smaller images):

cwebp -q 80 "$SRC" -o "apps/docs/public/$NAME.webp"                 # width <= 1280
cwebp -q 80 -resize 1280 0 "$SRC" -o "apps/docs/public/$NAME.webp"  # width > 1280

Confirm the result is sane (roughly 1280px wide, tens of KB), and never delete the original from ~/Downloads:

magick identify -format '%wx%h %b\n' "apps/docs/public/$NAME.webp"

To benchmark against existing images: ls -la apps/docs/public/*.webp (most are 1280px wide, ~20–45 KB).

Step 3: Insert the reference into the page

Add the image on its own line, with a blank line before and after, at the most useful spot:

  • Under a section heading — right after the section's intro sentence, before any <Steps> block.
  • Inside a <Step> — after that step's instruction, so the screenshot illustrates that exact action.
  • After the relevant paragraph — e.g. a "What students see" view goes right after the sentence describing it.
![Certificate rules panel with the download toggle and completion threshold](/certificates-rules.webp)

One screenshot per distinct UI/action. Do not stack multiple images with no text between them; give each a home next to the step or paragraph it supports.

Step 4: Format and verify

pnpm exec prettier --write apps/docs/content/docs/<page>.mdx

Verify every image reference on the page resolves to a real file in apps/docs/public/:

grep -hoE '\(/[A-Za-z0-9._-]+\.webp\)' apps/docs/content/docs/<page>.mdx \
  | tr -d '()' | while read -r p; do [ -f "apps/docs/public$p" ] && echo "OK $p" || echo "MISSING $p"; done

All lines should print OK. Report the files added, their final WebP sizes, and any source image you could not confidently match.

Don'ts

  • Don't reference a PNG/JPG from a page, or point at apps/docs/public/... instead of /....
  • Don't commit oversized images — always run the resize/quality pass.
  • Don't upscale a smaller source to 1280.
  • Don't delete the user's originals in ~/Downloads.
  • Don't invent an image for UI that does not exist; only document what you can see in a real screenshot.

版本历史

  • 4fae088 当前 2026-08-20 12:08

同 Skill 集合

skills/add-landing-template/SKILL.md
skills/animation-vocabulary/SKILL.md
skills/apple-design/SKILL.md
skills/create-issue/SKILL.md
skills/create-thumbnail/SKILL.md
skills/emil-design-eng/SKILL.md
skills/find-animation-opportunities/SKILL.md
skills/frontend-design/SKILL.md
skills/humanizer/SKILL.md
skills/i-have-adhd/SKILL.md
skills/improve-animations/SKILL.md
skills/pick-ui-library/SKILL.md
skills/prototype/SKILL.md
skills/review-animations/SKILL.md
skills/ship-feature/SKILL.md
skills/stage-and-commit/SKILL.md
skills/write-docs/SKILL.md
skills/write-prd/SKILL.md

元信息

文件数
0
版本
f08f6c6
Hash
04a9caf1
收录时间
2026-08-20 12:08

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-16 22:22
浙ICP备14020137号-1