--- name: animation-interaction-validator description: Ensures engaging user experience through validation of animations, transitions, micro-interactions, and feedback states, preventing flat/static interfaces that lack polish and engagement. Works with Tanstack Start (React) + shadcn/ui components. triggers: ["interactive element creation", "event handler addition", "state changes", "async actions", "form submissions"] note: "Code examples use React/TSX with shadcn/ui components (Button, Card, Input). Adapt patterns to your component library." --- # Animation Interaction Validator SKILL ## Activation Patterns This SKILL automatically activates when: - Interactive elements are created (buttons, links, forms, inputs) - Click, hover, or focus event handlers are added - Component state changes (loading, success, error) - Async operations are initiated (API calls, form submissions) - Navigation or routing transitions occur - Modal/dialog components are opened/closed - Lists or data are updated dynamically ## Expertise Provided ### Animation & Interaction Validation - **Transition Detection**: Ensures smooth state changes with CSS transitions - **Hover State Validation**: Checks for hover feedback on interactive elements - **Loading State Validation**: Ensures async actions have visual feedback - **Micro-interaction Analysis**: Validates small, delightful animations - **Focus State Validation**: Ensures keyboard navigation has visual feedback - **Animation Performance**: Checks for performant animation patterns ### Specific Checks Performed #### ❌ Critical Issues (Missing Feedback) ```tsx // These patterns trigger alerts: // No hover state // No loading state during async action // Jarring state change (no transition) {showContent &&
Content
} // No focus state Link // Form without feedback
``` #### ✅ Correct Interactive Patterns ```tsx import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Send } from "lucide-react" import { cn } from "@/lib/utils" // These patterns are validated as correct: // Hover state with smooth transition // Loading state with visual feedback // Smooth state transition (using framer-motion or CSS)
{showContent &&
Content
}
// Focus state with ring Link
{ e.preventDefault(); handleSubmit" className="space-y-4">
``` ## Integration Points ### Complementary to Existing Components - **frontend-design-specialist agent**: Provides design direction, SKILL validates implementation - **component-aesthetic-checker**: Validates component customization, SKILL validates interactions - **shadcn-ui-design-validator**: Catches generic patterns, SKILL ensures engagement - **accessibility-guardian agent**: Validates a11y, SKILL validates visual feedback ### Escalation Triggers - Complex animation sequences → `frontend-design-specialist` agent - Component interaction patterns → `tanstack-ui-architect` agent - Performance concerns → `edge-performance-oracle` agent - Accessibility issues → `accessibility-guardian` agent ## Validation Rules ### P1 - Critical (Missing User Feedback) - **No Hover States**: Buttons/links without hover effects - **No Loading States**: Async actions without loading indicators - **Jarring State Changes**: Content appearing/disappearing without transitions - **No Focus States**: Interactive elements without keyboard focus indicators - **Silent Errors**: Form errors without visual feedback ### P2 - Important (Enhanced Engagement) - **No Micro-interactions**: Icons/elements without subtle animations - **Static Navigation**: Page transitions without animations - **Abrupt Modals**: Dialogs opening without enter/exit transitions - **Instant Updates**: List changes without transition animations - **No Disabled States**: Buttons during processing without visual change ### P3 - Polish (Delightful UX) - **Limited Animation Variety**: Using only scale/opacity (no rotate, translate) - **Generic Durations**: Not tuning animation speed for context - **No Stagger**: List items appearing simultaneously (no stagger effect) - **Missing Success States**: Completed actions without celebration animation - **No Hover Anticipation**: No visual hint before interaction is possible ## Remediation Examples ### Fixing Missing Hover States ```tsx ``` ### Fixing Missing Loading States ```tsx const submitForm = async () => { await api.submit(formData); }; const isSubmitting = ref(false); const showSuccess = ref(false); const submitForm = async () => { isSubmitting.value = true; try { await api.submit(formData); showSuccess.value = true; setTimeout(() => showSuccess.value = false, 3000); } catch (error) { // Error handling } finally { isSubmitting.value = false; } };
``` ### Fixing Jarring State Changes ```tsx

This content appears instantly (jarring)

This content transitions smoothly

``` ### Fixing Missing Focus States ```tsx ``` ### Adding Micro-interactions ```tsx const isLiked = ref(false); const heartScale = ref(1); const toggleLike = () => { isLiked.value = !isLiked.value; // Bounce animation heartScale.value = 1.3; setTimeout(() => heartScale.value = 1, 200); }; ``` ## Animation Best Practices ### Performance-First Animations ✅ **Performant Properties** (GPU-accelerated): - `transform` (translate, scale, rotate) - `opacity` - `filter` (backdrop-blur, etc.) ❌ **Avoid Animating** (causes reflow/repaint): - `width`, `height` - `top`, `left`, `right`, `bottom` - `margin`, `padding` - `border-width` ```tsx
Content
Content
``` ### Animation Duration Guidelines - **Fast** (100-200ms): Hover states, small movements - **Medium** (300-400ms): State changes, content transitions - **Slow** (500-800ms): Page transitions, major UI changes - **Very Slow** (1000ms+): Celebration animations, complex sequences ```tsx
Content
Main content
``` ### Easing Functions - `ease-out`: Starting animations (entering content) - `ease-in`: Ending animations (exiting content) - `ease-in-out`: Bidirectional animations - `linear`: Loading spinners, continuous animations ```tsx
Content
``` ## Advanced Interaction Patterns ### Staggered List Animations ```tsx const items = ref([1, 2, 3, 4, 5]);
Item { item}
``` ### Success Celebration Animation ```tsx const showSuccess = ref(false); const celebrate = () => { showSuccess.value = true; // Confetti or celebration animation here setTimeout(() => showSuccess.value = false, 3000); };

Success!

``` ### Loading Skeleton with Pulse ```tsx
``` ## MCP Server Integration While this SKILL doesn't directly use MCP servers, it complements MCP-enhanced agents: - **shadcn/ui MCP**: Validates that suggested animations work with shadcn/ui components - **Cloudflare MCP**: Ensures animations don't bloat bundle size (performance check) ## Benefits ### Immediate Impact - **Prevents Flat UI**: Ensures engaging, polished interactions - **Improves Perceived Performance**: Loading states make waits feel shorter - **Better Accessibility**: Focus states improve keyboard navigation - **Professional Polish**: Micro-interactions signal quality ### Long-term Value - **Higher User Engagement**: Delightful animations encourage interaction - **Reduced Bounce Rate**: Polished UI keeps users engaged - **Better Brand Perception**: Professional animations signal quality - **Consistent UX**: All interactions follow same animation patterns ## Usage Examples ### During Button Creation ```tsx // Developer adds: // SKILL immediately activates: "⚠️ P1: Button lacks hover state. Add transition utilities: class='transition-all duration-300 hover:scale-105'" ``` ### During Async Action ```tsx // Developer creates: const submitForm = async () => { await api.call(); } // SKILL immediately activates: "⚠️ P1: Async action without loading state. Add :loading and :disabled props to button." ``` ### During State Toggle ```tsx // Developer adds:
Content
// SKILL immediately activates: "⚠️ P1: Content appears abruptly. Wrap with for smooth state changes." ``` ### Before Deployment ```tsx // SKILL runs comprehensive check: "✅ Animation validation passed. 45 interactive elements with hover states, 12 async actions with loading feedback, 8 smooth transitions detected." ``` This SKILL ensures every interactive element provides engaging visual feedback, preventing the flat, static appearance that makes interfaces feel unpolished and reduces user engagement.