agentleFS
BetterTypedBetterTyped/react-zoom-pan-pinch/.cursor/rules/debugging.mdc

react-zoom-pan-pinch / rules

Cursor rule2k starsChanged 8 months agoMITView on GitHub

Before hypothesizing about a bug's cause, build a repro that goes red on this bug at the nearest seam: - Logic (bounds, zoom math, rubber band, velocity): a unit test against the helper in src/core/** (see __tests__/units/). - Gestures and callbacks: a renderApp spec driving pan, touchPan, trackPadPan, zoom or pinch (__tests__/utils/render-app.tsx). Use fake timers + flushAnimationFrames() for velocity and alignment animations. - Timing, layout, real pointer feel: jsdom has no layout and only approximates rAF, so it cannot prove…

Adopted by

Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projectsWeek of Oct 25: 0 new projectsWeek of Nov 1: 0 new projectsWeek of Nov 8: 0 new projectsWeek of Nov 15: 0 new projectsWeek of Nov 22: 0 new projects
Oct 2026Nov 2026Nov 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 0 in all, so this is a hint, not a trend.

Who's talking about BetterTyped/react-zoom-pan-pinch

The biggest 5 of 50 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 50

Talked about on GitHub (50 times).

On GitHub · 50

45 more on GitHub

The file

We split this debugging.mdc into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    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:

    Before hypothesizing about a bug's cause, build a repro that goes red on this bug at the nearest seam:

    line 13

≈ “Common” is an estimate: at least 1 in 5 of the 7,324 Cursor rule 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
debugging.mdc
---
description:
  Bug-fixing discipline — build a red feedback loop before hypothesizing, ship
  every fix with a regression test. Apply whenever diagnosing or fixing a bug,
  failure, or regression.
alwaysApply: false
---

# Debugging discipline

## Feedback loop first

Before hypothesizing about a bug's cause, **build a repro that goes red on this
bug** at the nearest seam:

- **Logic** (bounds, zoom math, rubber band, velocity): a unit test against the
  helper in `src/core/**` (see `__tests__/units/`).
- **Gestures and callbacks**: a `renderApp` spec driving `pan`, `touchPan`,
  `trackPadPan`, `zoom` or `pinch` (`__tests__/utils/render-app.tsx`). Use fake
  timers + `flushAnimationFrames()` for velocity and alignment animations.
- **Timing, layout, real pointer feel**: jsdom has no layout and only
  approximates rAF, so it cannot prove gesture timing or animation smoothness.
  Drive the running Storybook (`yarn storybook`, port 6006) and log transform
  values per frame. A background tab throttles rAF to about 1 fps — check that
  the tab is in front before reading timings.

A fix without a red loop is a guess. If you genuinely cannot build a repro, say
so, list what you tried, and ask for what is missing (browser, device, props, a
CodeSandbox) instead of proceeding on hypothesis alone.

## Fix against the loop

- One hypothesis at a time, tested against the loop — no shotgun edits across
  files hoping one lands.
- Done when the red loop goes green **and** the surrounding suite still passes.
- A failing existing test usually means a library regression, not a bad test
  (see `testing-regressions.mdc`). Change a test only when its expectation was
  wrong, and say why.

## Every bug fix ships with a regression test

The repro from step one stays as the regression test. If a bug escaped, the
suite had a hole — the fix is not complete until it is closed. Issue-linked bugs
go under `__tests__/regressions/` per `testing-regressions.mdc`, and the
matching `docs/bugs/*.md` records the fix and spec path.

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.