Back to UI/UX Design

interaction-design

UI/UXmicrointeractionsmotion designfrontendanimationsuser feedbacktransitionsdelightful UX
36.8k📄 MIT🕒 2026-06-16Source ↗

Install this skill

npx skills add wshobson/agents

Works across Claude Code, Cursor, Codex, Copilot & Antigravity

Interaction design focuses on the behavioral aspects of digital interfaces. By managing how elements respond to user input—through timing, motion paths, and visual feedback—this skill bridges the gap between static wireframes and functional applications. It prioritizes clarity by ensuring that every movement, from a simple hover state to complex page transitions, conveys meaning rather than acting as mere decoration. Using tools like Framer Motion, it translates conceptual user journeys into concrete code, enforcing physical properties like friction, gravity, and scale. This approach ensures that interfaces feel tactile and responsive, reducing cognitive load by providing predictable, high-fidelity feedback loops during standard operations. Mastering this requires a disciplined balance of aesthetic judgment and precise timing parameters that respect human perception speeds.

When to Use This Skill

  • Improving the perceived speed of data-heavy applications
  • Adding tactile confirmation to button and form interactions
  • Guiding user focus during complex navigation changes
  • Providing visual cues for hidden or dynamic content containers

How to Invoke This Skill

Example prompts that trigger this skill in Claude Code, Cursor, or Antigravity:

  • Add a micro-interaction to this button click
  • Implement a transition between these two views
  • Create a swipeable gesture component for this list
  • Make the loading state look smoother with skeleton loaders
  • Define a spring physics transition for this modal

Pro Tips

  • 💡Prioritize Purposeful Motion: Always ensure animations serve a clear function (feedback, orientation, focus) rather than being purely decorative, which can overwhelm users.
  • 💡Test on Various Devices: Interaction timings and responsiveness can differ significantly across devices and network conditions. Test thoroughly to ensure a consistent, delightful experience.
  • 💡Integrate Accessibility: Ensure motion doesn't trigger motion sickness for sensitive users. Provide options to reduce or disable animations, adhering to WCAG guidelines.

What this skill does

  • Defining state-driven motion logic for UI components
  • Implementing motion physics including springs and eased transitions
  • Creating layout-preserving skeleton screens for async data
  • Building interactive gesture zones for drag and swipe operations
  • Managing lifecycle-based component animations during entry and exit

When not to use it

  • In high-performance data dashboards where layout stability is more critical than aesthetics
  • When target accessibility guidelines prioritize reduced motion for sensory sensitivity
  • On legacy systems with limited rendering frame budgets

Example workflow

  1. Define the component state and trigger conditions
  2. Select an appropriate easing curve based on action urgency
  3. Initialize the motion wrapper for the target element
  4. Implement state-change animations using Framer Motion hooks
  5. Verify visual feedback timing against standardized duration charts
  6. Test edge cases for interrupted animations

Prerequisites

  • Basic knowledge of React component state
  • Familiarity with CSS-in-JS or Tailwind
  • Installation of framer-motion library

Pitfalls & limitations

  • !Over-animating elements causing interface clutter
  • !Ignoring reduced-motion system preferences
  • !Violating accessibility standards by masking interactive elements
  • !Creating layout shifts that disrupt the document flow

FAQ

How do I choose the right duration for an animation?
Use 100-150ms for tiny feedback like hovers, 200-300ms for standard UI toggles, and 300-500ms for structural changes like modals.
What is the benefit of using spring physics over duration-based timing?
Springs provide a natural, physical feel that responds to user intent, whereas duration-based timing can feel mechanical or rigid.
How can I avoid layout shift when loading content?
Implement skeleton screens that match the final content dimensions to hold the layout structure stable during data fetching.

How it compares

While manual CSS transitions are functional, this skill uses orchestrator libraries like Framer Motion to handle complex lifecycle states and exit animations that are otherwise error-prone to coordinate manually.

Source & trust

37k stars📄 MIT🕒 Updated 2026-06-16
📄 Full skill instructions — original source: wshobson/agents
# Interaction Design

Create engaging, intuitive interactions through motion, feedback, and thoughtful state transitions that enhance usability and delight users.

## When to Use This Skill

- Adding microinteractions to enhance user feedback
- Implementing smooth page and component transitions
- Designing loading states and skeleton screens
- Creating gesture-based interactions
- Building notification and toast systems
- Implementing drag-and-drop interfaces
- Adding scroll-triggered animations
- Designing hover and focus states

## Core Principles

### 1. Purposeful Motion

Motion should communicate, not decorate:

- **Feedback**: Confirm user actions occurred
- **Orientation**: Show where elements come from/go to
- **Focus**: Direct attention to important changes
- **Continuity**: Maintain context during transitions

### 2. Timing Guidelines

| Duration | Use Case |
| --------- | ----------------------------------------- |
| 100-150ms | Micro-feedback (hovers, clicks) |
| 200-300ms | Small transitions (toggles, dropdowns) |
| 300-500ms | Medium transitions (modals, page changes) |
| 500ms+ | Complex choreographed animations |

### 3. Easing Functions

/* Common easings */
--ease-out: cubic-bezier(0.16, 1, 0.3, 1); /* Decelerate - entering */
--ease-in: cubic-bezier(0.55, 0, 1, 0.45); /* Accelerate - exiting */
--ease-in-out: cubic-bezier(0.65, 0, 0.35, 1); /* Both - moving between */
--spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* Overshoot - playful */


## Quick Start: Button Microinteraction

import { motion } from "framer-motion";

export function InteractiveButton({ children, onClick }) {
return (
<motion.button
onClick={onClick}
whileHover={{ scale: 1.02 }}
whileTap={{ scale: 0.98 }}
transition={{ type: "spring", stiffness: 400, damping: 17 }}
className="px-4 py-2 bg-blue-600 text-white rounded-lg"
>
{children}
</motion.button>
);
}


## Interaction Patterns

### 1. Loading States

**Skeleton Screens**: Preserve layout while loading

function CardSkeleton() {
return (
<div className="animate-pulse">
<div className="h-48 bg-gray-200 rounded-lg" />
<div className="mt-4 h-4 bg-gray-200 rounded w-3/4" />
<div className="mt-2 h-4 bg-gray-200 rounded w-1/2" />
</div>
);
}


**Progress Indicators**: Show determinate progress

function ProgressBar({ progress }: { progress: number }) {
return (
<div className="h-2 bg-gray-200 rounded-full overflow-hidden">
<motion.div
className="h-full bg-blue-600"
initial={{ width: 0 }}
animate={{ width: ${progress}% }}
transition={{ ease: "easeOut" }}
/>
</div>
);
}


### 2. State Transitions

**Toggle with smooth transition**:

function Toggle({ checked, onChange }) {
return (
<button
role="switch"
aria-checked={checked}
onClick={() => onChange(!checked)}
className={
relative w-12 h-6 rounded-full transition-colors duration-200
${checked ? "bg-blue-600" : "bg-gray-300"}
}
>
<motion.span
className="absolute top-1 left-1 w-4 h-4 bg-white rounded-full shadow"
animate={{ x: checked ? 24 : 0 }}
transition={{ type: "spring", stiffness: 500, damping: 30 }}
/>
</button>
);
}


### 3. Page Transitions

**Framer Motion layout animations**:

import { AnimatePresence, motion } from "framer-motion";

function PageTransition({ children, key }) {
return (
<AnimatePresence mode="wait">
<motion.div
key={key}
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -20 }}
transition={{ duration: 0.3 }}
>
{children}
</motion.div>
</AnimatePresence>
);
}


### 4. Feedback Patterns

**Ripple effect on click**:

function RippleButton({ children, onClick }) {
const [ripples, setRipples] = useState([]);

const handleClick = (e) => {
const rect = e.currentTarget.getBoundingClientRect();
const ripple = {
x: e.clientX - rect.left,
y: e.clientY - rect.top,
id: Date.now(),
};
setRipples((prev) => [...prev, ripple]);
setTimeout(() => {
setRipples((prev) => prev.filter((r) => r.id !== ripple.id));
}, 600);
onClick?.(e);
};

return (
<button onClick={handleClick} className="relative overflow-hidden">
{children}
{ripples.map((ripple) => (
<span
key={ripple.id}
className="absolute bg-white/30 rounded-full animate-ripple"
style={{ left: ripple.x, top: ripple.y }}
/>
))}
</button>
);
}


### 5. Gesture Interactions

**Swipe to dismiss**:

function SwipeCard({ children, onDismiss }) {
return (
<motion.div
drag="x"
dragConstraints={{ left: 0, right: 0 }}
onDragEnd={(_, info) => {
if (Math.abs(info.offset.x) > 100) {
onDismiss();
}
}}
className="cursor-grab active:cursor-grabbing"
>
{children}
</motion.div>
);
}


## CSS Animation Patterns

### Keyframe Animations

@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

@keyframes pulse {
0%,
100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}

@keyframes spin {
to {
transform: rotate(360deg);
}
}

.animate-fadeIn {
animation: fadeIn 0.3s ease-out;
}
.animate-pulse {
animation: pulse 2s ease-in-out infinite;
}
.animate-spin {
animation: spin 1s linear infinite;
}


### CSS Transitions

.card {
transition:
transform 0.2s ease-out,
box-shadow 0.2s ease-out;
}

.card:hover {
transform: translateY(-4px);
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}


## Accessibility Considerations

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}


function AnimatedComponent() {
const prefersReducedMotion = window.matchMedia(
"(prefers-reduced-motion: reduce)",
).matches;

return (
<motion.div
animate={{ opacity: 1 }}
transition={{ duration: prefersReducedMotion ? 0 : 0.3 }}
/>
);
}


## Best Practices

1. **Performance First**: Use transform and opacity for smooth 60fps
2. **Reduce Motion Support**: Always respect prefers-reduced-motion
3. **Consistent Timing**: Use a timing scale across the app
4. **Natural Physics**: Prefer spring animations over linear
5. **Interruptible**: Allow users to cancel long animations
6. **Progressive Enhancement**: Work without JS animations
7. **Test on Devices**: Performance varies significantly

## Common Issues

- **Janky Animations**: Avoid animating width, height, top, left
- **Over-animation**: Too much motion causes fatigue
- **Blocking Interactions**: Never prevent user input during animations
- **Memory Leaks**: Clean up animation listeners on unmount
- **Flash of Content**: Use will-change sparingly for optimization

## Resources

- [Framer Motion Documentation](https://www.framer.com/motion/)
- [CSS Animation Guide](https://web.dev/animations-guide/)
- [Material Design Motion](https://m3.material.io/styles/motion/overview)
- [GSAP Animation Library](https://greensock.com/gsap/)

How to Use This Skill Unit

Option A: Project-Specific (Recommended)

  1. Click "Download" above
  2. In your project, create the directory: .agent/skills/interaction-design/
  3. Save the file as SKILL.md
  4. The agent will automatically discover the skill based on its description.

Option B: Global Installation (All Agents)

Save the file to these locations to make it available across all projects:

  • Claude Code: ~/.claude/skills/wshobson/agents/interaction-design/SKILL.md
  • Cursor: ~/.cursor/skills/wshobson/agents/interaction-design/SKILL.md
  • Antigravity: ~/.gemini/antigravity/skills/wshobson/agents/interaction-design/SKILL.md

🚀 Install with CLI:
npx skills add wshobson/agents

Read the Master Guide: Mastering Agent Skills

Related Skill Units

Recommended Rules

View more rules

Recommended Workflows

View more workflows

Recommended MCP Servers

View more MCP servers

Take It Further

Maximize your productivity with these powerful resources

📋

Define Your Standards

Set up coding standards to ensure this workflow produces consistent, high-quality results.

Browse Rules Library
📖

Master Workflows

Learn how to create custom workflows, use Turbo Mode, and build your automation library.

Complete Guide

How to use this Skill in Claude Code & Cursor

For Claude Code (CLI)

To use this skill in Claude Code, copy the rule content into your project's custom instructions or follow our Add-Skill CLI guide. This ensures Claude follows your standards during every code generation.

For Cursor & Windsurf

For Cursor or Windsurf, individual skills are best used in the "Rules for AI" section. This specific unit helps the agent avoid ui/ux design issues, leading to cleaner, more efficient code.

Why the skill format matters: the standardized Agent Skills format lets your AI agent load detailed instructions only when they are relevant, keeping your prompt clean while improving results.

Source & attribution

This skill is categorized under UI/UX Design and is published by W. Shobson, maintained in wshobson/agents.

← Browse All Agent Skills
Sponsored AI assistant. Recommendations may be paid.