К основному содержанию
скилл CX Codex

gestures — скилл для Claude Code: жесты в интерфейсе

Скилл gestures для Claude Code помогает создавать и чинить перетаскивание, свайпы и шторки. Подключается к задачам, где элемент должен двигаться за пальцем и реагировать на отпускание жеста.

MIT 24 200 установок ★ 58 678 обновлён 2026-10-11

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add emilkowalski/skills --skill gestures -a claude-code
Открыть на GitHub

Что делает gestures

Скилл разбирает логику жестов для шторок, карточек, уведомлений и других перетаскиваемых элементов. Во время движения позиция должна следовать за указателем без задержки, а после отпускания движение завершает пружина с учётом скорости жеста. Скилл также объясняет, как связать затемнение оверлея с прогрессом шторки и сохранить возможность перехватить её во время анимации.

Для нижней шторки или выдвижной панели рекомендуется Vaul; собственную механику стоит писать для взаимодействий, которые библиотека не покрывает. В примерах для Motion используются useMotionValue, useTransform и обработчик onDragEnd. Для элементов, которых касается жест, скилл запрещает CSS keyframes: такая анимация не позволяет перехватить элемент на лету.

Какие задачи решает

  • синхронизировать положение элемента с пальцем во время перетаскивания
  • завершать свайп с учётом расстояния и скорости
  • связать прозрачность оверлея с движением шторки
  • дать пользователю перехватить элемент во время анимации
  • настроить возврат элемента после короткого жеста

Примеры запросов агенту

  • Почини свайп карточки: она отстаёт от пальца и резко прыгает после отпускания.
  • Сделай шторку, которую можно перехватить во время закрытия.
  • Настрой удаление уведомления свайпом вниз с учётом скорости жеста.

Как установить gestures

1Через Skills CLI (Vercel)

npx skills add emilkowalski/skills --skill gestures -a claude-code

2Вручную: положить файлы

~/.claude/skills/gestures/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/gestures/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о gestures

Как установить gestures в Claude Code?

Выполни npx skills add emilkowalski/skills --skill gestures -a claude-code. Файл скилла находится по пути ~/.claude/skills/gestures/SKILL.md.

Что делает gestures?

Скилл помогает создавать и исправлять жесты перетаскивания, свайпа и шторок. Он разбирает слежение за пальцем, завершение движения и прерывание анимации.

Когда для шторки лучше взять Vaul, а не писать жест самостоятельно?

Для нижней шторки или выдвижной панели скилл рекомендует Vaul. Собственную механику он предлагает для взаимодействий, которые библиотека не покрывает.

Исходный текст

SKILL.md · MIT
---
name: gestures
description: Build drag, swipe, and sheet interactions that track the finger 1:1 and stay interruptible. Use when building or fixing anything the user drags, swipes, flings, holds, or dismisses with a gesture — drawers, sheets, swipe-to-dismiss toasts and cards, drag-to-reorder, pull-to-refresh, hold-to-confirm — or when a gesture feels laggy, disconnected from the finger, jumps on release, or can't be caught mid-animation. Triggers on — gesture, drag, swipe, fling, sheet, snap points, Vaul, Motion drag props, rubber-band, pull to refresh, hold to delete, touch-action, "doesn't follow my finger", "jumps when I let go", "can't grab it mid-animation".
---

# Gesture-Driven UI

How to build gestures that feel physical. A gesture is direct manipulation: while the finger is down, the UI is the finger; the moment it lifts, physics takes over. Every rule below follows from that split.

## First decision: build it, or use a solution that exists?

Doing a drawer gesture *right* means momentum-based dragging, overlay opacity matched to drag progress, velocity-aware dismissal, focus trapping, and Escape-to-close. That is weeks of edge cases, not an afternoon. **For a bottom sheet / drawer, default to [Vaul](https://vaul.emilkowal.ski/)** — it exists precisely because this is hard to hand-roll. Build the gesture yourself only when no library covers the interaction (custom swipe cards, bespoke drag interactions). When unsure, read `../pick-ui-library/SKILL.md`.

## The two phases of every gesture

Walk this split for any gesture you build. Mixing the phases up is the #1 cause of gestures that feel wrong.

```
Is the pointer currently down?
├── Yes → TRACK phase: position maps 1:1 to the pointer.
│         No easing. No duration. No spring. The element IS the finger.
└── No  → RELEASE phase: physics finishes the motion.
          A spring seeded with the release velocity, or a CSS transition
          when the component is CSS-only (Vaul, hold-to-confirm). Never a keyframe.
```

### Track phase rules

- **1:1 means 1:1.** Drive position from a `useMotionValue` (or direct `transform` writes), never a spring or a transition — a spring during tracking makes the element trail the finger and feel disconnected, like dragging something through syrup.
- **Write `transform` directly on the dragged element.** Never update a CSS variable on a parent to move children: CSS variables are inheritable, so every change recalculates styles for all descendants. This exact bug made Vaul's drag laggy past ~20 list items; setting `transform` on the element fixed it.
- **No React state per move event.** A re-render every pointermove drops frames. Motion values and direct style writes bypass the render cycle.
- **Rubber-band at the edges.** Dragging past a boundary should move the element a fraction of the distance (Motion: `dragElastic` ≈ 0.2), not stop dead — hard stops feel like hitting a wall; resistance communicates "there's nothing further" physically.

### Release phase rules

- **Custom drags finish with a spring, seeded with the gesture's velocity.** The element should leave the finger at the speed it was moving. A fixed-duration ease here makes every fling land identically, which reads as fake.
- **Dismiss on distance OR velocity.** Passing a distance threshold (~40–50% of travel) dismisses, but so does a fast flick over a short distance. In Motion, read both from `onDragEnd`'s `info.offset` and `info.velocity`. Distance-only thresholds make flicks feel ignored.
- **Bounce belongs only at the end of a drag.** A drag applies force — like throwing a ball at a wall — so a slight bounce on release feels physical. The same element closed by a button press gets **zero** bounce: no force was applied. Keep bounce at 0.1–0.3, and remember bounce scales inversely with element size (smaller elements need more bounce to read the same).
- **Snap-back is fast.** If the gesture doesn't pass the threshold, return quickly with the spring — a slow snap-back feels like the UI is disagreeing with the user in slow motion.

## Interruptibility is non-negotiable

The user must be able to catch a sheet mid-close and drag it back. Springs allow this: when retargeted mid-flight they keep their current velocity, so the redirect is seamless. CSS `@keyframes` restart from zero and cannot be caught — this is why Sonner's early CSS enter animation made toasts jump when a second toast arrived. **Never use a keyframe animation on anything a gesture can touch.** CSS transitions and springs only.

## Linked values

The dragged element is rarely alone — an overlay fades, the page behind scales. Derive these from drag progress, don't animate them separately:

```jsx
const y = useMotionValue(0);
const overlayOpacity = useTransform(y, [0, drawerHeight], [1, 0]);
```

One source of truth means the overlay is always exactly as faded as the drawer is dismissed — including mid-gesture, including when the user reverses. Two separate animations drift apart the moment a gesture is interrupted.

## Motion drag props

```jsx
const y = useMotionValue(0);

<motion.div
  drag="y"
  style={{ y }}
  dragConstraints={{ top: 0 }}
  dragElastic={0.2}
  dragMomentum={false}
  onDragEnd={(e, info) => {
    if (info.offset.y > threshold || info.velocity.y > 500) dismiss();
    else animate(y, 0, { type: 'spring', duration: 0.5, bounce: 0.2, velocity: info.velocity.y });
  }}
/>
```

`dragMomentum` is on by default — right for a flung card, wrong for a simple reposition; disable it when the element should stop where the finger stops. The example above disables it because `onDragEnd` hands the release to its own spring. `dragConstraints` takes a ref or bounds object.

## Sheets without springs: the Vaul curve

Vaul mimics the iOS sheet with pure CSS to stay small: `cubic-bezier(0.32, 0.72, 0, 1)` over **500ms**. The curve is extremely steep at the start — that's what lets a 500ms duration still feel snappy while landing with a spring-like gentle settle. Two rules from it:

- A **small floating drawer** (not touching the screen edge) should override to ~200ms — the 500ms iOS timing only reads right on a full-width edge-attached sheet:
  ```css
  [data-vaul-drawer]  { transition: transform 0.2s cubic-bezier(0.165, 0.84, 0.44, 1); }
  [data-vaul-overlay] { transition: opacity  0.2s cubic-bezier(0.165, 0.84, 0.44, 1); }
  ```
- **The component must feel like a single entity.** If the drawer opens in 200ms, its height changes and content crossfades must live in the same timing family — one slow sub-animation makes the whole thing feel broken.

Mark interactive children with `data-vaul-no-drag` so pressing a button inside the drawer doesn't start a drag.

## Spatial consistency

**An element dismisses in the direction it entered.** Sonner's toast slides up from the bottom, so swipe-down dismisses it — enter and exit share one axis, which is what makes the gesture feel discoverable and intuitive without instruction. A gesture that dismisses along an axis the element never moved on has to be learned; one that reverses the entrance is *felt*.

## Hold gestures are asymmetric

Hold-to-delete and similar press-and-hold interactions use **`linear`** during the hold — the animation visualizes time passing, and time passes linearly; any other curve lies about how long is left. On release before completion, snap back fast with `ease-out`. The deliberate phase is slow and honest; the cancel is instant. Symmetric timing here is a bug.

## Touch checklist

Run through this for every gesture you ship:

- **Test on a real phone** — hit the dev server by local IP. Trackpad simulation lies about touch, and a 60Hz desktop monitor hides opacity-transition roughness that a 120Hz phone shows.
- **Hit targets ≥ 44×44px.** Enlarge small visual targets with an invisible `::before` hitbox instead of growing the layout.
- **`touch-action`** on the drag axis (`touch-action: pan-x` for a vertical drag, etc.) so the browser doesn't fight the gesture with native scrolling.
- **Gate hover effects** behind `@media (hover: hover) and (pointer: fine)` — touch fires phantom hovers on tap.

## Reduced motion

Tracking is direct manipulation — the user is producing the motion — so it stays. What reduces: momentum flings, bounce, and any decorative motion around the gesture. On release under `prefers-reduced-motion`, settle with a short opacity/position change instead of a bouncy spring.

## When it still feels wrong

A "weird" spring is usually fixed by increasing `damping`. A gesture that stutters is a performance problem — check the track-phase rules above first, then use the `animation-performance` skill. To diagnose a feeling you can't name, record the gesture and scrub it frame by frame.

© emilkowalski · MIT · emilkowalski/skills

Похожие скиллы

Каталог скиллов SKILL.md →
swiftui-gestures dpearson2699 Скилл swiftui-gestures помогает настраивать жесты в SwiftUI: объединяет нажатия, смахивания и зум, а также устраняет конфликты в иерархии представлений. CX Codex +1 4 300установок framer-motion-gestures C-Jeril Скилл framer-motion-gestures для Claude Code с готовыми паттернами жестовых анимаций в Framer Motion. Добавляет в агента знания о drag, pan, tap, hover, focus и touch-взаимодействиях. CX Codex +1 870установок hand-gestures abouchedidxcode Скилл hand-gestures для Claude Code помогает добавлять в браузерные игры и приложения управление жестами через веб-камеру. Агент подключает его для распознавания движений рук на веб-странице. CX Codex +1 ★ 220звёзд репо find-skills vercel-labs Скилл find-skills для Claude Code ищет скиллы по задаче и помогает выбрать, что установить. Он включается, когда нужно найти готовую возможность для агента. CX Codex +1 4 400 000установок frontend-design официальный anthropics Скилл frontend-design для Claude Code задаёт осмысленное визуальное направление для новых интерфейсов и редизайна. Помогает уйти от шаблонного UI. CX Codex +1 1 025 790установок agent-browser vercel-labs Скилл agent-browser для Claude Code управляет браузером по запросам на навигацию, заполнение форм и проверку веб-приложений. Агент также может запускать через него исследовательское тестирование и автоматизировать Electron-приложения. CX Codex +1 1 600 000установок design-taste-frontend Leonxlnx Скилл design-taste-frontend для Claude Code задаёт правила оформления и проверки сайтов. Подключается при создании или переделке страницы, а также при просьбе убрать шаблонный вид. CX Codex +1 802 600установок grill-me Matt Pocock Скилл grill-me проводит жёсткое интервью по плану или дизайну, чтобы найти пробелы и уточнить решения. Подойдёт перед началом разработки. CX Codex +1 1 424 476установок

Из того же набора19

Весь набор →
animate-expo Скилл animate-expo для Claude Code, который автоматизирует создание анимаций в React Native и Expo. Агент выбирает инструменты и методы реализации, ориентируясь на производительность UI-потока. CX Codex +1 189 400установок write-swift Скилл write-swift для Claude Code помогает писать и разбирать современный Swift. Включается при создании, ревью или миграции Swift-кода, а также при поиске ошибок конкурентности и проблем с памятью. CX Codex +1 169 400установок mobile-native Скилл mobile-native убирает мелочи, из-за которых веб-приложение на телефоне выдаёт себя: залипающий hover, вспышку при тапе, ошибку с 100vh. CX Codex +1 141 900установок break-ui Скилл break-ui для Claude Code находит уязвимости интерфейса с помощью граничных данных и отчёта о сбоях. CX Codex +1 121 000установок animation-performance Скилл animation-performance для Claude Code, помогающий удерживать веб-анимации в рамках бюджета кадров. Диагностирует причины рывков и просадок FPS, предлагая замену ресурсоемких свойств на композитные. CX Codex +1 93 400установок remove-animations Скилл remove-animations для Claude Code удаляет лишнюю анимацию из интерфейса и сокращает ту, у которой есть функция. Запускается по просьбе уменьшить движение или найти анимации, из-за которых приложение кажется медленным. CX Codex +1 47 000установок choreograph Скилл choreograph для Claude Code и других сред, который связывает разрозненные элементы интерфейса в единую анимацию. Координирует время, порядок и перекрытие движений для получения предсказуемого результата. CX Codex +1 32 800установок learn-taste Скилл learn-taste для Claude Code превращает правки по дизайну в правила с объяснениями. Он разбирает замечания из текущей сессии и предлагает, что сохранить для следующих задач. CX Codex +1 13 700установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой