agentleFS
madebyarismadebyaris/advance-minimax-m3-cursor-rules/.cursor/rules/mobile-cross-platform.mdc

advance-minimax-m3-cursor-rules / rules

Cursor rule126 starsChanged 6 months agoMITView on GitHub

Cross-platform mobile: Flutter, React Native, Expo. Load when editing mobile manifests, platform folders, or shared mobile architecture — not for everyday app logic.

The file

We split this mobile-cross-platform.mdc into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Read manifest, entry point (main.dart, App.tsx), navigation setup, and existing state-management pattern.

    line 18
  2. Very specific:

    After structural changes, run the stack's analyze/test/build check before claiming done.

    line 32
  3. Very specific:

    Test on both iOS and Android when behavior is platform-specific — simulators/emulators are minimum proof.

    line 82

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 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
mobile-cross-platform.mdc
---
description: "Cross-platform mobile: Flutter, React Native, Expo. Load when editing mobile manifests, platform folders, or shared mobile architecture — not for everyday app logic."
globs: ["**/*.dart", "**/pubspec.yaml", "**/pubspec.lock", "**/android/**", "**/ios/**", "**/App.tsx", "**/app.json", "**/app.config.*"]
alwaysApply: false
---

# Cross-Platform Mobile Development

Guidance for Flutter, React Native, and Expo projects. For general coding workflow, the always-on core **Code Discipline** and **App And Scaffold Discipline** sections are canonical — especially CLI-first scaffolding and verification.

Load this rule when globs match mobile project files. Identify the stack from manifests (`pubspec.yaml`, `package.json` + native folders, `app.json`) before choosing patterns. Do not hand-create `pubspec.yaml`, Xcode/Android project trees, or `.xcodeproj` / `.pbxproj` — use the framework CLI.

---

## Before Changing Mobile Code

1. Identify stack: **Flutter**, **React Native**, **Expo**, or other.
2. Read manifest, entry point (`main.dart`, `App.tsx`), navigation setup, and existing state-management pattern.
3. Match platform folder conventions already in the repo — do not restructure unprompted.
4. For new dependencies or SDK versions, verify against current official docs before recommending.

---

## Scaffold & Verify (CLI-first)

| Stack | Create | Add deps | Typical verify |
|-------|--------|----------|----------------|
| Flutter | `flutter create` | `flutter pub add` | `flutter analyze`, `flutter test` |
| React Native | `npx react-native init` | `npm install` | `npx react-native doctor`, build one platform |
| Expo | `npx create-expo-app` | `npx expo install` | `npx expo doctor`, `npx expo start` |

After structural changes, run the stack's analyze/test/build check before claiming done.

---

## Architecture Quick Reference

**Good cross-platform fit:** content apps, business/productivity, MVPs, teams with web background, similar UI across platforms.

**Consider more native work when:** heavy AR/camera, games, deep OS integration, strict platform HIG, or performance-critical media pipelines.

| Framework | Best for | Watch out for |
|-----------|----------|---------------|
| Flutter | Custom UI, performance | App size, Dart ecosystem |
| React Native | JS/TS teams, code share | Native modules, bridge overhead |
| Expo | Fast iteration, managed workflow | Native module limits (unless dev client) |

**Share across platforms:** domain logic, models, API client, validation, most state logic.  
**Keep platform-specific:** native permissions, push/deep links, store billing, platform UI chrome where HIG matters.

Layering (presentation → domain → data) applies; see `language-agnostic-patterns` when refactoring module boundaries.

---

## State & Navigation

- Reuse the pattern already in the repo (Provider, Riverpod, Bloc, Redux, Zustand, etc.) — do not introduce a second state library.
- Navigation: one primary approach (go_router, React Navigation, Expo Router) per app; match existing route definitions.
- Persist only what the product requires; handle offline/error states explicitly on mobile networks.

---

## Mobile Design Quality

Web design instincts do not transfer 1:1 to mobile. The judgment calls:

- **Platform type defaults are correct here.** SF Pro on iOS and Roboto on Android are the *native* choice, not slop — the web font bans in `anti-slop-design` apply to display/brand moments, not to app body text. Custom fonts earn their place on headings and brand surfaces only.
- **Design for the thumb, not the cursor.** Primary actions in the bottom half of the screen; destructive actions away from habitual tap zones; nothing important hidden behind hover (there is none).
- **Navigation follows platform grammar.** Bottom tabs for 3–5 top-level destinations; respect the Android back gesture and iOS swipe-back; use native share sheets, switches, and pickers instead of web-style rebuilds.
- **Glanceability over density.** One primary piece of information per screen region; web dashboard density fails at arm's length on a 6-inch display.
- **Loading is layout-shaped.** Skeletons that match the final layout; render cached/partial data immediately rather than blocking the screen on the full payload.
- **Lists must be virtualized.** `FlatList` / `ListView.builder` with stable keys — never map an unbounded array into scroll children (also listed in traps; it is the #1 mobile perf bug).
- **Motion at 60fps.** RN: `useNativeDriver` / Reanimated on the UI thread. Flutter: animate with `AnimatedBuilder`/implicit animations, not `setState` rebuilds of whole subtrees.

For visual direction (palette, tone, category), still load `anti-slop-design` — adapted through the platform conventions above.

---

## Platform Integration

- Request permissions at point of use with clear rationale; handle denied/permanent-deny flows.
- Test on **both** iOS and Android when behavior is platform-specific — simulators/emulators are minimum proof; label device-only issues `unverified`.
- Deep links, push, and IAP: follow each store's current guidelines; verify against official docs.

---

## Performance & Release

- Images/assets: appropriate resolution; lazy-load lists (avoid building unbounded scroll children).
- Profile before optimizing (Flutter DevTools, RN Performance monitor).
- Release: match existing signing, flavors/schemes, and store listing workflow in the repo — do not invent a new pipeline without asking.

---

## Common Traps

- Hand-written native project files instead of CLI output
- Hover-only or desktop-sized touch targets (min ~44px)
- Ignoring safe areas / notches / keyboard overlap
- Blocking the UI thread with sync I/O or heavy work on the main isolate/thread
- Adding native modules to Expo managed workflow without checking compatibility
- Platform-specific code without `#ifdef` / `Platform.is` / conditional imports where the repo uses them

---

## Verification After Changes

| Change | Minimum proof |
|--------|----------------|
| Dart/TS logic | `flutter analyze` / lint + targeted test |
| UI/layout | Run on one platform simulator; check safe area and scroll |
| Native config | Build succeeds for affected platform (`flutter build`, `npx react-native run-ios`, etc.) |
| Release/signing | `unverified` until user confirms store/TestFlight path |

For distinctive mobile UI polish, load `anti-slop-design` (category-aware layout, typography, motion).

---

## When NOT to Load This File

- Backend or web-only tasks — core **Code Discipline** is enough.
- Greenfield framework choice with no repo context — inspect first, ask on real forks.

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.