skills/reverse-engineer-animation/SKILL.md
Reverse-engineers a UI animation from a screen recording. Extracts frames with ffmpeg, tracks motion per frame with OpenCV, fits easing and spring curves, annotates choreography (leads, lags, over-stretch), and emits CSS, Motion/Framer Motion, SwiftUI, React Native, or UIKit code plus a handoff motion spec. Use when the user shares or uploads a screen recording or video of a UI animation, or asks to "reverse engineer this animation", "recreate this animation", "match this easing", "extract the animation curve", "figure out the spring from this video", "copy this transition from a video", "how does this animation work", or "reproduce this motion". For designing new motion from scratch or reviewing motion code, use ui-animation instead.
npx skillsauth add mblode/agent-skills reverse-engineer-animationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
ui-animation.| File | Read when |
|------|-----------|
| references/measurement-guide.md | Deciding what to measure, eye vs script, reading metrics.json, choosing an ROI |
| references/curve-fitting.md | Reading fit_curves.py output, spring vs bezier, judging fit error, asymmetric open/close |
| references/code-output.md | Emitting code for CSS, Motion/Framer Motion, SwiftUI, React Native, or UIKit |
| references/choreography.md | Multi-element / multi-phase motion: staggers, blur-before-move, per-edge settling |
ffmpeg: frame extraction (brew install ffmpeg). Required for step 1.pip install opencv-python numpy scipy for tracking + curve fitting (step 4).Extraction degrades gracefully: with only ffmpeg you can still extract frames and reason visually. Tracking and fitting need the Python packages.
Copy and track this checklist:
Reverse-engineer progress:
- [ ] Step 1: Extract frames + contact sheet (per direction if open differs from close)
- [ ] Step 2: Vision pass: identify element, effects, phases
- [ ] Step 3: Decide precision (eye-only vs scripted)
- [ ] Step 4: Track motion and fit curves (if escalating)
- [ ] Step 5: Annotate choreography (delays, asymmetry)
- [ ] Step 6: Emit code for the target(s)
- [ ] Step 7: Validate against the recording
Run python3 scripts/extract_frames.py <video> <outdir>. On a multi-second recording,
trim to just the transition with --start SECONDS --duration SECONDS; extracting the
whole clip floods the contact sheet and dilutes tracking. If the interaction has both an
open and a close, trim two windows and run the whole pipeline once per direction.
They are almost never mirror images, so one measurement cannot serve both.
Match --fps to the source: probe with
ffprobe -v 0 -select_streams v -show_entries stream=avg_frame_rate <video> and never
sample above the source rate (see Gotchas). Open the generated contact_sheet.png first;
it shows the whole timeline at once.
View the contact sheet and name, in order:
references/measurement-guide.md.Run python3 scripts/track_motion.py <outdir> to produce metrics.json. Pass
--bbox X,Y,W,H to restrict detection to one element when several move (one run per
element). Then run python3 scripts/fit_curves.py <outdir>/metrics.json to get
spring params, cubic-bezier, and a fit error per property. If you extracted with a
non-default --fps, pass the same --fps to fit_curves.py: its default is 30 and
a mismatch rescales every duration and stiffness (see Gotchas). Read
references/curve-fitting.md to interpret the numbers and pick the model. High error
on both models means multi-phase motion: split the timeline and fit each segment.
Load references/choreography.md. Build the timing-offset table (when each property starts
and settles). Those lead/lag gaps and the over-stretch carry more of the feel than any
single curve.
Substitute the fitted parameters into the templates in references/code-output.md for the
requested target. Keep movement on transform/opacity. Emit two transitions when
open and close differ. Produce the consolidated handoff motion spec (timing table +
curves + snippet) from references/code-output.md so the result can be implemented without
the video.
Run the Validation checks below. The exit criterion is comparison evidence, never "looks right".
fit_curves.py defaults to --fps 30. Extract at --fps 60 and fit at the default,
and every duration_ms doubles (a 500 ms transition reports as 1000 ms) while fitted
stiffness drops to a quarter. Always pass the extraction fps to the fit.--fps 60 yields runs of identical values in metrics.json that plateau the progress
curve and inflate both fit errors. Probe the source rate first and match it.metrics.json rows are duplicated frames,
not a pause in the animation. If plateaus dominate, re-record at a steadier frame rate
instead of chasing the fit.references/curve-fitting.md).error: a bad fit gives
confident-looking but wrong numbers; treat error > 0.08 as suspect.width, height, top, left): reproduce
the motion on transform/opacity/filter (defer to ui-animation rules).extract_frames.py, and compare contact sheets side-by-side with the original.transform, opacity, and filter.overshoot/zeta against what you saw; a clear bounce must
not fit as a flat ease.ui-animation: turn the extracted spec into production-grade, interruptible motion and
apply its easing defaults and anti-pattern rules.development
Fans out four concurrent review agents over the current diff, then APPLIES fixes directly to the working tree and verifies the build. Mutates code; it does not produce a report. Covers reuse (duplicate logic, hand-rolled stdlib, reinvented platform features), quality (hacky patterns, React/TypeScript hygiene, over-memoisation, exhaustive-deps, `any`, dead code, `CLAUDE.md`/`AGENTS.md` violations), efficiency (unnecessary work, missed concurrency, hot-path bloat), and test discipline (bug fixes without a repro test, useless tests to delete, missing tests only when they prevent a named failure). Use when the user says "tidy this up", "simplify", "clean up this diff", "polish my changes", "check for duplication", or "any reuse opportunities?", i.e. when the intent is to have the changes made automatically. For a read-only report that lists findings without touching files, use `pr-reviewer` instead. This skill edits code; for the PR's title, description, or commit history, use `pr-creator`.
development
Decides what an interface should do before UI is built or audited: interaction choice, action scope and consequence, reachable states, resilience, and accessibility as task completion. Works from a brief, spec, mockup, intent, or existing UI. Use when asked "is this the right interaction", "design the flow", "what control should this use", "what should this action affect", "which states should this have", "make this resilient", or "what breaks here". For building or styling use ui-design; for built-code audits use ui-audit; for copy wording use copywriting.
development
Builds and stress-tests implementation plans in two modes. Create mode scans code and docs, asks one question at a time with a recommended answer, runs a blindspot pass when the user is new to the area, then writes a plan file. Review mode scores completeness, feasibility, scope, testability, risk, and assumptions, verifies checkable claims, and writes resolutions back until every dimension reaches 5/5. Use when asked to "create a plan", "plan this feature", "I want to build X", "grill me", "think this through", "blindspot pass", "unknown unknowns", "this is new to me", "review my plan", "rubber duck this", "stress test this plan", "is this plan ready", "get this plan to 5/5", "what am I missing", "verify this claim", "prove this plan", "fact-check this plan", or when the user explicitly wants a plan artifact before implementation. For code review use pr-reviewer; for architecture briefs use define-architecture.
tools
Audits the smallest relevant developer-facing surface of a library, CLI, SDK, or npm package across API contracts, errors, CLI behavior, public types, onboarding, and config. Uses candidate-first rule loading, bounded local evidence, and compact root-cause findings. Use when asked to "audit my CLI", "make this CLI agent-friendly", "is this API ergonomic", "review the developer experience", "improve these errors", "simplify first run", or "review my SDK". For end-user UI use ui-audit, for agentic-app trust use ax-audit, for docs prose use docs-writing, for README work use readme-creator, and for repo architecture use define-architecture. Inside a product that also ships a UI, this is the skill for the developer-facing half, so pick it when the complaint is about an import, command, error string, exported type, or config rather than a screen.