to-spring-or-not-to-spring
Audit animation code for correct timing function selection. Use when reviewing motion implementations, debugging animations that feel wrong, or choosing between springs and easing. Outputs file:line findings.
What this skill does
# To Spring or Not To Spring
Review animation code for correct timing function selection based on interaction type.
## How It Works
1. Read the specified files (or prompt user for files/pattern)
2. Check against all rules below
3. Output findings in `file:line` format
## Rule Categories
| Priority | Category | Prefix |
|----------|----------|--------|
| 1 | Spring Selection | `spring-` |
| 2 | Easing Selection | `easing-` |
| 3 | Duration | `duration-` |
| 4 | No Animation | `none-` |
## Decision Framework
Ask: **Is this motion reacting to the user, or is the system speaking?**
| Motion Type | Best Choice | Why |
|-------------|-------------|-----|
| User-driven (drag, flick, gesture) | Spring | Survives interruption, preserves velocity |
| System-driven (state change, feedback) | Easing | Clear start/end, predictable timing |
| Time representation (progress, loading) | Linear | 1:1 relationship between time and progress |
| High-frequency (typing, fast toggles) | None | Animation adds noise, feels slower |
## Rules
### Spring Selection Rules
#### `spring-for-gestures`
Gesture-driven motion (drag, flick, swipe) must use springs.
**Fail:**
```tsx
<motion.div
drag="x"
transition={{ duration: 0.3, ease: "easeOut" }}
/>
```
**Pass:**
```tsx
<motion.div
drag="x"
transition={{ type: "spring", stiffness: 500, damping: 30 }}
/>
```
#### `spring-for-interruptible`
Motion that can be interrupted must use springs.
**Fail:**
```tsx
// User can click again mid-animation
<motion.div
animate={{ x: isOpen ? 200 : 0 }}
transition={{ duration: 0.3 }}
/>
```
**Pass:**
```tsx
<motion.div
animate={{ x: isOpen ? 200 : 0 }}
transition={{ type: "spring", stiffness: 400, damping: 25 }}
/>
```
#### `spring-preserves-velocity`
When velocity matters, use springs to preserve input energy.
**Fail:**
```tsx
// Fast flick and slow flick animate identically
onDragEnd={(e, info) => {
animate(target, { x: 0 }, { duration: 0.3 });
}}
```
**Pass:**
```tsx
// Fast flick moves faster than slow flick
onDragEnd={(e, info) => {
animate(target, { x: 0 }, {
type: "spring",
velocity: info.velocity.x,
});
}}
```
#### `spring-params-balanced`
Spring parameters must be balanced; avoid excessive oscillation.
**Fail:**
```tsx
transition={{
type: "spring",
stiffness: 1000,
damping: 5, // Too low - excessive bounce
}}
```
**Pass:**
```tsx
transition={{
type: "spring",
stiffness: 500,
damping: 30, // Balanced - settles quickly
}}
```
### Easing Selection Rules
#### `easing-for-state-change`
System-initiated state changes should use easing curves.
**Fail:**
```tsx
// Toast notification using spring
<motion.div
animate={{ y: 0 }}
transition={{ type: "spring" }}
/>
// Feels restless for a simple announcement
```
**Pass:**
```tsx
<motion.div
animate={{ y: 0 }}
transition={{ duration: 0.2, ease: "easeOut" }}
/>
```
#### `easing-entrance-ease-out`
Entrances must use ease-out (arrive fast, settle gently).
**Fail:**
```css
.modal-enter {
animation-timing-function: ease-in;
}
```
**Pass:**
```css
.modal-enter {
animation-timing-function: ease-out;
}
```
#### `easing-exit-ease-in`
Exits must use ease-in (build momentum before departure).
**Fail:**
```css
.modal-exit {
animation-timing-function: ease-out;
}
```
**Pass:**
```css
.modal-exit {
animation-timing-function: ease-in;
}
```
#### `easing-transition-ease-in-out`
View/mode transitions use ease-in-out for neutral attention.
**Pass:**
```css
.page-transition {
animation-timing-function: ease-in-out;
}
```
#### `easing-linear-only-progress`
Linear easing only for progress bars and time representation.
**Fail:**
```css
.card-slide {
transition: transform 200ms linear; /* Mechanical feel */
}
```
**Pass:**
```css
.progress-bar {
transition: width 100ms linear; /* Honest time representation */
}
```
### Duration Rules
#### `duration-press-hover`
Press and hover interactions: 120-180ms.
**Fail:**
```css
.button:hover {
transition: background-color 400ms;
}
```
**Pass:**
```css
.button:hover {
transition: background-color 150ms;
}
```
#### `duration-small-state`
Small state changes: 180-260ms.
**Pass:**
```css
.toggle {
transition: transform 200ms ease;
}
```
#### `duration-max-300ms`
User-initiated animations must not exceed 300ms.
**Fail:**
```tsx
<motion.div transition={{ duration: 0.5 }} />
```
**Pass:**
```tsx
<motion.div transition={{ duration: 0.25 }} />
```
#### `duration-shorten-before-curve`
If animation feels slow, shorten duration before adjusting curve.
**Fail (common mistake):**
```css
/* Trying to fix slowness with sharper curve */
.element {
transition: 400ms cubic-bezier(0, 0.9, 0.1, 1);
}
```
**Pass:**
```css
/* Fix slowness with shorter duration */
.element {
transition: 200ms ease-out;
}
```
### No Animation Rules
#### `none-high-frequency`
High-frequency interactions should have no animation.
**Fail:**
```tsx
// Animated on every keystroke
function SearchInput() {
return (
<motion.div animate={{ scale: [1, 1.02, 1] }}>
<input onChange={handleSearch} />
</motion.div>
);
}
```
**Pass:**
```tsx
function SearchInput() {
return <input onChange={handleSearch} />;
}
```
#### `none-keyboard-navigation`
Keyboard navigation should be instant, no animation.
**Fail:**
```tsx
function Menu() {
return items.map(item => (
<motion.li
whileFocus={{ scale: 1.05 }}
transition={{ duration: 0.2 }}
/>
));
}
```
**Pass:**
```tsx
function Menu() {
return items.map(item => (
<li className={styles.menuItem} /> // CSS :focus-visible only
));
}
```
#### `none-context-menu-entrance`
Context menus should not animate on entrance (exit only).
**Fail:**
```tsx
<motion.div
initial={{ opacity: 0, scale: 0.95 }}
animate={{ opacity: 1, scale: 1 }}
exit={{ opacity: 0 }}
/>
```
**Pass:**
```tsx
<motion.div exit={{ opacity: 0, scale: 0.95 }} />
```
## Output Format
When reviewing files, output findings as:
```
file:line - [rule-id] description of issue
Example:
components/drawer/index.tsx:45 - [spring-for-gestures] Drag interaction using easing instead of spring
components/modal/styles.module.css:23 - [easing-entrance-ease-out] Modal entrance using ease-in
```
## Summary Table
After findings, output a summary:
| Rule | Count | Severity |
|------|-------|----------|
| `spring-for-gestures` | 2 | HIGH |
| `easing-entrance-ease-out` | 1 | MEDIUM |
| `duration-max-300ms` | 3 | MEDIUM |
## Quick Reference
| Interaction | Timing | Type |
|-------------|--------|------|
| Drag release | Spring | `stiffness: 500, damping: 30` |
| Button press | 150ms | `ease` |
| Modal enter | 200ms | `ease-out` |
| Modal exit | 150ms | `ease-in` |
| Page transition | 250ms | `ease-in-out` |
| Progress bar | varies | `linear` |
| Typing feedback | 0ms | none |
## References
- [Apple WWDC23: Animate with Springs](https://developer.apple.com/videos/play/wwdc2023/10158/)
- [The Beauty of Bézier Curves - Freya Holmér](https://www.youtube.com/watch?v=aVwxzDHniEw)
- [Motion library](https://motion.dev/)
Related in Security
mac-ops
IncludedComprehensive macOS workstation operations — diagnose kernel panics, identify failing drives, audit launchd startup items, decode wake reasons, triage TCC permission denials, manage APFS snapshots, recover from no-boot. Use for: Mac is slow, slow bootup, won't boot, kernel panic, kernel_task hot, mds_stores CPU, photoanalysisd, cloudd, login loop, gray screen, sleep wake failure, drive failing, IO errors, APFS snapshots eating space, Time Machine local snapshots, Spotlight indexing, launchd, LaunchAgent, LaunchDaemon, login items, TCC permissions, Full Disk Access, Screen Recording denied, Gatekeeper, quarantine, com.apple.quarantine, app is damaged, helper tool, /Library/PrivilegedHelperTools, pmset, wake reasons, dark wake, sysdiagnose, panic.ips, DiagnosticReports, configuration profile, MDM profile, remote diagnostics over SSH.
a11y-audit
IncludedRun accessibility audits on web projects combining automated scanning (axe-core, Lighthouse) with WCAG 2.1 AA compliance mapping, manual check guidance, and structured reporting. Output is configurable: markdown report only, markdown plus machine-readable JSON, or markdown plus issue tracker integration. Use this skill whenever the user mentions "accessibility audit", "a11y audit", "WCAG audit", "accessibility check", "compliance scan", or asks to check a web project for accessibility issues. Also trigger when the user wants to verify WCAG conformance or map findings to a specific standard (CAN-ASC-6.2, EN 301 549, ADA/AODA).
erpclaw
IncludedAI-native ERP system with self-extending OS. Full accounting, invoicing, inventory, purchasing, tax, billing, HR, payroll, advanced accounting (ASC 606/842, intercompany, consolidation), and financial reporting. 413 actions across 14 domains, 43 expansion modules. Constitutional guardrails, adversarial audit, schema migration. Double-entry GL, immutable audit trail, US GAAP.
assess
IncludedAssesses and rates quality 0-10 across multiple dimensions (correctness, maintainability, security, performance, testability, simplicity) with pros/cons analysis. Compares against project conventions and prior decisions from memory. Produces structured evaluation reports with actionable improvement suggestions. Use when evaluating code, designs, architectures, or comparing alternative approaches.
spring-boot-security-jwt
IncludedProvides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based access control using Spring Security 6.x. Use when implementing authentication or authorization in Spring Boot applications.
code-hardcode-audit
IncludedDetect hardcoded values, magic numbers, and leaked secrets. TRIGGERS - hardcode audit, magic numbers, PLR2004, secret scanning.