Drag-and-drop, virtualized lists, and orchestrated animations are where AI scaffolding shines and where blind acceptance hurts most. Let the model wire the library boilerplate — sensors, virtualizers, variants — while you personally own timing, gesture conflicts, edge-case physics, and cleanup. That split is the playbook.
Tier: Core · Workflow area: Component development · Tools: Cursor, dnd-kit / TanStack Virtual, Framer Motion
Interaction code has a unique property: it can look perfect in a demo and be unshippable in production. The scroll jumps on data refresh, drag fights text selection on touch, the exit animation leaks a subscription. Models reliably produce the 70% scaffold; the remaining 30% is judgment about how interactions feel and fail — and it stays yours.
@acme/ui ships SortableList, use it (pb-03); don't scaffold a rival.Write the interaction contract before prompting. Ten minutes that anchor everything — behavior, constraints, and failure modes in plain language:
INTERACTION CONTRACT — Kanban card drag
- Pointer + keyboard reorder (space to lift, arrows to move, esc cancels)
- Drop preview shows insertion gap; source card at 40% opacity
- Auto-scroll when dragging within 48px of a column edge
- Live data: if a card moves server-side mid-drag, my drag wins; refetch
reconciles after drop
- Mobile: drag starts after 150ms long-press; scroll wins otherwise
- Failure: failed persist reverts with a toast, no silent reorder
Perf gate: no dropped frames with 200 cards on a 4x CPU throttle.
Scaffold against the contract with the library named explicitly. In Cursor (or Claude Code), pin the library and version so the model doesn't free-associate APIs across major versions:
Using dnd-kit (@dnd-kit/core@6, @dnd-kit/sortable@8) implement the
attached interaction contract for our KanbanBoard in
src/features/board/. Use PointerSensor + KeyboardSensor with our
sortableKeyboardCoordinates. Columns and cards come from
useBoardQuery(); persist via reorderCard mutation with optimistic
update and rollback. Use @acme/ui Card. Ask before adding deps.
npm i @dnd-kit/core@6 @dnd-kit/sortable@8 @dnd-kit/modifiers
Good scaffold output: DndContext with both sensors configured, SortableContext per column, an onDragEnd that calls the mutation with optimistic update and rollback, and a DragOverlay for the preview — not a hand-rolled mousemove listener.
Take manual ownership of the last-30% checklist. Walk each item personally; these are precisely the things scaffolds get subtly wrong:
duration: 0.3 defaults.touch-action deliberately.prefers-reduced-motion collapses animations to opacity/instant.Profile before declaring done. Feel is measurable:
npx playwright test board.perf.spec.ts --project=chromium
Or manually: DevTools Performance panel, 4x CPU throttle, record a full drag across columns with 200 cards. A good trace shows no long tasks over 50ms during drag and no layout thrash (purple spikes) on dragover. For virtualized lists, scroll a 10k-row list and confirm stable frame times and correct scroll restoration after data refresh.
Ask the model to critique its own scaffold against the contract. Cheap and surprisingly effective at surfacing what it skipped:
Re-read the interaction contract. List every requirement my current
implementation does NOT fully satisfy, with file:line evidence. Pay
special attention to keyboard reorder, mid-drag refetch, and cleanup.
Treat the answer as a lead list, not a verdict — verify each claim yourself.
Animation and drag scaffolds are the top source of leaked listeners and orphaned RAF loops in AI-generated frontend code. Any addEventListener, setInterval, requestAnimationFrame, or ResizeObserver in generated interaction code gets a matching teardown that you personally locate before merge — StrictMode's double-mount will expose most misses in dev.
Table primitives beats a virtualized-table library the model invents.vuedraggable/@formkit/drag-and-drop + @tanstack/vue-virtual + Motion for Vue; Angular uses CDK DragDrop + CDK Virtual Scroll + Angular animations. The last-30% checklist is framework-agnostic.ReorderableListView/custom Draggable + ListView.builder; profile with DevTools' frame chart in profile mode on real hardware.Scaffold the library plumbing with AI, but the contract, the feel, the gesture conflicts, and the cleanup are engineering judgment — the 30% you own is exactly the part users experience as quality.