# Canvas gestures and hit testing

> Canvas gestures and hit testing is an open-source agent skill for developer tools. Turns canvas taps, swipes and drags into typed intents hit-tested on the drawn layout. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/zakariaf/ReactNative-Skills/tree/main/skills/canvas-gestures-and-hit-testing
- **Repository:** https://github.com/zakariaf/reactnative-skills
- **GitHub stars:** 16
- **License:** MIT
- **Skill name:** canvas-gestures-and-hit-testing
- **Collection:** https://github.com/zakariaf/ReactNative-Skills
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill sets up a single gesture module for hand-drawn React Native canvases built on Skia. Every tap, swipe, drag, long press and aim is hit-tested against the same layout the renderer draws with, and each gesture produces at most one typed intent. A surface's own pure intent function then decides whether that intent becomes a domain action, so the rules of legality stay in one place that tests, undo and bots can all share.

The skill ships an input kit with the gesture builders, swipe and pan classification, stick commands for real-time games, and touch-target helpers, along with a checker script that reports missing pieces and failing rules. It also covers tap-then-tap selection kept in screen state, a drag lift applied in the gesture layer, quantised aim values, and pan settings that keep the system back gestures from competing with the canvas.

It expects a project with Gesture Handler and Skia available and a canvas kit already in place, or the skia-canvas-rendering skill to create one. Code is TypeScript and the checks run with Node and Jest.

## When your agent uses it

> Turns canvas taps, swipes, drags and aim into typed intents: one gesture module, hit-testing on the drawn layout. Use when a Skia canvas takes touch or a tap hits the wrong cell. Not for drawing (skia-canvas-rendering).

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Runs JavaScript and TypeScript scripts](https://github.com/zakariaf/ReactNative-Skills/tree/HEAD/skills/canvas-gestures-and-hit-testing)
- [No network calls found in its scripts](https://github.com/zakariaf/ReactNative-Skills/tree/HEAD/skills/canvas-gestures-and-hit-testing)
- [License: MIT](https://github.com/zakariaf/ReactNative-Skills/tree/HEAD/skills/canvas-gestures-and-hit-testing)

## Features

- **Single gesture module:** All canvas gestures are built in one file so a library upgrade touches only one place.
- **Typed intent output:** Each gesture emits at most one tap, long-press, swipe, drag-end or aim intent.
- **Layout-based hit testing:** Touches are tested against the same layout the canvas draws, with a fixed slop margin.
- **Pure intent functions:** Each surface decides legality in a pure function that tests and bots can reuse.
- **Touch target proofs:** Tests confirm every tappable region meets the minimum touch size on the smallest canvas.
- **Compliance checker:** A script reports each failing rule with its file and suggested fix until the setup passes.

## Good for

- Make taps on a progress grid toggle the right day cell
- Let users drag a task from an inbox list onto a calendar day
- Add swipe-to-slide controls to a sliding puzzle game
- Wire aim-and-release input for a simple arena game
- Check that every tappable cell on a board meets the minimum touch size

## Install

### Claude Code

This skill ships in the `react-native` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add zakariaf/ReactNative-Skills
/plugin install react-native@react-native-skills
```

Or copy only this skill to `~/.claude/skills/canvas-gestures-and-hit-testing`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/canvas-gestures-and-hit-testing &&
cp -R "$tmp/skills/canvas-gestures-and-hit-testing" ~/.claude/skills/canvas-gestures-and-hit-testing &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/canvas-gestures-and-hit-testing` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/canvas-gestures-and-hit-testing` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/canvas-gestures-and-hit-testing &&
cp -R "$tmp/skills/canvas-gestures-and-hit-testing" ~/.agents/skills/canvas-gestures-and-hit-testing &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/canvas-gestures-and-hit-testing` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/canvas-gestures-and-hit-testing` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/canvas-gestures-and-hit-testing &&
cp -R "$tmp/skills/canvas-gestures-and-hit-testing" ~/.cursor/skills/canvas-gestures-and-hit-testing &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/canvas-gestures-and-hit-testing` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/zakariaf/ReactNative-Skills.git --path skills/canvas-gestures-and-hit-testing
```

Or copy the folder to `~/.gemini/skills/canvas-gestures-and-hit-testing` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/canvas-gestures-and-hit-testing`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/canvas-gestures-and-hit-testing &&
cp -R "$tmp/skills/canvas-gestures-and-hit-testing" ~/.copilot/skills/canvas-gestures-and-hit-testing &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/canvas-gestures-and-hit-testing` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/zakariaf/ReactNative-Skills.git
```

Then copy `ReactNative-Skills/skills/canvas-gestures-and-hit-testing` into your agent's skills folder as `canvas-gestures-and-hit-testing`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does the skill need before Canvas gestures and hit testing can be used?

It needs the canvas kit files at src/canvas/canvas-layout.ts and canvas-types.ts. If they are missing, the skill says to set them up with skia-canvas-rendering first.

### Does Canvas gestures and hit testing change how drawing works?

No. Drawing belongs to skia-canvas-rendering; this skill only handles input and hit-testing on the layout that drawing uses.

### Does Canvas gestures and hit testing handle right-to-left layouts?

Yes. Touch coordinates stay physical and only the layout mirrors for right-to-left surfaces, so touches land on the correct cell.

### Which Gesture Handler versions are covered?

The builder API is used on 2.x and the hook API on 3.x, with the version pinned by the Expo SDK and a migration reference included.

### How do I install Canvas gestures and hit testing in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/canvas-gestures-and-hit-testing to use it in all your projects, or to .claude/skills/canvas-gestures-and-hit-testing in one project. Or install the react-native plugin, which includes it: /plugin marketplace add zakariaf/ReactNative-Skills, then /plugin install react-native@react-native-skills.

### Does Canvas gestures and hit testing run scripts?

Yes. It runs JavaScript and TypeScript scripts. No network calls were found in its scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Canvas gestures and hit testing?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Canvas gestures and hit testing?

The closest alternatives to Canvas gestures and hit testing are Accessibility as code, Expo animation, Game session host, Android gesture and Expo animation.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Accessibility as code](https://ai-powered.com/skills/accessibility-as-code): Accessibility as code is an open-source agent skill for developer tools.
- [Expo animation](https://ai-powered.com/skills/expo-animation): Expo animation is an open-source agent skill for developer tools.
- [Game session host](https://ai-powered.com/skills/game-session-host): Game session host is an open-source agent skill for developer tools.
- [Android gesture](https://ai-powered.com/skills/android-gesture): Android gesture is an open-source agent skill for developer tools.
- [Expo animation](https://ai-powered.com/skills/expo-animation-scaledockhq): Expo animation is an open-source agent skill for developer tools.
- [Design engineering edho ferdian](https://ai-powered.com/skills/design-engineering-edho-ferdian): Design engineering edho ferdian is an open-source agent skill for developer tools.
- [Adaptive layout](https://ai-powered.com/skills/adaptive-layout): Adaptive layout is an open-source agent skill for developer tools.
- [Error handling typed results](https://ai-powered.com/skills/error-handling-typed-results): Error handling typed results is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/canvas-gestures-and-hit-testing
