Communitygithub.com

wivo

Optimizes a website's images and videos with the wivo command-line tool, so every file is made with the same presets. Responsive AVIF/JPEG or WebP/PNG sets with <picture> markup, single masters for image components and CMSs, and small H.264 MP4s with posters and <video> markup. Use it whenever images or videos are added to, replaced in or optimized for a website project. That includes hero images, photos, logos, screenshots, team or product shots, background or hero video loops, and product or talk videos. It also covers phone or client photos and videos dropped into the repo, converting to AVIF, WebP or web MP4, srcset or <picture> markup, posters, and cutting page weight or LCP caused by media. Use it even when the user names another tool (ffmpeg, sharp, squoosh, ImageMagick) for this kind of website media work.

Qu'est-ce que wivo ?

wivo is a Claude Code agent skill that optimizes a website's images and videos with the wivo command-line tool, so every file is made with the same presets. Responsive AVIF/JPEG or WebP/PNG sets with <picture> markup, single masters for image components and CMSs, and small H.264 MP4s with posters and <video> markup. Use it whenever images or videos are added to, replaced in or optimized for a website project. That includes hero images, photos, logos, screenshots, team or product shots, background or hero video loops, and product or talk videos. It also covers phone or client photos and videos dropped into the repo, converting to AVIF, WebP or web MP4, srcset or <picture> markup, posters, and cutting page weight or LCP caused by media. Use it even when the user names another tool (ffmpeg, sharp, squoosh, ImageMagick) for this kind of website media work.

Compatible avec~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/matterandmotion/wivo/tree/HEAD/skills/wivo

Demander à votre IA préférée

Ouvre une nouvelle conversation avec cette compétence d'agent déjà préchargée.

Documentation

wivo: website image and video optimization

wivo turns source images and videos into web-ready files with fixed, tested presets, and prints the markup for them. Run it instead of writing ffmpeg, sharp or ImageMagick commands yourself. Hand-written commands drift from file to file and from session to session. wivo makes the same file from the same source every time, with the sizes, formats, quality, colour handling and metadata removal already decided.

The command

npx @matterandmotion/[email protected] <command> ...

Always use this exact version: it's what these instructions describe, and a pinned version means every machine makes identical files. Below, wivo stands for that whole command.

CommandWhat it does
wivo checkConfirms wivo can run here (Node, and a test encode with each engine)
wivo info <files or folders> --jsonSize, photo or graphic, transparency; for videos duration, frame rate, codec, HDR, sound
wivo images <files or folders> --out <folder> [options] --jsonOptimizes images
wivo videos <files or folders> --out <folder> [options] --jsonOptimizes videos

wivo --help lists every option.

Steps

1. Check that wivo runs

Run wivo check once per session, before anything else. If it fails, read references/setup.md. Usually Node is missing or too old, and the user needs to install it. Don't fall back to other tools: the point is identical output.

2. Learn the project

Before choosing settings, find out:

  • The framework, from package.json and the config files. It decides between a responsive set with markup and a single master for an image component. references/frameworks.md covers plain HTML, Astro, Next.js, Nuxt, SvelteKit, React with Vite, Gatsby and CMS-backed sites.
  • Where served files live (public/, static/, …), and the folders the project already uses for images and videos. Follow the existing convention, e.g. public/images and public/videos.
  • Where the originals are. Originals shouldn't be served: they're large and often carry location data. If they sit inside a served folder, suggest a folder that isn't served (e.g. media/ at the project root). Ask before moving the user's files, and never delete them.

3. Look at the files

Run wivo info <files> --json. It tells you each image's size and whether it's a photo or a graphic. For each video it gives the duration, frame rate, sound and HDR. Look at where each file is (or will be) used in the code: the layout decides its role.

4. Choose the settings

Images. --mode:

  • responsive: several widths and formats, plus <picture> markup to paste in. Use it where the markup is written by hand.
  • master: one high-quality file. Use it where an image component or a CMS makes the sizes (next/image, astro:assets, @nuxt/image, …).

--role sets the widths and the sizes value:

RoleFor
heroThe large image at the top of a page, often full width. Loads first, with high priority.
contentImages in the body of a page, up to about 800 px wide.
cardThumbnails in grids and lists.
graphicLogos, screenshots, diagrams, flat illustrations (lossless).
autoThe default: graphics become graphic, photos content.

Videos. --use:

UseForResult
backgroundDecorative video that loops behind text or in a sectionUp to 720p, 30 fps, no sound, autoplaying
heroThe large video at the top of a page, autoplayingUp to 1080p, 30 fps, no sound
contentVideo people choose to watch: demos, talks, interviewsUp to 1080p and 60 fps, with sound and controls

Quality: --quality balanced (the default), unless the user asks for smaller files (lower) or better quality (higher).

Files with the same settings go in one command. If a choice isn't clear from the code or the request, ask the user and say what you'd pick and why. A Hero where a Card was meant gives the wrong widths and loading. references/images.md and references/videos.md have the full presets and the finer decisions.

5. Run it

wivo images media/team.jpg media/office.jpg --out public/images --mode responsive --role content --json
wivo videos media/reel.mov --out public/videos --use background --json
  • --json gives you every file, size, warning and the markup to use.
  • --markup jsx for React files (JSX, TSX); HTML also suits Astro, Svelte and Vue templates.
  • --path: the URL path in the markup is worked out from a public/ or static/ folder. When the output folder is elsewhere, pass --path with the URL it's served at.
  • --dry-run shows the plan without encoding. It's worth showing the user before a long video job or a big batch.

Speed. wivo runs everywhere because its encoders are WebAssembly, but that makes it slower than native tools:

  • Images: about 15–30 s each for a large photo, several at once.
  • Videos: about 3 s per second of video at 720p, and 5–6 s at 1080p. A 2-minute 1080p video takes around 10 minutes.

Before a long job, tell the user roughly how long it will take. Give it a generous timeout or run it in the background, and don't run two wivo commands at once: each uses every core.

Exit codes: 0 means done. 1 means some files failed and the rest were made (the JSON says which, and why). 2 means a mistake in the command; the message says what to fix.

6. Use the results

  • Markup: put each result's markup where the file is used, replacing old references to the original. Search the code for the original file name.
  • Alt text: describe what a meaningful image shows. Use alt="" for decorative ones. wivo leaves alt empty, because only you can see what the image is for.
  • width and height: keep them. They stop the layout shifting.
  • sizes: wivo's values are starting points. Adjust them when the layout shows how wide the image really is.
  • Image components: with master, use the component with the output file and the width and height from the JSON. references/frameworks.md shows how.
  • Hero videos: put markup.head (a poster preload) in the page's <head>.
  • wivo's notes: follow them. An autoplaying video longer than 5 seconds needs a pause button, and a Content video needs captions. references/videos.md has a small pause pattern.
  • Commit the outputs and manifest.json. wivo writes manifest.json in each output folder. Its outputs are reproducible, so to change a file, change the settings and run wivo again on the original. Don't edit outputs, and don't feed them back into wivo.
  • manifest.json is public. In a served folder it's published with the site, and it lists the originals' file names. If a name shouldn't be public (a client's internal file name, say), rename the original before running wivo.

7. Report

Tell the user:

  • what was made: files, sizes before and after (from the JSON)
  • the settings you chose for each file, and why
  • any warnings or failures, with wivo's own message
  • what's left for them: confirming alt text, writing captions, moving originals, uploading masters to a CMS

When wivo can't do it

wivo doesn't crop, trim, or turn a GIF into a video yet. It can't read HEIC photos or AV1 videos; it tells you to export them as JPEG, or H.264 or HEVC, first. SVGs are already vector: leave them as they are.

Say what's missing and ask the user how to go on. Don't switch to another tool silently: files made a different way are exactly what wivo exists to prevent.

Reference files

  • references/setup.md: installing Node on macOS, Windows and Linux, npm and network problems, adding wivo to a project.
  • references/images.md: every image preset (widths, formats, quality, sizes), masters, markup details, placeholders.
  • references/videos.md: every video preset, sound, long loops, HDR, posters, markup, a pause pattern, captions.
  • references/frameworks.md: where files go and how to use the results in each framework, and on CMS-backed sites.

Skills associés