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

react-zoom-pan-pinch / rules

Cursor rule2k starsChanged 8 months agoMITView on GitHub

Prefer deep modules: a lot of behaviour behind a small interface. - Fewer functions with real behaviour beat many thin pass-through helpers. - A module is shallow when its interface is nearly as complex as its implementation — a wrapper that only renames or forwards arguments adds cost, not value. - Deletion test: if deleting a helper would just inline one line at each call site, delete it. If it would scatter real complexity across callers, it earns its place.…

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 module-design.mdc into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Prefer deep modules: a lot of behaviour behind a small interface.

    line 13
  2. Distinctive:

    Deletion test: if deleting a helper would just inline one line at each call site, delete it.

    line 19
  3. Very specific:

    Every public prop is forever: Do not add a prop, option or callback argument for a need nobody has.

    line 29
  4. Distinctive:

    No abstraction until there are at least two real call sites that want it.

    line 33
  5. Distinctive:

    Don't scaffold empty folders or files "for later".

    line 34
  6. Distinctive:

    Before declaring work done, scan your own diff for these.

    line 38

≈ “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
module-design.mdc
---
description:
  Module design for library code — deep modules, no speculative generality,
  every public prop is forever, self-review smells
globs: src/**/*
alwaysApply: false
---

# Module design

## Deep modules

Prefer **deep modules**: a lot of behaviour behind a small interface.

- Fewer functions with real behaviour beat many thin pass-through helpers.
- A module is shallow when its interface is nearly as complex as its
  implementation — a wrapper that only renames or forwards arguments adds cost,
  not value.
- **Deletion test**: if deleting a helper would just inline one line at each
  call site, delete it. If it would scatter real complexity across callers, it
  earns its place.
- Gesture handlers (`src/core/*/*.logic.ts`) stay thin; the math lives in the
  `*.utils.ts` helpers, where it can be unit tested.

## No speculative generality

Build for the requirements that exist, not the ones you imagine.

- **Every public prop is forever.** Do not add a prop, option or callback
  argument for a need nobody has; once published it is semver surface. Prefer a
  fixed, well-chosen constant (e.g. the rubber band's `0.55`) until a real
  request asks for a knob.
- No abstraction until there are at least two real call sites that want it.
- Don't scaffold empty folders or files "for later".

## Self-review smells

Before declaring work done, scan your own diff for these. Each is a judgement
call, not a hard violation — but if you leave one in, be able to say why.

- **Mysterious name** — a function, variable or type whose name doesn't say what
  it does. If no honest name comes, the design is murky.
- **Duplicated code** — the same logic shape in more than one place in the
  change (e.g. per-axis code copied for X and Y instead of one helper).
- **Data clumps** — the same few fields travelling together through signatures
  (`minX, maxX, minY, maxY, paddingX, paddingY`). Bundle them into one type.
- **Primitive obsession** — a raw number standing in for a concept (px vs % of
  the wrapper). Name it, or at least document its unit.
- **Speculative generality** — see above. Delete it.
- **Middle man** — a function that mostly delegates onward. Call the real
  target.

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.