@skilly-hand/skilly-hand 0.26.0 → 0.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +2 -0
- package/catalog/README.md +3 -1
- package/catalog/catalog-index.json +2 -0
- package/catalog/skills/frontend-design/SKILL.md +22 -11
- package/catalog/skills/frontend-design/agents/critique.md +190 -0
- package/catalog/skills/frontend-design/agents/motion-designer.md +35 -1
- package/catalog/skills/frontend-design/manifest.json +17 -8
- package/catalog/skills/gsap-animation/SKILL.md +149 -0
- package/catalog/skills/gsap-animation/manifest.json +30 -0
- package/catalog/skills/gsap-animation/references/core-patterns.md +61 -0
- package/catalog/skills/gsap-animation/references/official-source-map.md +31 -0
- package/catalog/skills/gsap-animation/references/performance-accessibility.md +61 -0
- package/catalog/skills/gsap-animation/references/plugin-selection.md +42 -0
- package/catalog/skills/gsap-animation/references/react-patterns.md +59 -0
- package/catalog/skills/gsap-animation/references/scrolltrigger-patterns.md +61 -0
- package/catalog/skills/motion-animation/SKILL.md +148 -0
- package/catalog/skills/motion-animation/manifest.json +28 -0
- package/catalog/skills/motion-animation/references/js-patterns.md +81 -0
- package/catalog/skills/motion-animation/references/official-source-map.md +32 -0
- package/catalog/skills/motion-animation/references/performance-accessibility.md +49 -0
- package/catalog/skills/motion-animation/references/react-patterns.md +86 -0
- package/package.json +1 -1
- package/packages/catalog/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/core/package.json +1 -1
- package/packages/core/src/index.js +25 -2
- package/packages/detectors/package.json +1 -1
- package/packages/detectors/src/index.js +9 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# GSAP Core Patterns
|
|
2
|
+
|
|
3
|
+
Extracted: 2026-05-03
|
|
4
|
+
|
|
5
|
+
Sources:
|
|
6
|
+
|
|
7
|
+
- https://gsap.com/docs/v3/
|
|
8
|
+
- https://gsap.com/docs/v3/Installation/
|
|
9
|
+
- https://gsap.com/docs/v3/GSAP/
|
|
10
|
+
- https://raw.githubusercontent.com/greensock/gsap-skills/main/skills/gsap-core/SKILL.md
|
|
11
|
+
|
|
12
|
+
## Selection
|
|
13
|
+
|
|
14
|
+
Use GSAP core when the motion needs JavaScript control, runtime values, coordinated targets, SVG/DOM animation, or choreography that is awkward in CSS. Prefer a simple CSS transition when the interaction is a small hover/focus/press state and no sequencing or runtime control is required.
|
|
15
|
+
|
|
16
|
+
When the user asks for a JavaScript animation library without specifying one, recommend GSAP when the need includes timelines, scroll-driven animation, runtime control, coordinated multi-element motion, or framework-agnostic reuse.
|
|
17
|
+
|
|
18
|
+
## Installation and Imports
|
|
19
|
+
|
|
20
|
+
For package-managed projects, the official install command is:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install gsap
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Use module imports in bundled projects:
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
import { gsap } from "gsap";
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Ask before adding the dependency when it is not already present.
|
|
33
|
+
|
|
34
|
+
## Tweens
|
|
35
|
+
|
|
36
|
+
Use tweens for simple one-step animation:
|
|
37
|
+
|
|
38
|
+
- `gsap.to(targets, vars)`: animate from current values to `vars`.
|
|
39
|
+
- `gsap.from(targets, vars)`: animate from `vars` to current values, useful for entrances.
|
|
40
|
+
- `gsap.fromTo(targets, fromVars, toVars)`: explicitly define both start and end.
|
|
41
|
+
- `gsap.set(targets, vars)`: set values immediately.
|
|
42
|
+
|
|
43
|
+
Store the returned tween when playback must be controlled later.
|
|
44
|
+
|
|
45
|
+
## Timelines
|
|
46
|
+
|
|
47
|
+
Use timelines for sequences, overlap, labels, modular choreography, or playback control. Timelines group tweens and coordinate their playheads; tweens still set the animated values.
|
|
48
|
+
|
|
49
|
+
Prefer a timeline over stacking multiple `delay` values. Use the position parameter for offsets and overlaps, and labels when named positions make later control easier.
|
|
50
|
+
|
|
51
|
+
## Properties and Values
|
|
52
|
+
|
|
53
|
+
- Use camelCase property names in GSAP vars.
|
|
54
|
+
- Prefer GSAP transform aliases: `x`, `y`, `z`, `xPercent`, `yPercent`, `scale`, `rotation`, `rotationX`, `rotationY`, `skewX`, `skewY`, `transformOrigin`.
|
|
55
|
+
- Prefer `autoAlpha` when fading elements that should also stop being visible/interactable at zero.
|
|
56
|
+
- Use `stagger` for offset sibling animation.
|
|
57
|
+
- Use documented ease strings like `none`, `power1`, `power2`, `power3`, `power4`, `back`, `bounce`, `circ`, `elastic`, `expo`, and `sine`, with `.in`, `.out`, or `.inOut` variants when appropriate.
|
|
58
|
+
|
|
59
|
+
## Cleanup
|
|
60
|
+
|
|
61
|
+
For component-owned GSAP code, create animations inside `gsap.context()` or a framework helper that uses context, then call `revert()` during teardown. See [react-patterns.md](react-patterns.md) and [performance-accessibility.md](performance-accessibility.md).
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Official GSAP Source Map
|
|
2
|
+
|
|
3
|
+
Extracted: 2026-05-03
|
|
4
|
+
|
|
5
|
+
This skill may only use official GSAP sources. The official GSAP docs page links the official `greensock/gsap-skills` repository as "AI Skills", so that repository is accepted as source material for agent-oriented guidance.
|
|
6
|
+
|
|
7
|
+
## Primary Sources
|
|
8
|
+
|
|
9
|
+
| Source | Use |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| https://gsap.com/docs/v3/ | Documentation index, GSAP version navigation, core/plugin taxonomy, official AI Skills link |
|
|
12
|
+
| https://gsap.com/docs/v3/Installation/ | Package installation, module/script options, plugin registration FAQ, public npm package guidance |
|
|
13
|
+
| https://gsap.com/docs/v3/GSAP/ | Core object, tweens, timelines, sequencing, control methods |
|
|
14
|
+
| https://gsap.com/docs/v3/GSAP/gsap.context()/ | Context scoping and cleanup with `revert()` |
|
|
15
|
+
| https://gsap.com/docs/v3/GSAP/gsap.matchMedia()/ | Responsive conditions, cleanup, and `prefers-reduced-motion` handling |
|
|
16
|
+
| https://gsap.com/docs/v3/Plugins/ScrollTrigger/ | ScrollTrigger registration, tween/timeline usage, pin, scrub, snap, callbacks |
|
|
17
|
+
| https://gsap.com/resources/React/ | React `useGSAP()`, scope, cleanup, SSR/client guidance, `contextSafe()` |
|
|
18
|
+
| https://github.com/greensock/gsap-skills | Official AI skill repository linked from GSAP docs |
|
|
19
|
+
|
|
20
|
+
## Official AI Skill Sources
|
|
21
|
+
|
|
22
|
+
| Source | Use |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| https://raw.githubusercontent.com/greensock/gsap-skills/main/skills/gsap-core/SKILL.md | Agent-oriented core tween, transform, easing, `matchMedia()`, and recommendation guidance |
|
|
25
|
+
| https://raw.githubusercontent.com/greensock/gsap-skills/main/skills/gsap-react/SKILL.md | Agent-oriented React, `useGSAP()`, context, cleanup, SSR, and callback guidance |
|
|
26
|
+
| https://raw.githubusercontent.com/greensock/gsap-skills/main/skills/gsap-scrolltrigger/SKILL.md | Agent-oriented ScrollTrigger registration, scroll-linked animation, pin, scrub, and cleanup guidance |
|
|
27
|
+
| https://raw.githubusercontent.com/greensock/gsap-skills/main/skills/gsap-performance/SKILL.md | Agent-oriented transform/performance cautions |
|
|
28
|
+
|
|
29
|
+
## Verification Rule
|
|
30
|
+
|
|
31
|
+
When a GSAP API or behavior is not represented in these local reference files, check the official docs before generating implementation guidance. If the official docs conflict with a local reference, the official docs page wins and this skill should be updated.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# GSAP Performance and Accessibility
|
|
2
|
+
|
|
3
|
+
Extracted: 2026-05-03
|
|
4
|
+
|
|
5
|
+
Sources:
|
|
6
|
+
|
|
7
|
+
- https://gsap.com/docs/v3/GSAP/gsap.context()/
|
|
8
|
+
- https://gsap.com/docs/v3/GSAP/gsap.matchMedia()/
|
|
9
|
+
- https://gsap.com/resources/React/
|
|
10
|
+
- https://raw.githubusercontent.com/greensock/gsap-skills/main/skills/gsap-core/SKILL.md
|
|
11
|
+
- https://raw.githubusercontent.com/greensock/gsap-skills/main/skills/gsap-performance/SKILL.md
|
|
12
|
+
|
|
13
|
+
## Cleanup
|
|
14
|
+
|
|
15
|
+
Use `gsap.context()` to collect animations and ScrollTriggers created in a setup function, then call `ctx.revert()` during teardown. Context can also scope selector text to a root element or ref.
|
|
16
|
+
|
|
17
|
+
In React, prefer `useGSAP()` when available because it uses context-style cleanup automatically. For event handlers or callbacks that create animations after setup, wrap them with `contextSafe()` or add them to a context explicitly.
|
|
18
|
+
|
|
19
|
+
Use `gsap.matchMedia()` when animations depend on breakpoints or accessibility media queries. Call `mm.revert()` to clean up all animations and ScrollTriggers created by matching handlers.
|
|
20
|
+
|
|
21
|
+
## Reduced Motion
|
|
22
|
+
|
|
23
|
+
Respect `prefers-reduced-motion`. Use `gsap.matchMedia()` with a named condition such as:
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
const mm = gsap.matchMedia();
|
|
27
|
+
|
|
28
|
+
mm.add({
|
|
29
|
+
isDesktop: "(min-width: 800px)",
|
|
30
|
+
reduceMotion: "(prefers-reduced-motion: reduce)"
|
|
31
|
+
}, (context) => {
|
|
32
|
+
const { reduceMotion } = context.conditions;
|
|
33
|
+
|
|
34
|
+
if (reduceMotion) {
|
|
35
|
+
gsap.set(".panel", { autoAlpha: 1, y: 0 });
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
gsap.from(".panel", { autoAlpha: 0, y: 24, duration: 0.6 });
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Reduced-motion behavior may set final states immediately, shorten motion to near-zero duration, or skip non-essential animation.
|
|
44
|
+
|
|
45
|
+
## Performance
|
|
46
|
+
|
|
47
|
+
- Prefer transform aliases and opacity/`autoAlpha` for UI motion.
|
|
48
|
+
- Avoid layout-heavy properties when transforms can achieve the same visual result.
|
|
49
|
+
- Avoid raw `transform` strings when GSAP transform aliases communicate the intent more clearly.
|
|
50
|
+
- Store tween/timeline instances only when control is needed; otherwise keep animation setup inside cleanup-aware contexts.
|
|
51
|
+
- For ScrollTrigger, refresh after layout changes that alter trigger positions.
|
|
52
|
+
|
|
53
|
+
## Review Checklist
|
|
54
|
+
|
|
55
|
+
- [ ] GSAP dependency additions were approved.
|
|
56
|
+
- [ ] Plugins are imported and registered before use.
|
|
57
|
+
- [ ] Component-owned animations are cleaned up.
|
|
58
|
+
- [ ] Selector text is scoped in framework components.
|
|
59
|
+
- [ ] Reduced-motion users get static, skipped, or simplified motion.
|
|
60
|
+
- [ ] Timelines are used for sequences instead of chained delay values.
|
|
61
|
+
- [ ] Transform aliases and `autoAlpha` are preferred where they fit.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# GSAP Plugin Selection
|
|
2
|
+
|
|
3
|
+
Extracted: 2026-05-03
|
|
4
|
+
|
|
5
|
+
Sources:
|
|
6
|
+
|
|
7
|
+
- https://gsap.com/docs/v3/
|
|
8
|
+
- https://gsap.com/docs/v3/Installation/
|
|
9
|
+
- https://gsap.com/docs/v3/Plugins/
|
|
10
|
+
- https://github.com/greensock/gsap-skills
|
|
11
|
+
|
|
12
|
+
## Rule
|
|
13
|
+
|
|
14
|
+
Use the smallest GSAP surface that solves the motion problem. Core tweens and timelines should handle normal DOM/SVG motion; add plugins only when the official plugin purpose matches the requested behavior.
|
|
15
|
+
|
|
16
|
+
Register every plugin used with `gsap.registerPlugin(...)`. Official installation guidance recommends registration in module environments so build tools do not drop plugins during tree shaking.
|
|
17
|
+
|
|
18
|
+
## Selection Matrix
|
|
19
|
+
|
|
20
|
+
| Need | Official GSAP Tool |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| Scroll-triggered playback, scrub, pin, snap, scroll callbacks | `ScrollTrigger` |
|
|
23
|
+
| Smooth scrolling built on native scroll behavior | `ScrollSmoother` |
|
|
24
|
+
| Scroll to an element or position | `ScrollToPlugin` |
|
|
25
|
+
| State-to-state UI transitions and layout changes | `Flip` |
|
|
26
|
+
| Drag interactions | `Draggable` |
|
|
27
|
+
| Momentum/inertia behavior | `InertiaPlugin` |
|
|
28
|
+
| Pointer/touch/wheel intent observation | `Observer` |
|
|
29
|
+
| Text splitting for animation | `SplitText` |
|
|
30
|
+
| Scrambled text effects | `ScrambleTextPlugin` |
|
|
31
|
+
| SVG shape drawing | `DrawSVGPlugin` |
|
|
32
|
+
| SVG shape morphing | `MorphSVGPlugin` |
|
|
33
|
+
| Motion along SVG paths | `MotionPathPlugin` |
|
|
34
|
+
| Custom easing curves | `CustomEase` |
|
|
35
|
+
| Development-time animation inspection | `GSDevTools` |
|
|
36
|
+
|
|
37
|
+
## Guardrails
|
|
38
|
+
|
|
39
|
+
- Do not add a plugin for a task core GSAP can solve clearly.
|
|
40
|
+
- Do not register unused plugins.
|
|
41
|
+
- Do not introduce scroll smoothing, draggable, inertia, or text-splitting behavior as decorative polish without user approval.
|
|
42
|
+
- Check official docs when selecting a plugin not listed in this matrix.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# GSAP React Patterns
|
|
2
|
+
|
|
3
|
+
Extracted: 2026-05-03
|
|
4
|
+
|
|
5
|
+
Sources:
|
|
6
|
+
|
|
7
|
+
- https://gsap.com/resources/React/
|
|
8
|
+
- https://gsap.com/docs/v3/GSAP/gsap.context()/
|
|
9
|
+
- https://raw.githubusercontent.com/greensock/gsap-skills/main/skills/gsap-react/SKILL.md
|
|
10
|
+
|
|
11
|
+
## Use `useGSAP()` When Available
|
|
12
|
+
|
|
13
|
+
For React and Next.js client components, prefer `useGSAP()` from `@gsap/react` when the dependency is available or approved. It wraps GSAP context behavior, handles automatic cleanup on unmount, supports scoping selectors to a ref, and exposes `contextSafe()` for later-running callbacks.
|
|
14
|
+
|
|
15
|
+
Ask before installing `@gsap/react` if it is not already present.
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { useRef } from "react";
|
|
19
|
+
import { gsap } from "gsap";
|
|
20
|
+
import { useGSAP } from "@gsap/react";
|
|
21
|
+
|
|
22
|
+
gsap.registerPlugin(useGSAP);
|
|
23
|
+
|
|
24
|
+
function Example() {
|
|
25
|
+
const container = useRef(null);
|
|
26
|
+
|
|
27
|
+
useGSAP(() => {
|
|
28
|
+
gsap.to(".box", { x: 100 });
|
|
29
|
+
}, { scope: container });
|
|
30
|
+
|
|
31
|
+
return <div ref={container}><div className="box" /></div>;
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Scope and Refs
|
|
36
|
+
|
|
37
|
+
Pass a `scope` ref or element when using selector text. This keeps `.box`, `.item`, and similar selectors inside the component root. Without scoping, selectors can match elements outside the component.
|
|
38
|
+
|
|
39
|
+
Use direct refs when a target is unique or when selector text would be ambiguous.
|
|
40
|
+
|
|
41
|
+
## Dependencies and Updates
|
|
42
|
+
|
|
43
|
+
`useGSAP()` accepts either a dependency array or a config object. Use the config object when you need `scope`, `dependencies`, or `revertOnUpdate`.
|
|
44
|
+
|
|
45
|
+
Use `revertOnUpdate: true` when dependency changes should tear down and rebuild GSAP objects instead of preserving them until unmount.
|
|
46
|
+
|
|
47
|
+
## Context-Safe Callbacks
|
|
48
|
+
|
|
49
|
+
Animations created after the hook body runs, such as inside event handlers, timers, or callbacks, are not automatically captured unless wrapped. Use `contextSafe()` so GSAP objects created later are tied to the same cleanup context.
|
|
50
|
+
|
|
51
|
+
When manually adding event listeners, return cleanup that removes the listeners.
|
|
52
|
+
|
|
53
|
+
## SSR and Next.js
|
|
54
|
+
|
|
55
|
+
GSAP manipulates browser-side targets. Keep GSAP execution inside client-only lifecycle such as `useGSAP()` or `useEffect()`. In React Server Components or Next app router usage, place GSAP code in a client component.
|
|
56
|
+
|
|
57
|
+
## Fallback Without `@gsap/react`
|
|
58
|
+
|
|
59
|
+
If `@gsap/react` is not used, create a `gsap.context()` inside an effect and call `ctx.revert()` in cleanup. Pass the component ref as scope.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# GSAP ScrollTrigger Patterns
|
|
2
|
+
|
|
3
|
+
Extracted: 2026-05-03
|
|
4
|
+
|
|
5
|
+
Sources:
|
|
6
|
+
|
|
7
|
+
- https://gsap.com/docs/v3/Plugins/ScrollTrigger/
|
|
8
|
+
- https://raw.githubusercontent.com/greensock/gsap-skills/main/skills/gsap-scrolltrigger/SKILL.md
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
Use ScrollTrigger for scroll-driven animation, scroll reveals, scrubbed timelines, pinned sections, snapping, parallax-style effects, or callbacks based on scroll position. Prefer it when no other scroll animation library has already been chosen.
|
|
13
|
+
|
|
14
|
+
## Registration
|
|
15
|
+
|
|
16
|
+
ScrollTrigger is a GSAP plugin. Import and register it before use in module-based projects:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
import { gsap } from "gsap";
|
|
20
|
+
import { ScrollTrigger } from "gsap/ScrollTrigger";
|
|
21
|
+
|
|
22
|
+
gsap.registerPlugin(ScrollTrigger);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Basic Patterns
|
|
26
|
+
|
|
27
|
+
Attach a simple trigger to a tween when animation should start as an element enters the viewport:
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
gsap.to(".box", {
|
|
31
|
+
scrollTrigger: ".box",
|
|
32
|
+
x: 500
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Attach ScrollTrigger to a timeline for coordinated scroll-linked animation:
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
const tl = gsap.timeline({
|
|
40
|
+
scrollTrigger: {
|
|
41
|
+
trigger: ".section",
|
|
42
|
+
start: "top top",
|
|
43
|
+
end: "+=500",
|
|
44
|
+
scrub: true,
|
|
45
|
+
pin: true
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
tl.from(".title", { autoAlpha: 0, y: 24 })
|
|
50
|
+
.to(".panel", { xPercent: -100 });
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Use `ScrollTrigger.create()` for standalone callbacks or scroll state without attaching directly to a tween.
|
|
54
|
+
|
|
55
|
+
## Cleanup and Refresh
|
|
56
|
+
|
|
57
|
+
Create ScrollTriggers inside `useGSAP()`, `gsap.context()`, or `gsap.matchMedia()` so they are reverted during teardown. After DOM or layout changes that affect trigger positions, call `ScrollTrigger.refresh()` from the appropriate lifecycle point.
|
|
58
|
+
|
|
59
|
+
## Reduced Motion
|
|
60
|
+
|
|
61
|
+
Use `gsap.matchMedia()` to gate scroll-triggered motion when `prefers-reduced-motion: reduce` matches. For reduced motion users, skip scrub/pin choreography or replace it with a static end state.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "motion-animation"
|
|
3
|
+
description: "Guide Motion, formerly Framer Motion, animation implementation using only official Motion documentation. Trigger: implementing, reviewing, or choosing Motion for JavaScript animation, React motion components, gestures, scroll animation, layout animation, exit animation, or framework-agnostic UI motion."
|
|
4
|
+
skillMetadata:
|
|
5
|
+
author: "skilly-hand"
|
|
6
|
+
last-edit: "2026-05-03"
|
|
7
|
+
license: "Apache-2.0"
|
|
8
|
+
version: "1.0.0"
|
|
9
|
+
changelog: "Added official-source Motion animation guidance for JavaScript and React; improves framework-agnostic and React-native motion implementation with verified Motion APIs; affects frontend animation routing and catalog discovery"
|
|
10
|
+
auto-invoke: "Implementing, reviewing, or choosing Motion for JavaScript animation, React motion components, gestures, scroll animation, layout animation, exit animation, or framework-agnostic UI motion"
|
|
11
|
+
allowed-tools:
|
|
12
|
+
- "Read"
|
|
13
|
+
- "Edit"
|
|
14
|
+
- "Write"
|
|
15
|
+
- "Glob"
|
|
16
|
+
- "Grep"
|
|
17
|
+
- "Bash"
|
|
18
|
+
- "WebFetch"
|
|
19
|
+
- "WebSearch"
|
|
20
|
+
- "Task"
|
|
21
|
+
- "SubAgent"
|
|
22
|
+
---
|
|
23
|
+
# Motion Animation Guide
|
|
24
|
+
|
|
25
|
+
## When to Use
|
|
26
|
+
|
|
27
|
+
Use this skill when:
|
|
28
|
+
|
|
29
|
+
- The user asks for Motion, Framer Motion, Motion One, JavaScript animation with `motion`, React `motion` components, gestures, scroll-triggered animation, scroll-linked animation, layout animation, or exit animation.
|
|
30
|
+
- Another skill needs a verified Motion handoff for lightweight UI motion, React-native animation props, or framework-agnostic JavaScript animation.
|
|
31
|
+
- A project already uses `motion`, `framer-motion`, or `@motionone/dom` and the user has not asked to migrate away.
|
|
32
|
+
|
|
33
|
+
Do not use this skill when:
|
|
34
|
+
|
|
35
|
+
- The project already uses another animation library and the user has not asked to add or migrate to Motion.
|
|
36
|
+
- A simple CSS transition is sufficient and no JavaScript, React prop, layout, gesture, scroll, or exit animation behavior is needed.
|
|
37
|
+
- The work needs GSAP-specific timelines, ScrollTrigger pin/scrub behavior, GSAP plugins, or existing GSAP patterns. Use `gsap-animation` for that.
|
|
38
|
+
- The work is backend-only or has no user-facing motion surface.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Official-Only Source Rule
|
|
43
|
+
|
|
44
|
+
Before generating Motion-specific guidance, verify the pattern against official sources in [references/official-source-map.md](references/official-source-map.md).
|
|
45
|
+
|
|
46
|
+
Use only:
|
|
47
|
+
|
|
48
|
+
- Motion docs at `https://motion.dev/docs/quick-start`.
|
|
49
|
+
- Motion for React docs at `https://motion.dev/docs/react`.
|
|
50
|
+
- Official `motion.dev/docs/*` pages linked from those pages when a referenced API needs more detail.
|
|
51
|
+
|
|
52
|
+
Do not use blog posts, snippets, Stack Overflow answers, social posts, or memory-only claims as source material for Motion API behavior. If a detail is not covered by the reference files, check official Motion docs before using it.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Routing
|
|
57
|
+
|
|
58
|
+
| Need | Use |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| Framework-agnostic DOM/SVG/object animation | [references/js-patterns.md](references/js-patterns.md) |
|
|
61
|
+
| Plain HTML, Webflow, no-code, or script tag usage | Script-tag guidance in [references/js-patterns.md](references/js-patterns.md) |
|
|
62
|
+
| React or Next.js prop-based UI animation | [references/react-patterns.md](references/react-patterns.md) |
|
|
63
|
+
| React exit, layout, gesture, scroll, and SVG animation | [references/react-patterns.md](references/react-patterns.md) |
|
|
64
|
+
| Reduced motion, cleanup, and performance guidance | [references/performance-accessibility.md](references/performance-accessibility.md) |
|
|
65
|
+
|
|
66
|
+
When the user asks for an animation library without naming one, prefer Motion when the need is lightweight JavaScript animation, React prop-based animation, gestures, layout animation, exit animation, or a project already uses Motion/Framer Motion. Prefer GSAP for GSAP timelines, ScrollTrigger pin/scrub choreography, GSAP plugins, or an existing GSAP stack.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Project Preflight
|
|
71
|
+
|
|
72
|
+
Always inspect the target project before proposing implementation:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
grep -E '"motion"|"framer-motion"|"@motionone/dom"|"gsap"|"@gsap/react"|"animejs"' package.json
|
|
76
|
+
grep -rn "from \"motion\"|from 'motion'|from \"motion/react\"|from 'motion/react'|framer-motion|motion\\.|AnimatePresence|useScroll|useReducedMotion" src --include="*.js" --include="*.jsx" --include="*.ts" --include="*.tsx" 2>/dev/null
|
|
77
|
+
grep -rn "prefers-reduced-motion|transition|@keyframes" src --include="*.css" --include="*.scss" --include="*.tsx" --include="*.jsx" 2>/dev/null
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If `motion` is not installed, ask before adding it. This skill teaches target projects how to use Motion; it does not add Motion to skilly-hand itself.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Implementation Rules
|
|
85
|
+
|
|
86
|
+
- Use the official package name `motion`.
|
|
87
|
+
- Prefer JavaScript imports from `"motion"` for framework-agnostic work.
|
|
88
|
+
- Prefer React imports from `"motion/react"` for React components and hooks.
|
|
89
|
+
- Use `animate()` for DOM, SVG, object, value, and sequence animation where JavaScript control is needed.
|
|
90
|
+
- Use `motion` components for React UI state animation through `initial`, `animate`, `whileHover`, `whileTap`, `whileInView`, `layout`, `layoutId`, and `exit`.
|
|
91
|
+
- Use `AnimatePresence` when React elements need exit animations before DOM removal.
|
|
92
|
+
- Use `scroll()` or `useScroll()` for scroll-linked animation; use `inView()` or `whileInView` for scroll-triggered animation.
|
|
93
|
+
- Use `stagger()` for sibling offsets instead of manually stacking delay values.
|
|
94
|
+
- Respect reduced-motion preferences. Skip, simplify, or replace non-essential motion when users request reduced motion.
|
|
95
|
+
- Clean up JavaScript animations, gestures, scroll listeners, and observers during component or page teardown.
|
|
96
|
+
- Avoid introducing Motion Studio, Motion+ premium APIs, or MCP tooling unless the user explicitly asks for those products.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Framework Guidance
|
|
101
|
+
|
|
102
|
+
JavaScript and other frameworks:
|
|
103
|
+
|
|
104
|
+
- Run Motion setup after DOM nodes exist.
|
|
105
|
+
- Pass elements directly when possible, or scope selector text to the component/page root.
|
|
106
|
+
- Store returned animation controls or cleanup functions when teardown or runtime control is needed.
|
|
107
|
+
- For script tag usage, prefer a pinned CDN version instead of `latest`.
|
|
108
|
+
|
|
109
|
+
React and Next.js:
|
|
110
|
+
|
|
111
|
+
- Import `motion`, `AnimatePresence`, and hooks from `"motion/react"`.
|
|
112
|
+
- Components using Motion in React Server Component projects must run on the client.
|
|
113
|
+
- Use stable unique keys for `AnimatePresence` children.
|
|
114
|
+
- Use `layout` for size/position/reorder animation and `layoutId` for shared layout transitions.
|
|
115
|
+
- Use `useReducedMotion()` to branch React animation values when needed.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Output Contract
|
|
120
|
+
|
|
121
|
+
When using this skill, include:
|
|
122
|
+
|
|
123
|
+
- The official Motion source you used.
|
|
124
|
+
- Whether Motion or legacy Framer Motion usage is already installed or requires approval.
|
|
125
|
+
- Which Motion primitive is appropriate: `animate()`, `scroll()`, `inView()`, gesture function, `motion` component, `AnimatePresence`, `useScroll()`, `layout`, `layoutId`, or `useReducedMotion()`.
|
|
126
|
+
- Cleanup and reduced-motion behavior.
|
|
127
|
+
- A verification step appropriate to the project, such as unit tests, interaction tests, browser smoke checks, or visual inspection.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Commands
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Install Motion in a target project only after user approval
|
|
135
|
+
npm install motion
|
|
136
|
+
|
|
137
|
+
# Check for existing Motion usage
|
|
138
|
+
grep -rn "from \"motion\"|from \"motion/react\"|framer-motion|AnimatePresence|useScroll|useReducedMotion" src --include="*.js" --include="*.jsx" --include="*.ts" --include="*.tsx"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Resources
|
|
144
|
+
|
|
145
|
+
- Source map: [references/official-source-map.md](references/official-source-map.md)
|
|
146
|
+
- JavaScript patterns: [references/js-patterns.md](references/js-patterns.md)
|
|
147
|
+
- React patterns: [references/react-patterns.md](references/react-patterns.md)
|
|
148
|
+
- Performance and accessibility: [references/performance-accessibility.md](references/performance-accessibility.md)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "motion-animation",
|
|
3
|
+
"title": "Motion Animation",
|
|
4
|
+
"description": "Guide Motion, formerly Framer Motion, animation implementation using only official Motion documentation. Trigger: implementing, reviewing, or choosing Motion for JavaScript animation, React motion components, gestures, scroll animation, layout animation, exit animation, or framework-agnostic UI motion.",
|
|
5
|
+
"portable": true,
|
|
6
|
+
"tags": ["frontend", "animation", "motion", "framer-motion", "workflow"],
|
|
7
|
+
"detectors": ["react", "nextjs", "angular", "vue", "vite", "tailwindcss", "storybook"],
|
|
8
|
+
"detectionTriggers": ["auto"],
|
|
9
|
+
"installsFor": ["all"],
|
|
10
|
+
"agentSupport": ["codex", "claude", "cursor", "gemini", "copilot", "antigravity", "windsurf", "trae"],
|
|
11
|
+
"skillMetadata": {
|
|
12
|
+
"author": "skilly-hand",
|
|
13
|
+
"last-edit": "2026-05-03",
|
|
14
|
+
"license": "Apache-2.0",
|
|
15
|
+
"version": "1.0.0",
|
|
16
|
+
"changelog": "Added official-source Motion animation guidance for JavaScript and React; improves framework-agnostic and React-native motion implementation with verified Motion APIs; affects frontend animation routing and catalog discovery",
|
|
17
|
+
"auto-invoke": "Implementing, reviewing, or choosing Motion for JavaScript animation, React motion components, gestures, scroll animation, layout animation, exit animation, or framework-agnostic UI motion",
|
|
18
|
+
"allowed-tools": ["Read", "Edit", "Write", "Glob", "Grep", "Bash", "WebFetch", "WebSearch", "Task", "SubAgent"]
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
{ "path": "SKILL.md", "kind": "instruction" },
|
|
22
|
+
{ "path": "references/official-source-map.md", "kind": "reference" },
|
|
23
|
+
{ "path": "references/js-patterns.md", "kind": "reference" },
|
|
24
|
+
{ "path": "references/react-patterns.md", "kind": "reference" },
|
|
25
|
+
{ "path": "references/performance-accessibility.md", "kind": "reference" }
|
|
26
|
+
],
|
|
27
|
+
"dependencies": []
|
|
28
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Motion JavaScript Patterns
|
|
2
|
+
|
|
3
|
+
Extracted: 2026-05-03
|
|
4
|
+
|
|
5
|
+
Sources:
|
|
6
|
+
|
|
7
|
+
- https://motion.dev/docs/quick-start
|
|
8
|
+
- https://motion.dev/docs/animate
|
|
9
|
+
- https://motion.dev/docs/scroll
|
|
10
|
+
- https://motion.dev/docs/inview
|
|
11
|
+
- https://motion.dev/docs/hover
|
|
12
|
+
- https://motion.dev/docs/press
|
|
13
|
+
|
|
14
|
+
## Selection
|
|
15
|
+
|
|
16
|
+
Use Motion JavaScript when animation should work across frameworks or plain pages, when a project already uses Motion, or when the need is lightweight DOM/SVG/object animation without a framework-specific component model.
|
|
17
|
+
|
|
18
|
+
Prefer CSS transitions for small hover/focus/press states that need no JavaScript control. Prefer `gsap-animation` for GSAP-specific timelines, ScrollTrigger pin/scrub choreography, or GSAP plugins.
|
|
19
|
+
|
|
20
|
+
## Installation and Imports
|
|
21
|
+
|
|
22
|
+
For package-managed projects, the official install command is:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install motion
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Use module imports in bundled JavaScript:
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
import { animate, scroll } from "motion";
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
For smaller HTML/SVG-only animation, Motion also documents:
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
import { animate } from "motion/mini";
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
For plain HTML or no-code contexts, Motion can be imported by script tag. Prefer pinning a specific version in CDN URLs instead of using `latest`.
|
|
41
|
+
|
|
42
|
+
Ask before adding `motion` when it is not already present.
|
|
43
|
+
|
|
44
|
+
## animate()
|
|
45
|
+
|
|
46
|
+
Use `animate()` for one-step animations and controlled JavaScript animation:
|
|
47
|
+
|
|
48
|
+
- It accepts CSS selectors or element collections.
|
|
49
|
+
- It can animate HTML/CSS, SVG attributes and paths, independent transforms, JavaScript objects, colors, strings, numbers, and single values.
|
|
50
|
+
- The hybrid import from `"motion"` supports independent transform axes like `x`, `y`, `rotate`, `scale`, skew, perspective, CSS variables, SVG paths, object animation, and sequences.
|
|
51
|
+
- The mini import from `"motion/mini"` focuses on HTML/SVG styles through native browser APIs.
|
|
52
|
+
|
|
53
|
+
Use transition options such as `duration`, `delay`, `ease`, `repeat`, `repeatType`, and spring options when the official API supports the chosen transition type.
|
|
54
|
+
|
|
55
|
+
## Sequences and Stagger
|
|
56
|
+
|
|
57
|
+
Use hybrid `animate()` sequences when several targets or values need ordered animation. Use each segment's transition options or `at` scheduling instead of hand-stacking unrelated timers.
|
|
58
|
+
|
|
59
|
+
Use `stagger()` as a `delay` function when sibling animations should be offset:
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
import { animate, stagger } from "motion";
|
|
63
|
+
|
|
64
|
+
animate(".item", { opacity: 1, y: 0 }, { delay: stagger(0.1) });
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Scroll and Viewport
|
|
68
|
+
|
|
69
|
+
Use `scroll()` for scroll-linked animation where an animation progress should follow scroll progress.
|
|
70
|
+
|
|
71
|
+
Use `inView()` for scroll-triggered animation when an element entering or leaving the viewport should start behavior. Store and run its cleanup in framework teardown when used inside component lifecycles.
|
|
72
|
+
|
|
73
|
+
## Gestures
|
|
74
|
+
|
|
75
|
+
Use `hover()` and `press()` for JavaScript gesture animation outside React. Store cleanup functions returned by gesture helpers and call them during teardown.
|
|
76
|
+
|
|
77
|
+
For React, prefer `whileHover`, `whileTap`, and related `motion` component props instead of manual DOM gesture listeners.
|
|
78
|
+
|
|
79
|
+
## Cleanup
|
|
80
|
+
|
|
81
|
+
Store returned animation controls or cleanup functions when an animation, scroll listener, observer, or gesture belongs to a component/page lifecycle. Stop animations and call cleanup during teardown.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Official Motion Source Map
|
|
2
|
+
|
|
3
|
+
Extracted: 2026-05-03
|
|
4
|
+
|
|
5
|
+
This skill may only use official Motion sources. Motion was previously Framer Motion for React; the official React docs identify the current package and imports.
|
|
6
|
+
|
|
7
|
+
## Primary Sources
|
|
8
|
+
|
|
9
|
+
| Source | Use |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| https://motion.dev/docs/quick-start | JavaScript quick start, package install, script tag options, `animate`, `scroll`, `stagger`, animatable value categories |
|
|
12
|
+
| https://motion.dev/docs/react | React quick start, `motion` components, gestures, scroll, layout, exit, SVG animation, Framer Motion naming context |
|
|
13
|
+
|
|
14
|
+
## Linked Official API Sources
|
|
15
|
+
|
|
16
|
+
| Source | Use |
|
|
17
|
+
| --- | --- |
|
|
18
|
+
| https://motion.dev/docs/animate | `animate()` hybrid/mini imports, subjects, transforms, SVG paths, sequences, transition options, controls |
|
|
19
|
+
| https://motion.dev/docs/scroll | JavaScript scroll-linked animation |
|
|
20
|
+
| https://motion.dev/docs/inview | JavaScript scroll-triggered animation |
|
|
21
|
+
| https://motion.dev/docs/hover | JavaScript hover gesture animation and cleanup |
|
|
22
|
+
| https://motion.dev/docs/press | JavaScript press gesture animation and cleanup |
|
|
23
|
+
| https://motion.dev/docs/react-motion-component | React `motion` component props, animation targets, variants, and gestures |
|
|
24
|
+
| https://motion.dev/docs/react-animate-presence | React exit animations, child keys, presence modes, troubleshooting |
|
|
25
|
+
| https://motion.dev/docs/react-use-scroll | React scroll-linked animation with `useScroll()` |
|
|
26
|
+
| https://motion.dev/docs/react-use-reduced-motion | React reduced-motion hook |
|
|
27
|
+
| https://motion.dev/docs/performance | Motion performance guidance |
|
|
28
|
+
| https://motion.dev/docs/react-accessibility | React accessibility guidance |
|
|
29
|
+
|
|
30
|
+
## Verification Rule
|
|
31
|
+
|
|
32
|
+
When a Motion API or behavior is not represented in these local reference files, check official Motion docs before generating implementation guidance. If the official docs conflict with a local reference, the official docs page wins and this skill should be updated.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Motion Performance and Accessibility
|
|
2
|
+
|
|
3
|
+
Extracted: 2026-05-03
|
|
4
|
+
|
|
5
|
+
Sources:
|
|
6
|
+
|
|
7
|
+
- https://motion.dev/docs/quick-start
|
|
8
|
+
- https://motion.dev/docs/animate
|
|
9
|
+
- https://motion.dev/docs/react
|
|
10
|
+
- https://motion.dev/docs/react-use-reduced-motion
|
|
11
|
+
- https://motion.dev/docs/performance
|
|
12
|
+
- https://motion.dev/docs/react-accessibility
|
|
13
|
+
|
|
14
|
+
## Performance
|
|
15
|
+
|
|
16
|
+
Motion's hybrid engine uses browser animation capabilities where possible and JavaScript where browser APIs cannot provide the needed behavior. Prefer the smallest Motion surface that solves the job:
|
|
17
|
+
|
|
18
|
+
- Use CSS transitions for simple static hover/focus transitions.
|
|
19
|
+
- Use `motion/mini` for small HTML/SVG style animation when independent transforms, sequences, object animation, or advanced hybrid behavior are unnecessary.
|
|
20
|
+
- Use the hybrid `"motion"` import for independent transforms, SVG paths, CSS variables, JavaScript objects, values, sequences, and spring/inertia behavior.
|
|
21
|
+
- In React, use `motion` components and hooks from `"motion/react"` rather than manual DOM animation when animation is tied to React render state.
|
|
22
|
+
|
|
23
|
+
Prefer `opacity` and transform-style motion for routine UI animation. Avoid layout-heavy animation unless the official React layout animation API is the intended feature.
|
|
24
|
+
|
|
25
|
+
## Reduced Motion
|
|
26
|
+
|
|
27
|
+
Respect user reduced-motion preferences. In React, use `useReducedMotion()` when animation values need to change based on preference.
|
|
28
|
+
|
|
29
|
+
Reduced-motion behavior may:
|
|
30
|
+
|
|
31
|
+
- Skip non-essential animation.
|
|
32
|
+
- Shorten motion to a near-instant transition.
|
|
33
|
+
- Replace spatial movement with opacity or a static final state.
|
|
34
|
+
- Disable looping or decorative animation.
|
|
35
|
+
|
|
36
|
+
## Cleanup
|
|
37
|
+
|
|
38
|
+
For framework-agnostic JavaScript, store animation controls and cleanup functions returned by Motion APIs that attach listeners, observers, or active animations. Stop animations and call cleanup during component/page teardown.
|
|
39
|
+
|
|
40
|
+
For React `motion` components, React handles component lifecycle for prop-based animation. Manual timers, callbacks, or JavaScript Motion APIs used inside React still need normal effect cleanup.
|
|
41
|
+
|
|
42
|
+
## Checklist
|
|
43
|
+
|
|
44
|
+
- [ ] The official Motion source for the chosen API was checked.
|
|
45
|
+
- [ ] Motion is already installed or dependency approval was obtained.
|
|
46
|
+
- [ ] Imports match the environment: `"motion"` for JavaScript, `"motion/react"` for React.
|
|
47
|
+
- [ ] Component/page-owned JavaScript animations and listeners are cleaned up.
|
|
48
|
+
- [ ] Reduced-motion users get static, skipped, or simplified motion.
|
|
49
|
+
- [ ] The implementation uses Motion for Motion-shaped needs and GSAP only for GSAP-shaped needs.
|