optikit Covers what frameworks leave to you: video, posters, favicons, SVG, fonts, icons. Catches defects before production. A command-line tool for frontend developers. It runs in your terminal, in CI or through a coding agent, and adds no code to your bundle. Built to automate what I kept doing by hand on my own projects. Why use it It does what your framework leaves to you. Next.js and Astro optimize the images…
Asset CLI for frontend developers and coding agents. Covers what frameworks leave to you: video, posters, favicons, SVG, fonts, icons. Catches defects before production. Ships as a Claude Code plugin.
Covers what frameworks leave to you: video, posters, favicons, SVG, fonts, icons. Catches defects before production. A command-line tool for frontend developers. It runs in your terminal, in CI or through a coding agent, and adds no code to your bundle.
Built to automate what I kept doing by hand on my own projects.
Why use it
It does what your framework leaves to you. Next.js and Astro optimize the images in their image component. Video, posters, favicons, SVG, icons and files in public/ stay yours. One CLI for all of them.
It checks, not only compresses.video check fails the build on a clip that waits for a full download: invisible on your connection, slow on your visitors’ phones.
Your coding agent can run it. Three skills come with it, one job each.
You don’t need it for images that already go through next/image or Astro’s <Image>.
Next to your framework
Task
Next.js / Astro
optikit
Images through the image component: WebP, AVIF, sizes, srcset
yes
img can, but you don’t need it here
Images in public/ and CSS backgrounds
served as they are
img: WebP, AVIF, @1x/@2x
Loading placeholder
Next: a tiny blur for static imports
placeholder: an eighth-size image you can still recognise, for any image or video poster
OG image from a photo
Next draws one from JSX code
og: crops the photo to 1200×630
Favicon set
you supply each file, the framework adds the <link> tags
favicon: every size, .ico, manifest and an opaque iOS icon from one SVG
Video: compress, convert
no
video compress, video convert
Video that starts before it fully downloads
no
video faststart fixes it, video check fails the build
Poster frame for <video>
no
video poster: the sharpest well-exposed frame, or a contact sheet to choose from
Icons that look centred
no
icon audit, by centre of gravity
File names from clients (Cyrillic, spaces, #)
no
--web-names
Next to ffmpeg, sharp and svgo
Tool
What it does
What optikit adds on top
ffmpeg
anything with video, if you know the flags
presets, faststart on every encode, a 2-pass size budget, posters, a check for CI
sharp
the image engine optikit uses
the @1x/@2x pack, an AVIF quality that looks like the WebP beside it, phone photos upright by default, safe file names
svgo
optimizes SVG
removes scripts and event handlers by default, which svgo leaves in
Quick start
Paste this to your coding agent:
Set up optikit in this project.
1. Check that `node -v` gives 24 or later. If an older Node is active,
stop and ask me.
2. Install @gulyakevich/optikit as a dev dependency with this project's
package manager. If an install policy (a minimum release age, for one)
blocks it, stop and ask me. Do not change the policy.
3. If the project has video, run `ffmpeg -version` and tell me if it is missing.
4. If you are Claude Code, ask me whether to add the optikit plugin: the
skills plus a hook that runs `optikit check` on every SVG, page or clip
you write. If I say yes: check for a machine-wide optikit with
`cd ~ && optikit --version`; if there is none, ask me before
`npm i -g @gulyakevich/optikit`. Then run
`claude plugin install optikit --marketplace OlgaGulyakevich/optikit`,
tell me to restart Claude Code, and skip step 5.
5. Run `npx --no -- optikit skill --install <your folder of skills>`
(for Claude Code: ~/.claude/skills). Keep `--no`: it stops npx from
downloading, and the bare name `optikit` on npm is another package.
6. Add to AGENTS.md or CLAUDE.md of this project (create AGENTS.md if
neither exists): "Images outside the framework's image component,
video, posters, favicons and SVG go through optikit. How: the skills
optikit, optikit-video and optikit-icons; without them installed, read
one with `npx --no -- optikit skill <name>`."
7. Read the skills that fit this project (`npx --no -- optikit skill
optikit`, `optikit-video`, `optikit-icons`), then list the
files in this project that optikit would prepare and where the results
would go. Ask me before you run anything.
Then ask in your own words:
“Turn the images in public/ into WebP and AVIF, with @2x.”
“Make a poster for every <video> and add video check to the build.”
“Find the icons that look off-centre and fix them.”
Video needs ffmpeg on the machine; everything else runs on Node 24 or later.
In Claude Code, as a plugin. It brings the three skills and a hook: after the agent writes an SVG, an HTML page or a clip, optikit check runs on that file, and a defect goes back to the agent to fix. The CLI itself still comes from npm, and the hook uses only a machine-wide install (npm i -g @gulyakevich/optikit or Volta): it runs without asking, so it never runs a binary from the project folder.
claude plugin install optikit --marketplace OlgaGulyakevich/optikit
That is for your terminal; in a Claude Code chat, type the same after a slash: /plugin install optikit --marketplace OlgaGulyakevich/optikit. To update, claude plugin update optikit@optikit.
Install by hand, and update
npm install -D @gulyakevich/optikit # in a project, for CI and builds
npm install -g @gulyakevich/optikit # or once for the whole machine
# the skills, for Claude Code (globally installed: drop `npx --no --`)
npx --no -- optikit skill --install ~/.claude/skills
To update, install the new version the same way (npm install -D @gulyakevich/optikit@latest, or -g). The skills follow by themselves: they read their instructions from the installed version. Run skill --install again only when the changelog names a new skill.
What it catches
A clip with its index at the end. 1404 KB of a 1406 KB file load before the first frame. video faststart fixes it without re-encoding; video check stops it in CI.
A portrait photo from a phone. It lies on its side in WebP while AVIF stays upright, because encoders drop the EXIF turn. optikit applies the turn first.
A letter stored two ways.Zürich.mp4 from a Mac can hold ü as u plus a mark: the link reads right and returns 404. --web-names gives zuerich.mp4.
Commands
Command
What it does
img
PNG and JPG → WebP and AVIF, @1x and @2x
og
a 1200×630 share image from a photo
video compress, video convert
web mp4 from any video or a GIF, always faststart; --max 8mb for a size budget
video faststart
moves the index to the front, no re-encode
video check
exit 1 on a clip that isn’t faststart, or when nothing was found
video poster
the sharpest well-exposed frame, or six to choose from
placeholder
tiny recognisable images and aspect ratios, as JSON
favicon
the full set from one SVG, with an opaque iOS icon
svg
smaller SVG, scripts removed
svg check
exit 1 on an aria reference that points nowhere, or a name without role="img"
font
TTF and OTF → woff2, --subset latin,cyrillic keeps only those characters, @font-face rules written for you
trim
crops transparent padding
icon audit
finds icons that look off-centre; --fix corrects them
check
one pass over the folder your site serves: every defect above, exit 1 if any; --json for scripts and agents
skill
the instructions for your coding agent
Every command writes to --out (default optimized/) and leaves the sources as they are; --web-names makes file names safe for a URL. Flags, defaults and the reasons behind them: docs/commands.md.
Real numbers from the bundled samples/: a 2.35 MB @2x PNG photo → 83 KB WebP, 53 KB AVIF. A 19 MB 4K clip → 0.96 MB, or 2.9 MB with --max 3mb.
Does it help?
One client folder, two agents. A vertical 4K clip with its index at the end, a phone photo stored on its side, a logo with a script in it, Cyrillic names. With optikit and its skills, the agent passed all 16 checks of the finished files in 3 minutes, without writing code. Without optikit, an equally careful agent spent 5.5 minutes, wrote a 5 KB script with two new dependencies to maintain, and missed 2: the clip stayed above 1080p (1080×2048), and nothing stops a broken clip in the build. One run can’t prove it; it is the kind of difference I expect.
How it works
optikit video compress hero.mov --max 8mb # mp4 under 8 MB, plays at once
optikit video check public/video # exit 1 if a clip waits to load
optikit favicon logo.svg --out public # every size, .ico, manifest
optikit img ./assets --avif # WebP, AVIF, @1x and @2x
optikit icon audit ./icons --fix # icons centred by visual weight
Sources are never changed. Output mirrors the input inside --out, and a second run skips its own output.
Every command checks what it wrote: a faststart file is read back, a fixed icon is measured again, and a broken file is named while the rest are still written. The exit code is 1 whenever something failed.
No network, no shell: files are read and new ones written, ffmpeg gets its arguments as an array, SVG loses its scripts. Releases come from GitHub Actions with provenance and no npm token. More in SECURITY.md.
TypeScript strict, five engines (sharp, ffmpeg, svgo, png-to-ico, HarfBuzz) behind one Tool<Job> contract, Zod at the argv boundary, Vitest, CI on Ubuntu and Windows. More in docs/architecture.md, and the choices behind it in docs/decisions.
What’s next
Ideas for later. None is promised.
og from an SVG. Today og crops a photo. A cover that is drawn still needs a browser to become a PNG.
If an asset of yours isn’t covered, open an issue and say which one.
评论