agentleFS
malinskibeniaminmalinskibeniamin/skills/gestures/SKILL.md

gestures

Skill4 starsChanged 10 days agoMITView on GitHub

Build or fix web drag, swipe, sheet, reorder, and hold interactions: direct tracking, rubber banding, release velocity, momentum, snap points, and interruption. Not native React Native or Swift.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Consider Vaul only if it fits the stack and requested scope.

    line 15
  2. Distinctive:

    Resolve release: Read current displacement and recent signed velocity on the owned axis.

    line 35
  3. Distinctive:

    Keep one release driver: library momentum and a custom spring must not compete.

    line 39
  4. Distinctive:

    Keep related overlay/scale values derived from the same drag progress.

    line 43
  5. Distinctive:

    Use the dependency-loading contract.

    line 55
  6. Distinctive:

    Use the real component; record normal-speed/frame-stepped interaction only when needed to resolve continuity.

    line 62

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Make direct manipulation follow the pointer, then settle predictably after release. Adapted from Emil Kowalski; source and compatibility. Questions/reviews return guidance or findings without edits; build/fix follows project TDD, verification and delivery. Loading this skill grants no installs or device access.

Choose the owner

Inspect the component, input paths, installed library/version and existing UI wrapper. Reuse its drawer, dialog, toast or reorder primitive before hand-rolling physics. Consider Vaul only if it fits the stack and requested scope; retain its focus trap, Escape, focus return, scroll locking and dismissal behavior. A gesture is not a reason to replace a working library. Check installed types and current official docs for APIs.

Gesture loop

  1. Define intent. Identify the axis, handle, bounds/snap points, commit action, cancel path and non-drag alternative. Prefer native scroll/snap when it fits. Separate press feedback from activation; preserve accessible click/submit controls.
  2. Arbitrate input. Let scrolling, text selection and interactive children keep their native behavior. For custom pointer handling, track the active pointer id, capture only the owned drag, and handle pointercancel, lostpointercapture, extra pointers and unmount. Cancellation must not commit a dismiss/delete/reorder. Set scoped touch-action before the gesture; preserve pinch zoom. For phone/browser symptoms, load mobile-native.
  3. Track directly. Within bounds, map pointer displacement 1:1 from the element's current visual position. Use the library's motion value or a direct transform, without a tracking spring/transition or per-move React renders. Apply resistance only beyond the permitted boundary. Avoid driving large descendant trees through an inherited per-frame CSS variable; profile the actual update path.
  4. Resolve release. Read current displacement and recent signed velocity on the owned axis. Choose a snap/dismiss target from distance OR a deliberate flick in the allowed direction; use consistent units. Reposition-only drags can stop on release. Fling interactions can use inertia; spring settling can inherit velocity. Keep one release driver: library momentum and a custom spring must not compete.
  5. Stay catchable. On re-grab, stop the release driver, read its current position, and rebase the new drag origin there. Retarget from the current value/velocity where supported. Neither a spring nor CSS automatically guarantees this handoff. Keep related overlay/scale values derived from the same drag progress; prevent stale completion callbacks from unmounting or committing after interruption.
  6. Settle accessibly. Under reduced motion, retain necessary direct tracking but remove decorative bounce and long momentum; settle promptly or instantly. Keep the outcome available via buttons/keyboard and a non-drag pointer path. Holds show elapsed time linearly, cancel on early release/escape/lost capture, and commit once. A hold is not the sole way to perform an action or a substitute for confirmation.

For threshold units, resistance, sheets and hold-specific checks, read REFERENCE.md. Treat its numbers as tuning candidates, not fixed rules. For multi-element timing and transition craft, load animate; for measured drag stutter, load animation-performance. Use the dependency-loading contract.

Verify and hand off

Exercise slow drag, short fast flick, reverse direction, boundary resistance, snap-back, re-grab during settling, nested scroll, child activation, cancellation, multiple pointers, resize/unmount and reduced motion. Test keyboard/non-drag equivalence and retained focus. Use the real component; record normal-speed/frame-stepped interaction only when needed to resolve continuity. Code inspection cannot prove feel, frame rate or phone behavior. Physical-device checks require available authorized hardware; report missing coverage without exposing a dev server or installing tooling just to satisfy this skill.

Report track/release choices, thresholds and units, cancellation/alternative behavior, observed verification and remaining device limits. Keep review findings separate from taste.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.