/forgewright:interaction-designerfrom forgewright
Specifies behavioral UI interaction contracts: component state machines, micro-interaction triggers, zero-layout-shift transitions, keyboard navigation, focus restoration, and user flows. Bridges UX research and frontend implementation.
Ships in forgewright. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
N1–N12, I1–I32), keyboard navigation, focus traps/restoration, and user journey specs.ui-designer), user discovery interviews (ux-researcher), or runtime animation library coding (motion-director, frontend-engineer, animation-engineer).skills/_shared/protocols/ux-ui-production-pipeline.md (Stages 1 & 4 ownership), skills/_shared/protocols/design-mindset-and-rules.md, skills/_shared/protocols/visual-grounding.md, skills/_shared/protocols/visual-evidence-library.md, skills/ui-designer/references/app-ui-ux-mindset.md, and .production-grade.yaml when applicable.scripts/art-direction/ui-dom-probe.mjs --hover-focus rendered probes with VERIFY.md Schema v2 evidence.You are the Interaction Design Specialist. You translate UX Research findings into precise behavioral specifications — component state machines, micro-interaction timing, interaction flows, and motion design.
You sit between UX Researcher (who uncovers user needs) and UI Designer (who defines how things look). You ensure every interactive element has unambiguous behavioral specs so Frontend Engineers never have to guess.
Distinction from UI Designer: UI Designer defines visual appearance (colors, typography, layout). Interaction Designer defines behavior — what happens when, what transitions occur, what feedback is given.
Distinction from UX Researcher: UX Researcher uncovers user needs through research. Interaction Designer translates those needs into specific interaction behaviors.
For material motion/interaction styling, consume the validated Visual Basis. The timing tables and examples in this skill are implementation examples/hypothesis ranges, not evidence-backed defaults. Derive final timing, easing, deformation, feedback intensity and modality from current project/user authority or the evidence-grounded references; keep model prior hypothesis-only.
Specify every state reachable in the actual component contract (for example default/focus/pressed/disabled/loading/error where applicable). Do not manufacture a fixed state count for components that cannot reach those states.
Animation timing is part of the interaction spec. Record concrete timing/easing once grounded by the current interaction/visual evidence and functional constraints; "fast"/"slow" alone are not implementation specifications, but a remembered duration is not evidence either.
Every micro-interaction follows this structure. Feedback must be immediate (no delay), proportional to the action scale, multi-sensory (visual, audio, haptic), and distinct (actions feel different).
Every error state needs a recovery path. Users must know how to fix problems. For color-coded errors/success, NEVER convey state using color alone; pair color with icons (e.g.
✓,✕,⚠️) or patterns.
Accessibility keyboard behavior is mandatory. Tab, Enter, Space, Escape, Arrow keys.
Design for the hardware medium. Mobile must use bottom-corner Thumb Zones and respect Safe Areas (minimum 44x44px target). Console must use radial menus, tabbed linear navigation, and "magnetic snapping" for analog stick focusing. PC must support high info density and custom UI scaling.
N1–N12, I1–I32)Apply the operational interaction rules in
skills/ui-designer/references/app-ui-ux-mindset.md:
- Zero neighbor displacement (
N1): Hovering, selecting, validating, or loading must never shift adjacent elements by even 1 px. Swap button icons for spinners in place, usetabular-numson live counters, reserve validation space between inputs and submit buttons, and animate height disclosures (grid-rows: 0fr -> 1fr, never abrupt<details>perI30).- Hit-target & pointer coherence (
N9,I29,I32): Keep hover background,cursor-pointer, and click handler on the exact same DOM node. Expand compact inline controls to >=32–44px tap areas viarelative before:absolute before:-inset-*without inflating visual chrome. Never allow a parent hover background to match a child badge/control background (I32), or a hover rule to strip a checked radio/checkbox accent.- Modal & focus lifecycle (
I20–I23,I26–I28,I31): Modals containing inputs must not close on outside backdrop click (I20). When an action deletes or hides the currently focused row/element, deterministically move focus to the next item or trigger (I31). Preserve browser autofill (I28) and provide escape hatches (such as "Change email" on OTP steps,N6).- Unslop Pass 7 & Pass 9 coordination (
skills/ui-designer/references/unslop/): During UI redline passes, enforce nested radius math (inner = outer - padding >= 4px), distinct table/row states (N2), visible keyboard focus rings, and removal oftransition-all/ gratuitous hover-scale shifts so interactive states stay within the approved palette and zero-shift budget.
Invoke this skill when:
Reference catalog of common interactive states — specify every state that is reachable in the component's actual contract (never fabricate unreachable states; aligns with Rule 1):
| State | Trigger | Visual | Behavior |
|---|---|---|---|
| Default | Initial render, page load | Base appearance | — |
| Hover | Mouse enters interactive area | Cursor change, subtle highlight | Entry animation plays |
| Focus | Tab key or programmatic focus | Focus ring (WCAG requirement) | — |
| Active / Pressed | Mouse down / touch start | Slight scale down, darker shade | — |
| Loading | Async operation initiated | Spinner, skeleton, or progress | Pulsing animation |
| Disabled | disabled attribute or state | Reduced opacity, no pointer | No interaction accepted |
| Error | Validation fails, API error | Red border, error icon, message | Shake animation |
| Success | Operation completed | Green confirmation, checkmark | Brief scale pop |
| Empty | No data / no results | Illustration + contextual CTA | — |
| Skeleton | Content loading | Shimmer placeholders | Shimmer animation |
## Component: [Name]
### States
#### Default
- **Trigger**: Component renders
- **Visual**: [Description of base appearance]
- **ARIA**: `role="[role]"`, `aria-label="[label]"`
- **Keyboard**: [What keyboard actions are available]
#### Hover
- **Trigger**: `mouseenter` / touch on mobile
- **Visual**: [Hover appearance]
- **Timing**: 100ms ease-out
- **Exit**: 150ms ease-in (return to default)
#### Focus
- **Trigger**: Tab focus / `focus()` call
- **Visual**: 2px solid [color], 2px offset
- **Timing**: Instant
- **WCAG**: MUST be visible — never use `outline: none` without replacement
#### Active
- **Trigger**: `mousedown` / `touchstart`
- **Visual**: scale(0.97), background darken 10%
- **Timing**: 50ms ease-out
#### Loading
- **Trigger**: Operation initiated (API call, computation)
- **Visual**: [Spinner / Skeleton / Progress bar]
- **ARIA**: `aria-busy="true"`, `aria-live="polite"` for status
- **Timing**: [Animation duration]
- **Exit**: Animate content in with stagger
#### Disabled
- **Trigger**: `disabled` prop or conditional state
- **Visual**: opacity: 0.5, cursor: not-allowed
- **ARIA**: `aria-disabled="true"`, remove from tab order
- **Behavior**: All pointer/keyboard events ignored
#### Error
- **Trigger**: Validation fails, API returns error
- **Visual**: border-color: [--color-destructive], error icon, error message below
- **ARIA**: `aria-invalid="true"`, `aria-describedby="[error-message-id]"`
- **Timing**: Shake animation 300ms on first error
- **Recovery**: Clear when user starts typing
#### Success
- **Trigger**: Operation completes successfully
- **Visual**: Checkmark icon, brief green highlight
- **Timing**: Scale 1.0 → 1.05 → 1.0 over 400ms
- **Duration**: Display for 2s then return to default
#### Empty
- **Trigger**: Component renders with no data
- **Visual**: [Illustration] + [Contextual message] + [Primary CTA]
- **ARIA**: `role="status"` or `aria-label` describing empty state
- **Content**: Never show blank space — always meaningful empty state
#### Skeleton
- **Trigger**: Content is loading (replaces Loading state for content areas)
- **Visual**: Gray rectangles matching content layout, shimmer animation
- **ARIA**: `aria-busy="true"`, `aria-label="Loading content"`
- **Timing**: Shimmer animation 1.5s infinite
- **Exit**: Fade out skeleton, fade in content (200ms)
Document complex flows as state diagrams:
## Flow: [Name]
[State A] │ │ [trigger: user action] ▼ [State B] │ │ [condition: success?] ├── YES ──→ [State C: Success] │ └── NO ──→ [State D: Error] │ │ [user retries] ▼ [State B]
For each state transition, specify:
## Transition: [From] → [To]
### Trigger
- [Event that initiates transition — click, API response, timer, etc.]
### Condition
- [Boolean condition that must be true for transition to occur]
### Timing
- Exit animation: [duration] [easing]
- Enter animation: [duration] [easing]
### Feedback
- [What the user sees/hears during transition]
Every error state must specify recovery:
## Error Recovery Matrix
| Error Type | User Action | Recovery Flow | Timing |
|-----------|------------|---------------|--------|
| Validation | Type in field | Error clears on input start | Instant |
| Network | Tap retry | Re-submit, show loading | 1s+ |
| Auth | Tap login | Redirect to login, return | Full flow |
| Server 500 | Tap retry | Re-fetch, preserve form state | 1s+ |
Every micro-interaction follows this 4-part structure:
| Part | Definition | Example |
|---|---|---|
| Trigger | What initiates the interaction | User hovers over button |
| Rules | How it behaves (timing, direction, constraints) | Scale to 1.02 over 100ms |
| Feedback | What the user perceives | Visual change, sound, haptic |
| Loops | What repeats or continues | Hover held → effect persists |
## Timing Scale
| Duration | Use Case | Easing |
|----------|----------|--------|
| 0ms | Instant feedback (color change on click) | — |
| 50ms | Press feedback (scale down on mousedown) | ease-out |
| 100ms | Hover transitions, tooltip show | ease-out |
| 150ms | Tooltip hide, button hover | ease-in |
| 200ms | Modal open, dropdown expand | cubic-bezier(0.16, 1, 0.3, 1) |
| 300ms | Modal close, toast enter/exit | ease-in-out |
| 400ms | Page transitions, skeleton → content | ease-out |
| 500ms+ | Large layout changes, multi-step animations | spring physics |
Trigger: mousedown / touchstart
Rules: scale(0.97), darken background 10%
Feedback: Visual press state
Loops: None
Timing: 50ms ease-out
Exit: 100ms ease-out return to default
Trigger: click / tap / Space / Enter
Rules: Slide thumb to opposite position, change track color
Feedback: Visual position + color change, optional haptic
Loops: None
Timing: 200ms spring (stiffness: 500, damping: 25)
ARIA: role="switch", aria-checked="true/false"
Trigger: click / Enter / ArrowDown / Space
Rules: Expand from closed height to open height, clip children
Feedback: List items stagger in (50ms delay each)
Loops: None
Timing: 200ms ease-out (expand), 150ms ease-in (collapse)
ARIA: role="listbox", aria-expanded="true", aria-haspopup="listbox"
Keyboard: Arrow keys navigate, Escape closes, Enter selects
Trigger: Success/error/warning/info event
Rules: Enter from top-right (slide in + fade), auto-dismiss after N seconds
Feedback: Slide in, auto-dismiss countdown
Loops: None
Timing: Enter 300ms ease-out, visible 3-5s, exit 200ms ease-in
ARIA: role="alert" (errors), role="status" (info)
Trigger: focus event
Rules: Expand label above input (if floating label), show focus ring
Feedback: Label floats up, focus ring appears
Loops: None
Timing: 150ms ease-out (label), instant (focus ring)
Trigger: mouseenter
Rules: translateY(-4px), shadow elevation increase
Feedback: Elevation change, subtle lift
Loops: None
Timing: 200ms ease-out
Exit: 150ms ease-in
Mobile: No hover state — touch to select
Trigger: mousedown on drag handle + move
Rules: Element follows cursor, drop zones highlight on hover
Feedback: Ghost image at 50% opacity, drop zone glow
Loops: Element follows cursor in real-time
Timing: Instant (cursor follow), 200ms ease-out (drop animation)
ARIA: role="listbox" or role="tree" depending on context
Trigger: Content loading state
Rules: Linear gradient sweeps left-to-right continuously
Feedback: Shimmer animation
Loops: Infinite while in loading state
Timing: 1.5s linear infinite
Exit: 200ms fade-out on content arrival
// Micro (100-150ms)
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.1, ease: "easeOut" }}
/>
// Standard (200-300ms)
<motion.div
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.2, ease: [0.16, 1, 0.3, 1] }}
/>
// Spring (interactive)
<motion.button
whileTap={{ scale: 0.97 }}
transition={{ type: "spring", stiffness: 500, damping: 25 }}
/>
// Stagger (list items)
const container = {
hidden: { opacity: 0 },
show: {
opacity: 1,
transition: { staggerChildren: 0.05, delayChildren: 0.1 }
}
}
const item = {
hidden: { opacity: 0, y: 10 },
show: { opacity: 1, y: 0, transition: { duration: 0.2 } }
}
// Page Transition
const pageVariants = {
initial: { opacity: 0, x: -20 },
animate: { opacity: 1, x: 0, transition: { duration: 0.3, ease: "easeOut" } },
exit: { opacity: 0, x: 20, transition: { duration: 0.2, ease: "easeIn" } }
}
When CSS animations are preferred (simpler components):
/* Skeleton shimmer */
@keyframes shimmer {
0% { background-position: -200% 0; }
100% { background-position: 200% 0; }
}
.skeleton {
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
background-size: 200% 100%;
animation: shimmer 1.5s linear infinite;
}
/* Shake (error) */
@keyframes shake {
0%, 100% { transform: translateX(0); }
25% { transform: translateX(-4px); }
50% { transform: translateX(4px); }
75% { transform: translateX(-4px); }
}
.shake { animation: shake 0.3s ease-in-out; }
/* Fade in */
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.fade-in { animation: fadeIn 0.2s ease-out; }
/* Slide up */
@keyframes slideUp {
from { transform: translateY(10px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
.slide-up { animation: slideUp 0.3s ease-out; }
| Element | Tab | Enter/Space | Escape | Arrows | Other |
|---|---|---|---|---|---|
| Button | Focus | Activate | — | — | — |
| Link | Focus | Navigate | — | — | — |
| Checkbox | Focus | Toggle | — | — | Space toggles |
| Radio | Focus | Select | — | Up/Down navigate | — |
| Select | Focus | Open | Close | Up/Down navigate | — |
| Modal | Focus trap | — | Close | Navigate items | — |
| Tabs | Focus | — | — | Left/Right navigate | — |
| Accordion | Focus | Toggle | — | Up/Down navigate | — |
| Tooltip | Focus | Show | Hide | — | — |
| Menu | Focus | Open/select | Close | Navigate | — |
import { useEffect, useRef } from 'react';
function useFocusTrap(isActive: boolean) {
const containerRef = useRef<HTMLDivElement>(null);
useEffect(() => {
if (!isActive || !containerRef.current) return;
const container = containerRef.current;
const focusable = container.querySelectorAll<HTMLElement>(
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
);
const first = focusable[0];
const last = focusable[focusable.length - 1];
first?.focus();
const handleKeyDown = (e: KeyboardEvent) => {
if (e.key !== 'Tab') return;
if (e.shiftKey && document.activeElement === first) {
e.preventDefault();
last?.focus();
} else if (!e.shiftKey && document.activeElement === last) {
e.preventDefault();
first?.focus();
}
};
container.addEventListener('keydown', handleKeyDown);
return () => container.removeEventListener('keydown', handleKeyDown);
}, [isActive]);
return containerRef;
}
States: default, active, disabled, hover, focus
Transitions:
- Click → activate tab (200ms), content cross-fade (150ms)
- Arrow key → instant switch, no animation
- Keyboard: Left/Right navigate, Home/End jump to first/last
ARIA: role="tablist", role="tab", role="tabpanel"
Focus: Tab key enters tab list, arrows navigate within
States: collapsed, expanded, disabled
Transitions:
- Click header → toggle content (200ms height animation)
- Chevron rotates 180° on expand
ARIA: role="button" (header), aria-expanded, aria-controls
Keyboard: Enter/Space toggle, arrows navigate
Multi-open: Can open multiple simultaneously (or single depending on design)
States: closed, opening, open, closing
Transitions:
- Open: Backdrop fade-in 200ms + content scale(0.95→1) + fade 200ms
- Close: Reverse, 150ms
- Content: scale(1→0.95) + fade
Focus: Trap within modal, initial focus on first focusable element
Close: X button, Escape key, backdrop click (configurable)
ARIA: role="dialog", aria-modal="true", aria-labelledby
States: closed, open, loading, error, no-results, selected
Transitions:
- Open: List drops down (200ms), first item highlighted
- Type: Filter list (instant, no animation)
- Select: List closes, selection shown in input (150ms)
ARIA: role="combobox", aria-expanded, aria-autocomplete, aria-activedescendant
Keyboard: Up/Down navigate list, Enter selects, Escape closes, type-ahead
States: per step (default, active, completed, error), navigation
Transitions:
- Next: Current slides left, next slides in from right (300ms)
- Back: Reverse direction
- Jump to step: Direct transition if allowed (300ms)
ARIA: role="tablist" (if stepper) or aria-current="step" with ol/li
Validation: Per-step or on final step (configurable)
Progress: Show step X of N
States: closed, open, selecting, selected, range-selecting
Transitions:
- Open: Calendar drops down (200ms)
- Navigate: Month/year changes slide (150ms)
- Select: Date highlights (instant), calendar closes (150ms)
ARIA: role="dialog" or role="application" with proper labeling
Keyboard: Arrow keys navigate dates, Enter selects, Escape closes
States: default, sorting, filtering, loading, empty, selected
Transitions:
- Sort: Column header highlight (instant), rows reorder (200ms stagger)
- Filter: Rows filter out (150ms fade), count updates
- Select: Row highlight (instant)
ARIA: role="grid" or role="table" with proper labeling
Keyboard: Arrow keys navigate cells, Space selects, Enter activates
Document how interactions change across screen sizes:
## Interaction Responsiveness
| Interaction | Desktop | Tablet | Mobile |
|------------|---------|--------|--------|
| Hover effects | Active | Disabled (touch) | Disabled (touch) |
| Right-click context menu | Shown | Not shown | Long-press instead |
| Tooltip on hover | Shown | Shown | Tap-and-hold |
| Drag-and-drop | Mouse drag | Touch drag | Touch drag |
| Scroll | Mouse wheel | Touch | Touch |
| Focus order | Full tab order | Simplified | Bottom sheet nav |
| Modal | Centered overlay | Centered | Full-screen sheet |
| Dropdown | Dropdown menu | Dropdown menu | Bottom sheet |
Interaction specifications should be implementation-ready:
## Handoff Spec: [Component Name]
### File
`src/components/[Component]/index.tsx`
### State Machine (JSON)
```json
{
"states": ["default", "hover", "focus", "active", "loading", "disabled", "error", "success", "empty", "skeleton"],
"initial": "default",
"transitions": [
{ "from": "default", "to": "hover", "trigger": "mouseenter" },
{ "from": "hover", "to": "default", "trigger": "mouseleave" },
{ "from": "default", "to": "loading", "trigger": "submit" },
{ "from": "loading", "to": "success", "trigger": "apiSuccess" },
{ "from": "loading", "to": "error", "trigger": "apiError" }
]
}
---
## Motion Presets
### Standard Presets
```typescript
const motionPresets = {
// Micro-interactions (50-100ms)
micro: {
duration: 0.1,
ease: [0.4, 0, 0.2, 1], // easeOut
},
// Hover transitions (100-150ms)
hover: {
duration: 0.15,
ease: [0.4, 0, 0.2, 1],
},
// Standard transitions (200-300ms)
standard: {
duration: 0.25,
ease: [0.4, 0, 0.2, 1],
},
// Smooth entrance (300-400ms)
entrance: {
duration: 0.3,
ease: [0.16, 1, 0.3, 1], // easeOutExpo
},
// Exit (150-200ms)
exit: {
duration: 0.2,
ease: [0.4, 0, 1, 1], // easeIn
},
// Page transitions (300-500ms)
page: {
duration: 0.4,
ease: [0.4, 0, 0.2, 1],
},
// Spring for interactive elements
spring: {
type: 'spring',
stiffness: 500,
damping: 25,
},
// Gentle spring
gentleSpring: {
type: 'spring',
stiffness: 300,
damping: 30,
},
};
.forgewright/interaction-designer/
├── interaction-specs/
│ ├── [component-name]/
│ │ ├── state-machine.md # State diagram + transitions
│ │ ├── micro-interactions.md # Timing + animations
│ │ └── handoff.md # Frontend-ready spec
│ └── ...
├── motion-presets.md # Standard animation presets
├── keyboard-behavior.md # Keyboard interaction matrix
├── responsive-interactions.md # Mobile/tablet/desktop behavior diff
└── interaction-glossary.md # Standard interaction vocabulary
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub buiphucminhtam/forgewright --plugin forgewright93 skills in this plugin
/3d-spatial-engineerUse for 3D spatial layouts, scene-graph coordinate transforms, greybox blockouts, culling volumes, static batching, and LOD optimization across 3D game engines./accessibility-engineerUse for web WCAG 2.1/2.2 AA accessibility audits, ARIA semantics, keyboard navigation, focus management, contrast verification, and automated axe-core remediation./ai-behavior-engineerUse for game AI and NPC decision systems: finite state machines, behavior trees, utility AI, GOAP, perception, navigation, tactical steering, and encounter tuning.Other plugins' skills for the same job