---
name: "react-native-guardrails"
description: "Writes a tailored GUARDRAILS.md and AGENTS.md pointer for a React Native or Expo repo so AI coding agents build scalable code without over-engineering. Use when setting up or auditing RN guardrails."
---

# React Native Guardrails

This skill turns the rule set below into a `GUARDRAILS.md` that fits one specific repo: its stack, its team size and its current pain. The output is written for AI coding agents first (rule IDs, MUST/SHOULD/NEVER, a way to check each rule) and for human reviewers second.

The rule set is the source of truth. The skill never invents rules beyond it; it selects, adapts wording to the detected stack, and fills project-specific values.

Rule set verified against official docs on 2026-12-01 (React Native 0.88, Expo SDK 58, React Compiler 1.0, TanStack Query v5, FlashList v2, React Navigation 7, Zod 4). Rule A5 makes the agent re-check version-specific APIs live, so the rules stay valid as libraries move. Full explanation and sources: https://adnanradjam.com/portfolio/rn-guardrails

## Workflow

Run these five steps in order. Do not skip Detect: questions the repo can answer must not be asked.

### 1. Detect (read the repo, ask nothing yet)

Read, without modifying anything:

- `package.json`: React Native and Expo versions, and which libraries fill each job: navigation (`expo-router`, `@react-navigation/*`), server data (`@tanstack/react-query`, `@reduxjs/toolkit`, `swr`), client state (`zustand`, `redux`, `mobx`, `jotai`), styling (`nativewind`, `tamagui`, `styled-components`, plain `StyleSheet`), lists (`@shopify/flash-list`), animation (`react-native-reanimated`, `react-native-worklets`), testing (`jest`, `jest-expo`, `@testing-library/react-native`, `reassure`), schema (`zod`, `valibot`, `yup`).
- Framework mode: `app.json` / `app.config.*` and `expo` in dependencies mean Expo; committed `ios/` and `android/` folders without Expo config mean bare.
- React Compiler: `experiments.reactCompiler` in the app config, or `babel-plugin-react-compiler` in the Babel config.
- Folder shape: feature-based (`src/features/*`), type-based (`src/screens`, `src/components` at the top) or mixed. Count files in shared folders and how many importers each has.
- Team and process signals: `CODEOWNERS`, CI config (`.github/workflows`, `.eas/workflows`, others), lint config (flat or legacy), `tsconfig.json` strictness, lockfile and package manager, `.nvmrc` / `engines`.
- Monorepo signals: workspaces, `apps/` and `packages/` folders.
- Existing agent files: `AGENTS.md`, `CLAUDE.md`, `.cursor/rules`, an existing `GUARDRAILS.md`.

Classify the repo as **existing repo** (app code beyond the starter template) or **new project**.

### 2. Ask (only what Detect could not answer)

Ask in one message, at most four questions, each with a default:

1. Team size today, to set the level (Starter 1–3 devs, Growing 4–10, Scale 10+). Default: Starter.
2. What hurts right now (slow screens, merge conflicts, bugs from one area breaking another, flaky releases). Default: nothing specific.
3. For each detected choice that looks accidental (two state libraries, mixed folder shapes): keep it or pick one? Default: keep what exists (A2).
4. Critical journeys and budgets (bundle size, render time). Default: sign-in, sign-up, the core money or checkout flow; budgets left unset.

For a new project, also ask the open choices from N1 (Expo or bare, navigation, styling) and offer the defaults table.

If nobody answers, take every default and say so at the top of the output.

### 3. Assess

- Pick the level per area, not for the whole app: structure, state, CI and releases can sit at different levels.
- For every rule, mark it **applies**, **adapted** (reworded to the detected stack, for example RTK Query instead of TanStack Query under ST11) or **not applicable** (drop it from the output, for example push rules in an app without notifications).
- Note current violations with file paths and counts. Example: "`src/components/` has 40 files, 12 used by only one screen (P3)".
- Never recommend migrating an existing library. Mention an alternative only as an optional "consider when" note tied to a measured pain.

### 4. Write

Create `GUARDRAILS.md` at the repo root with this shape:

1. `## Stack`: level per area, framework, navigation, state, styling, critical journeys, budgets, any changed thresholds, each with a one-line reason (N5).
2. The applicable rules, grouped as in the rule set below, keeping every rule ID unchanged so agents and reviewers can cite them. Reword only to match the stack.
3. `## Current violations`: the list from Assess, with paths, so the first cleanup tasks are obvious. Never fix them inside this task.
4. `## Next scale triggers`: the triggers closest to firing, with the evidence.
5. The PR checklist, trimmed to the applicable rules.

Then add a short pointer for agents:

- If `AGENTS.md` exists, append a clearly marked section; otherwise create it. Keep it to 20–40 lines: the five most important rules for this repo, the conflict order, and "Read GUARDRAILS.md before writing code."
- If `CLAUDE.md` or `.cursor/rules` already exist, add one line pointing to `GUARDRAILS.md`. Do not create them.

### 5. Enforce (opt-in only)

Offer, never apply by default:

- Lint boundaries (`import-x/no-restricted-paths` or `eslint-plugin-boundaries`), circular-dependency check, and the other CI checks for the chosen level.
- Start every new lint rule as `warn`, report the current violation count, and suggest switching to `error` once it reaches zero.

Safety rules for this skill:

- Never overwrite an existing config, `AGENTS.md` or `GUARDRAILS.md`. Show a diff or append a marked section.
- Never install packages; list them for the human to approve (A3, V1–V8).
- On a re-run, diff against the existing `GUARDRAILS.md`: report new violations, triggers that fired and rules that changed. Keep the human's own edits.

---

# Rule set

## Agent operating rules

This doc is written for the AI agent that writes code in this repo; humans review against it. Rules use **MUST**, **SHOULD** and **NEVER**. A MUST or NEVER may be broken only with a `// guardrail-exception: <rule id> <reason>` comment and one line in the PR description.

The doc has two modes. In an **existing repo**, the code already there is the first authority (A1, A2) and this doc fills the gaps. In a **new project**, this doc is the authority: follow "Starting from scratch" first, then every other section as written.

### How to read these rules

| Keyword | Meaning for the agent |
| --- | --- |
| **MUST** | Always do it. Break it only with a `// guardrail-exception: <rule id> <reason>` comment at the spot and one line in the PR description. |
| **NEVER** | Never do it. Same exception path as MUST. |
| **SHOULD** | The default. Deviate only with a one-line reason in the PR description; no code comment needed. |

When two rules seem to conflict, apply the first match:

1. Security and shipping rules cannot be broken with a guardrail-exception comment: ST9, AP7, AP8, R4, R6, V2. Only the human, explicitly, in the conversation, can waive them.
2. The human's explicit instruction for the current task.
3. In an existing repo, the pattern the repo already uses (A2).
4. A specific rule beats a general one (PF4 beats P4; NV2 beats any general import advice).
5. MUST and NEVER beat SHOULD.
6. Still unclear: ask the human once, with both options and a recommendation.

Terms used in the rules:

- **Existing repo**: has app code beyond the starter template. Otherwise it is a **new project**.
- **Feature**: one product-domain folder under `src/features/`.
- **Level**: read from the `## Stack` section of `GUARDRAILS.md`; Starter if none is set.
- **Stack section**: the `## Stack` part of `GUARDRAILS.md` holding the level, framework, navigation, state, styling, critical journeys, budgets and any changed thresholds (N5).
- **Short list**: up to ~50 items with a fixed size. **Long list**: more than ~50 items, paginated or unbounded.
- **Measured**: a number from a release build (profiler, `console.time`, Reassure, Flashlight), written in the PR.
- **Critical journey**: listed in the Stack section; by default sign-in, sign-up and the app's core money or checkout flow.
- **~N lines**: a prompt to check, not an exact limit; count the whole file.

| Prefix | Area | Prefix | Area |
| --- | --- | --- | --- |
| A | Before writing code | AP | API layer |
| V | Vetting a dependency | DL | Deep links |
| N | New project | PN | Push notifications |
| P | While writing code | PF | Performance |
| D | Done means | MZ | Memoization |
| S | Project structure | AN | Animations |
| ST | State & data | T | Testing |
| SE | Side effects | TW | Test writing |
| EB | Errors | UT | Unit tests |
| C | Components | FT | Functional tests |
| SY | Styling | TL | Tooling |
| NV | Navigation | CI | CI checks |
| TS | TypeScript | R | Builds & releases |

### Before writing code in an existing repo

- **A1 MUST** read `package.json`, the app entry and 2 existing features before adding a new one, then copy the patterns found there.
- **A2 MUST** use the stack already in the repo: Expo or bare, state library, styling, navigation. NEVER add a second library for a job one already does, and NEVER migrate unasked.
- **A3 NEVER** add a dependency without asking the human first. State the package, why it is needed, and how far the installed tools get without it.
- **A4 MUST** post a 3–5 line plan (files to create and touch) before any change touching more than 5 files.
- **A5 MUST** check the official docs for the installed version before using any React Native, Expo or library API: reactnative.dev, docs.expo.dev (append `.md` to any page for an agent-readable copy) and the library's own docs. NEVER rely on memory for version-specific APIs; training data goes stale. Example: the core `SafeAreaView` is deprecated since RN 0.81, so use `react-native-safe-area-context`.

### Vetting a new dependency

Applies in both modes, every time A3 comes up. The agent runs these checks itself, live, and shows the results to the human with the A3 ask.

- **V1 MUST** prefer, in order: React Native core → Expo SDK module (Expo projects) → a library from an established maintainer (Expo, Software Mansion, Callstack, Shopify, Infinite Red, Meta) → anything else.
- **V2 MUST** confirm New Architecture support on React Native Directory (reactnative.directory) or in the library's docs, for the exact version being installed. In Expo projects, also run `npx expo-doctor` after installing. NEVER install a library without New Architecture support.
- **V3 MUST** confirm active maintenance: a release or commit in the last 6 months, and maintainers answering recent issues.
- **V4 MUST** confirm real usage: 10,000+ weekly npm downloads by default. A niche native SDK may fall below this; say so and why.
- **V5 SHOULD** confirm more than one active contributor in the last 12 months, unless an established maintainer (V1) owns it.
- **V6 NEVER** install a package npm marks as deprecated, or one whose README points to a replacement.
- **V7 MUST** install the latest stable version compatible with the project: `npx expo install <pkg>` in Expo projects (it picks the version matching the SDK), the library's stated RN range in bare projects. NEVER pin an old major version unasked.
- **V8 MUST**, when any check fails, not install. Report which check failed and offer an alternative library or a small in-house version (under ~50 lines).

Report format for the A3 ask:

| Check | Result |
| --- | --- |
| New Architecture | yes, since v2.0 (React Native Directory) |
| Last release | 2026-11-02 |
| Weekly downloads | 1.1M |
| Active contributors (12 mo) | 14 |
| Deprecated | no |

The thresholds above are defaults; a project can change them in its `## Stack` section, and the agent follows the project's numbers.

### Starting from scratch

In a new project the agent sets the patterns every later change will copy, so it picks the boring default and writes each choice down.

- **N1 MUST** ask the human, in one message, the choices this doc leaves open: Expo or bare, navigation, styling. Offer the defaults below and take the default for anything left unanswered.
- **N2 MUST** start with the minimum: current stable React Native or Expo SDK, TypeScript strict, ESLint + Prettier, React Compiler on, the Project structure layout with one example feature, and a query library for server data. Nothing else.
- **N3 NEVER** pre-install libraries "we'll need later" (forms, i18n, analytics, global store, animation). Add each when the first feature needs it, asking per A3.
- **N4 NEVER** create empty folders or placeholder files for future features. `shared/` starts empty and grows per P3.
- **N5 MUST** record each stack choice and its one-line reason in a `## Stack` section of `GUARDRAILS.md`, so later agents follow it through A2.
- **N6 MUST** start at the Starter level and level up only when a trigger shows.

| Choice | Default | Pick the other when |
| --- | --- | --- |
| Framework | Expo (prebuild + EAS), the framework the React Native docs recommend | Bare: adding RN to an existing native app, or a native SDK that config plugins cannot cover |
| Architecture | New Architecture only; no opt-out since RN 0.82 | No alternative. A library without New Architecture support is not an option |
| Navigation | Expo Router with Expo, React Navigation with bare | The human prefers the other |
| Memoization | React Compiler on | Leave it off only if a required library breaks under it |
| Server data | TanStack Query v5 | The team already standardizes on another query library |
| Client state | `useState`, then Context | A small store (Zustand) once 3+ unrelated screens share mutable state |
| Styling | `StyleSheet` + theme tokens | The team already works in NativeWind or Tamagui |
| Lists | `FlatList` for short lists | FlashList v2 (New Architecture only, no size estimates) for long or mixed-height lists, or once a list measurably drops frames |

### While writing code

- **P1 MUST** build only what the task asks. No speculative props, config options or "future-proof" layers.
- **P2 NEVER** create an abstraction (shared component, hook, util, base class) for one use. Two copies are fine; extract on the third real use.
- **P3 MUST** colocate: new code goes in the feature that uses it. Move it to `shared/` only when a second feature imports it.
- **P4 Memoization depends on React Compiler.** With the compiler on (the default in new Expo apps since SDK 54), the compiler memoizes and the agent hand-writes `useMemo`, `useCallback` or `React.memo` only for the escape hatches in Performance → When to memoize. With it off, memoize only in the cases that table lists, never by habit.
- **P5 MUST** keep features deletable: removing a feature folder needs 5 or fewer line changes outside it.
- **P6 Share shape, not meaning.** `shared/` holds only UI primitives, slot-based templates (layout only: no fetching, navigation or stores) and infrastructure utilities (API client, `formatRupiah`, analytics). NEVER put domain logic or domain-named components in `shared/`. A template that needs a 4th boolean prop gets split, or the variation is composed inside the feature.
- **P7 SHOULD** keep diffs to one concern. NEVER reformat or refactor code the task does not touch.

### Done means

- **D1 MUST** run type check (`tsc --noEmit`), lint and the existing tests before reporting done, and say which ran.
- **D2 MUST** list every assumption made and every guardrail exception taken.

## Project structure

Organize by feature, with imports flowing one way: `app` → `features` → `shared`. The layout works the same for Expo and bare projects.

```
src/
  app/              entry, providers, navigation root
  features/
    <feature>/      named by product domain: gold, transfer, profile
      screens/
      components/
      hooks/
      api/
      types.ts
      index.ts      the feature's public API
  shared/
    ui/             primitives + slot templates
    lib/            API client, formatters, analytics, storage
    hooks/          generic hooks only (useDebounce)
    theme/          design tokens
```

- **S1 MUST** put new feature code under `src/features/<feature>/`, named by product domain, never by type (`features/gold`, not `features/cards`).
- **S2 MUST** keep imports one-way. NEVER import `app/` from a feature, and NEVER import `features/` from `shared/`.
- **S3 NEVER** import another feature's internals. Cross-feature use goes through that feature's `index.ts` only. If two features keep needing each other, stop and ask the human: merge them, or move the shared part.
- **S4 SHOULD** create only the subfolders a feature needs. A one-screen feature can be `PromoScreen.tsx` + `index.ts`.
- **S5 MUST**, with Expo Router, keep route files in the root `app/` thin: import the screen from its feature, no logic in the route file.
- **S6 NEVER** restructure existing code unasked. If the repo is type-based (`screens/`, `components/` at the top), ask once whether new work follows the existing layout or starts `features/`, then follow the answer.
- **S7 MUST** stay a single app. NEVER add workspaces or a monorepo unless a second app or web target exists and the human asks for it.
- **S8 MUST** name files consistently: components `PascalCase.tsx`, one exported component per file; hooks `useThing.ts`; everything else `camelCase.ts`.

Enforcement grows with the team. The agent applies the current level and NEVER moves up a level on its own; it suggests the next level when the trigger shows.

| Level | When | Boundary enforcement |
| --- | --- | --- |
| Starter | 1–3 devs | S1–S8 by convention and review |
| Growing | 4–10 devs, or a cross-feature break has happened | Lint `import-x/no-restricted-paths` or `eslint-plugin-boundaries`, as warn first, error at zero violations |
| Scale | 10+ devs or several squads | Lint as error, CODEOWNERS per feature, `shared/` owned by a core team |

## State & data

Every piece of state has exactly one home, chosen by what kind of state it is. Most over-engineering in React Native apps is server data copied into a global store.

| Kind of state | Home | Example |
| --- | --- | --- |
| Server data (the API owns it) | Query library (TanStack Query by default) | balance, transaction list, profile |
| UI state of one screen | `useState` / `useReducer` | modal open, selected tab |
| Form input in progress | `useState`; a form library once a form has 5+ fields or cross-field rules | transfer amount |
| Shared by one subtree | Context placed at that subtree | multi-step wizard |
| App-wide client state | Context if it rarely changes; a small store (Zustand) only after the ST4 trigger | theme, locale, onboarding seen |
| Navigation input | Route params, IDs only | `transactionId` |
| Persisted, not sensitive | MMKV or AsyncStorage, whichever the repo uses | last selected tab |
| Secrets | Keychain / Keystore via `expo-secure-store` or `react-native-keychain` | access and refresh tokens |

- **ST1 NEVER** copy server data into a store or `useState` (no `setUser(data)` after a fetch). Read it from the query; the cache is the single source.
- **ST2 MUST** derive instead of store: totals, filtered lists and `isValid` are computed during render. NEVER sync state with `useEffect` + `setState`.
- **ST3 MUST** keep state as low in the tree as possible and lift it only when a sibling needs it.
- **ST4 NEVER** add a global store until 3+ unrelated screens read and write the same client state. Then one small store per concern, inside the feature that owns it.
- **ST5 MUST** pass IDs in navigation params, never whole objects. The next screen reads the object from the query cache.
- **ST6 MUST** keep query keys and fetchers in the feature's `api/` folder, one `queryOptions` factory per resource, never inline in screens.
- **ST7 MUST** invalidate or update the affected queries after a mutation. NEVER refresh data with manual flags or counters.
- **ST8 MUST** wire the query library to the device once, at the app root: online status (NetInfo or `expo-network` via `onlineManager`) and app focus (`AppState` via `focusManager`). Check the library's React Native docs for the installed version (A5).
- **ST9 NEVER** store tokens, PINs or personal data in AsyncStorage or unencrypted MMKV. Secrets go to Keychain / Keystore. Secure storage is not a source of truth: the server can always reissue.
- **ST10 NEVER** use floating-point arithmetic for money. Keep amounts as integers in the smallest unit (or as the API's strings) and format only for display.
- **ST11 MUST**, in an existing repo, follow its data layer (A2). If server data lives in Redux Toolkit / RTK Query, keep it there; NEVER add a second query library beside it.

```tsx
// NEVER: server data copied into state, derived value synced by effect
const [user, setUser] = useState<User>();
useEffect(() => { api.getUser(id).then(setUser); }, [id]);
const [total, setTotal] = useState(0);
useEffect(() => setTotal(items.reduce((s, i) => s + i.amount, 0)), [items]);

// MUST: read from the query, derive during render
const { data: user } = useQuery(userQueries.detail(id));
const total = items.reduce((s, i) => s + i.amount, 0);
```

## Side effects & errors

An Effect is only for syncing with something outside React; everything else belongs in render or in an event handler. Every screen survives its own failure without taking the app down.

### Side effects

- **SE1 MUST** use `useEffect` only to sync with an external system: a native module, a subscription, a timer, a device API. If nothing external is involved, there is no Effect.
- **SE2 MUST** put logic caused by a user action (submit, analytics on tap, navigate after success) in the event handler or the mutation's `onSuccess`. NEVER in an Effect that watches state.
- **SE3 NEVER** fetch data in `useEffect`; server data goes through the query library (ST1). Where a raw fetch is unavoidable, its cleanup MUST ignore stale responses.
- **SE4 MUST** return a cleanup for every listener, subscription and timer (`AppState`, `Keyboard`, NetInfo, `setInterval`).
- **SE5 NEVER** chain Effects that set state. Compute derived values in render and set all next state in one event handler.
- **SE6 MUST** reset a component's state on a prop change with a `key`, not with an Effect.
- **SE7 MUST** run app-wide setup (SDK init, crash reporting, analytics) once at the app entry, never inside a screen.
- **SE8 MUST** use the navigator's focus hook (`useFocusEffect`) for work tied to a screen being visible (in Expo Router projects, import it from expo-router, NV2). Screens in stacks and tabs stay mounted, so `useEffect` fires at the wrong time.
- **SE9 NEVER** disable `react-hooks/exhaustive-deps` or the React Compiler lint rules. A dependency loop means the logic belongs elsewhere (SE1, SE2).

### Error boundaries and error handling

- **EB1 MUST** have one root error boundary that shows a recoverable fallback (retry + a way to get help) and reports the error. Boundaries are still class components in React 19: use the router's built-in boundary or `react-error-boundary` (vetted per V1–V8), never a hand-written class per feature.
- **EB2 MUST** give every screen its own boundary, so one broken screen keeps the tab bar and header alive. Expo Router: export `ErrorBoundary` from the route file, or set a screen error boundary on the layout. React Navigation: wrap the screen component. Check the installed version's docs first (A5); some of these APIs are marked unstable.
- **EB3 SHOULD** add a boundary around a single widget only when that widget is optional (promo banner, chart). NEVER wrap every component.
- **EB4 MUST** handle errors boundaries do not catch: event handlers and async code. Use `try/catch`, the mutation's `onError`, or hand the error to the nearest boundary (`showBoundary` in `react-error-boundary`).
- **EB5 MUST** render all four states for every query: loading, error with a retry, empty, success. NEVER a blank screen or an endless spinner.
- **EB6 MUST** report errors once, centrally: the boundary's `onError` plus a global JS error handler, sent to the crash reporter the repo already uses. NEVER swallow an error (`catch {}`) or only `console.log` it.
- **EB7 NEVER** show raw error messages or stack traces to users; map errors to plain copy and keep the detail in the report. NEVER include tokens or personal data in reports.
- **EB8 MUST** make the fallback's retry reset the failed part (`retry`, `resetErrorBoundary`, or `resetKeys` tied to the route params).

```tsx
// app/transfer/[id].tsx (Expo Router): a per-screen boundary + all four query states
export function ErrorBoundary({ error, retry }: ErrorBoundaryProps) {
  report(error); // central reporter, no PII
  return <ErrorState message="Couldn't load this transfer" onRetry={retry} />;
}

export default function TransferScreen() {
  const { id } = useLocalSearchParams<{ id: string }>();
  const q = useQuery(transferQueries.detail(id));
  if (q.isPending) return <LoadingState />;
  if (q.isError) return <ErrorState onRetry={q.refetch} />;
  if (!q.data) return <EmptyState />;
  return <TransferDetail transfer={q.data} />;
}
```

## Components & styling

Screens are built from a small set of shared primitives styled only through theme tokens. The primitive set starts tiny and grows on demand.

### Components

- **C1 MUST** build UI from `shared/ui` primitives once they exist (`Text`, `Button`, `Screen`). NEVER style raw `Text` with ad-hoc fonts in a feature. `shared/ui` starts with only what the first screens use; text, buttons and the screen wrapper are the one exception to P2, since every screen needs them.
- **C2 MUST** keep one job per component. Split when a file passes ~200 lines, or when it mixes data fetching with layout: the screen fetches, children render from props.
- **C3 MUST** type every prop; NEVER `any`. Booleans read as `isX` / `hasX`, callbacks as `onX`.
- **C4 MUST** prefer composition (`children`, slots) over configuration. A component with a 4th boolean variant prop gets split (P6).
- **C5 MUST** use `Pressable`, or Gesture Handler's new Touchable component (v3) if the repo uses Gesture Handler. NEVER the legacy core or Gesture Handler `Touchable*` components in new code.
- **C6 MUST** keep every interactive element accessible: `accessibilityRole` (or the ARIA role prop, which takes precedence) on every pressable, an `accessibilityLabel` when there is no visible text, touch targets of at least 44×44 pt on iOS and 48×48 dp on Android (use `hitSlop`), and font scaling left on for body text. NEVER `allowFontScaling={false}` to fix a layout; fix the layout.
- **C7 MUST** handle insets with `react-native-safe-area-context`, never the deprecated core `SafeAreaView` or hardcoded notch padding.
- **C8 MUST** give every remote image an explicit size. Expo projects use `expo-image` (disk and memory caching, placeholders); bare projects use core `Image` until caching is a measured problem, then vet a library (V1–V8).
- **C9 NEVER** add an i18n library before a second language is planned (N3). If the repo already has one, every user-facing string goes through it.

### Styling

- **SY1 MUST** take colors, spacing, radius and typography from `shared/theme` tokens. NEVER hex values or magic numbers in feature code. The token set starts small (about 8 colors, a 4-pt spacing scale, 3–4 text styles) and grows only when a design needs a new value.
- **SY2 MUST** name tokens by role, not by value: `colors.textPrimary`, `colors.danger`, not `blue500`. This makes dark mode a token swap if product ever asks for it; NEVER build dark mode before then.
- **SY3 MUST** use `StyleSheet.create`, or the repo's styling system (A2). Where the styles live depends on size: a small component keeps them at the bottom of its own file; once the styles block passes ~40 lines or the file passes ~150 lines, they move to a sibling `ComponentName.styles.ts`. One styles file per component, never a shared feature-wide styles file. Inline styles only for values computed at runtime.
- **SY4 MUST** lay out with flexbox and `gap`. NEVER absolute positioning for page layout. Read screen size with `useWindowDimensions`, never `Dimensions.get` at module level.
- **SY5 MUST** use the platform shadow props for a simple shadow and `boxShadow` when it must look the same on iOS and Android. `boxShadow`, `filter` and `backgroundImage` are stable in current React Native but need the New Architecture and carry platform limits (inset shadows need Android 10+, `blur` and `dropShadow` filters need Android 12+), so check the installed version's notes before using them (A5). NEVER ship a prop the docs mark experimental.
- **SY6 MUST** put small platform differences in `Platform.select` inside the style. Split into `.ios.tsx` / `.android.tsx` files only when the components truly differ.

```ts
// shared/theme/tokens.ts: start this small
export const colors = {
  bg: '#FFFFFF', surface: '#F5F5F7', textPrimary: '#111111', textSecondary: '#6B6B6B',
  primary: '#0A84FF', danger: '#D93025', success: '#188038', border: '#E3E3E6',
} as const;
export const space = (n: number) => n * 4; // space(4) = 16
export const radius = { sm: 8, md: 12, full: 999 } as const;
```

## Navigation, TypeScript & API layer

Routes, types and API responses each have one typed source of truth, and everything that crosses into the app from outside (deep links, API responses) is treated as untrusted input.

### Navigation

- **NV1 MUST** keep navigation typed end to end: typed routes in Expo Router, static configuration (the setup the React Navigation docs recommend) with inferred types, or a param list when screens are dynamic. NEVER cast params with `as any`.
- **NV2 MUST**, in Expo Router projects, import navigation APIs from `expo-router`. From SDK 56, importing `@react-navigation/*` packages directly in app code is not supported.
- **NV3 MUST** pass only IDs and primitives as params (ST5) and validate them at screen entry. Params can arrive from a deep link, so they are user input.
- **NV4 MUST** make every deep-linkable screen handle a missing or invalid param by redirecting, never by crashing.
- **NV5 MUST** decide signed-in vs signed-out in one place (root layout or root navigator, using the router's protected or conditional screens). NEVER redirect per screen from a `useEffect`.
- **NV6 NEVER** call navigation from API or store code. Change state (for example, clear the session) and let NV5 route.
- **NV7 SHOULD** keep navigator nesting shallow: one stack per tab, modals at the root, at most 3 levels.

### TypeScript

- **TS1 MUST** run with `strict: true`. New projects also turn on `noUncheckedIndexedAccess`.
- **TS2 NEVER** silence the compiler with `any`, `@ts-ignore` or a non-null `!`. Use `unknown` and narrow it. `@ts-expect-error` with a reason counts as a guardrail exception.
- **TS3 MUST** derive types from one source: an API type comes from its schema (`z.infer<typeof Transfer>`), never a hand-written copy beside it.
- **TS4 SHOULD** use string-literal unions or `as const` objects instead of `enum`.
- **TS5 NEVER** import another feature's types except through its `index.ts` (S3).

### API layer

- **AP1 MUST** have one API client in `shared/lib/api` (base URL, auth header, timeout, error shape). Features call it only through fetchers in their `api/` folder. NEVER `fetch` inside a component.
- **AP2 MUST** use `fetch` unless the repo already uses another client (A2). NEVER add axios to a new project just for interceptors.
- **AP3 MUST** validate responses with a schema at the boundary for every endpoint that touches money, auth or navigation; SHOULD for the rest. Use the repo's schema library, or Zod in a new project. A failed parse is reported (EB6) and shown as the error state.
- **AP4 MUST** turn every failure into one typed error shape (`{ status, code, message }`). UI branches on `code`, never on message text.
- **AP5 MUST** set a timeout on every request and leave retries to the query library. NEVER auto-retry a non-idempotent mutation (payment, transfer); send an idempotency key if the backend supports one.
- **AP6 MUST** refresh tokens in the client only, single-flight: concurrent 401s wait for one refresh. If the refresh fails, clear the session and let NV5 route.
- **AP7 NEVER** put secrets in the app. Anything bundled, including `EXPO_PUBLIC_*` variables, is readable by users. Secret keys live on the server.
- **AP8 NEVER** log request or response bodies containing tokens or personal data, including in internal test builds.
- **AP9 NEVER** add a DTO-to-model mapper layer by default. Map in the fetcher only when the API shape and the app's needs truly differ.

```ts
// features/transfer/api/transfer.ts: schema → type → fetcher → query options
export const Transfer = z.object({ id: z.string(), amount: z.number().int(), status: z.enum(['pending', 'done', 'failed']) });
export type Transfer = z.infer<typeof Transfer>;

const getTransfer = (id: string) => api.get(`/transfers/${id}`, Transfer); // client parses with the schema

export const transferQueries = {
  detail: (id: string) => queryOptions({ queryKey: ['transfer', id], queryFn: () => getTransfer(id) }),
};
```

## Deep links & push notifications

Every way into the app from outside (a link, a notification tap, a cold start) goes through the same router path, validates its input and respects sign-in.

### Deep links

- **DL1 MUST** use universal links (iOS) and App Links (Android) on the team's https domain for links shared with people: web, email, SMS, ads. Keep the custom scheme (`myapp://`) for links from other apps and auth redirects. Both platforms need a verification file hosted on the domain; follow the installed version's linking docs (A5).
- **DL2 MUST** let the router own link handling. Expo Router maps every route to a URL automatically; React Navigation uses its linking config, which static configuration generates. NEVER parse URLs by hand with `Linking` listeners in screens.
- **DL3 MUST** map external or legacy URLs that match no route in one place: `+native-intent.tsx` with `redirectSystemPath` in Expo Router (native only, with no access to auth state or the current route), or the linking config in React Navigation.
- **DL4 MUST** treat every link param as untrusted (NV3): validate it with a schema and redirect on failure (NV4). NEVER let a link perform an action by itself (pay, transfer, delete). A link opens a screen; the user confirms the action.
- **DL5 MUST** send a signed-out user who opens a protected link through the auth gate (NV5) and then on to the original destination. NEVER drop the destination after sign-in, and NEVER show protected content before it.
- **DL6 MUST** handle both a cold start (the link launches the app) and a running app, and test both on a development or release build; Expo Go's link support is limited.
- **DL7 MUST** keep shared URLs working: when a route is renamed, the old path redirects through DL3.
- **DL8 NEVER** put tokens, personal data or secrets in link URLs; URLs end up in logs and analytics. One-time tokens (magic links, password reset) expire quickly and are exchanged with the server at once.

### Push notifications

- **PN1 MUST** use the stack's notification library: `expo-notifications` in Expo projects, or the one the repo has (A2). Test on a development build on a real device. iOS push credentials need a paid Apple Developer account; Android needs FCM V1 credentials.
- **PN2 NEVER** ask for notification permission at launch. Ask in context, after a screen explains the benefit ("Get notified when your transfer arrives"). If the user declines, the app keeps working and offers a path to Settings later. Android 13+ needs the runtime permission as well.
- **PN3 MUST** create Android notification channels by purpose (transactions, security, promotions) at startup, before any notification shows, so users can mute promotions without losing transaction alerts.
- **PN4 MUST** register the push token after sign-in, send it to the backend with the user and device, update it when it changes, and unregister it on sign-out. NEVER keep a token registered for a signed-out user.
- **PN5 MUST** route a notification tap through the deep-link path: the payload carries a URL for an existing route (`data.url`), and the app navigates with the router (DL2). Handle the tap that cold-starts the app as well as taps while it runs. NEVER write navigation code per notification type.
- **PN6 MUST** validate notification payloads like API responses (AP3). An unknown type or bad data opens a safe default screen, never a crash.
- **PN7 NEVER** put sensitive data in notification text (balances, account numbers, personal data); lock screens show it. Say "You received a transfer" and show details after unlock.
- **PN8 MUST** set the foreground display handler and the listeners once, at the app root (SE7), each with a cleanup (SE4).
- **PN9 MUST** keep notification code in one `notifications` feature (permission screen, token registration, payload parsing). When a notification means server data changed, invalidate the matching queries (ST7); NEVER copy the payload into state (ST1).

```tsx
// features/notifications/useNotificationRouting.ts, mounted once in the root layout
export function useNotificationRouting() {
  const last = Notifications.useLastNotificationResponse(); // covers the tap that cold-started the app
  useEffect(() => {
    const url = parseNotificationUrl(last?.notification.request.content.data); // schema-validated, null if bad
    if (url) router.push(url);
  }, [last]);
}
```

## Performance & animations

Measure first, in a release build, on a mid-range Android phone; fix the measured problem with the smallest change. The target is 60 FPS: 16.67 ms per frame.

### Performance

- **PF1 MUST** measure before optimizing (P4): Perf Monitor, the React Native profiler or DevTools, in a release build. NEVER judge performance in dev mode; it is much slower by design.
- **PF2 NEVER** render a long or unbounded list with `ScrollView` + `.map()`. Use `FlatList` for short lists and FlashList v2 for long or mixed-height ones (defaults table).
- **PF3 MUST** give every list a `keyExtractor` with stable IDs. With FlashList v2 also: `getItemType` for mixed item kinds, no `key` props inside `renderItem`, `useRecyclingState` for item-local state, padding in `contentContainerStyle`.
- **PF4 MUST** keep list props stable (`renderItem`, `data`, `extraData`). React Compiler does this; with the compiler off, memoizing these is the one standing exception to P4, because FlashList's docs require it.
- **PF5 NEVER** keep fast-changing state (input text, timers, scroll position) high in the tree, where every change re-renders whole screens. Keep it low (ST3); read store slices with selectors.
- **PF6 MUST** strip `console.*` from release builds (a Babel plugin or the repo's equivalent). NEVER log inside render, scroll or animation paths.
- **PF7 MUST** show touch feedback before heavy work: defer the work with `requestAnimationFrame` or until the navigation transition ends.
- **PF8 MUST** request images at display size from the server or CDN. NEVER load full-resolution photos into thumbnails.
- **PF9 MUST** protect startup: minimal work at module scope and in root providers, heavy SDKs initialized after first render when possible, and no blocking first render on non-critical requests.
- **PF10 NEVER** import a whole utility library for one function (all of lodash, moment). Use built-ins such as `Intl` and `Date` first.

### When to memoize

Memoization only pays when it lets React skip real work, and every input involved is stable. Check whether React Compiler is on first (`app.json` experiments or the Babel config), then use the matching column.

| Tool | Compiler ON | Compiler OFF: use only when |
| --- | --- | --- |
| `useMemo` | Escape hatch only: a value used as an Effect dependency that must not change identity every render | (1) the calculation measures 1 ms or more per interaction and its inputs rarely change; (2) the value is a prop of a `React.memo` component or a list (PF4); (3) the value is a dependency of another hook |
| `useCallback` | Escape hatch only: a function used as an Effect dependency, or handed to a library that re-subscribes when the reference changes | (1) the function is a prop of a `React.memo` component or a list (`renderItem`, `onEndReached`); (2) it is a dependency of another hook; (3) a listener or subscription re-attaches when it changes |
| `React.memo` | Not needed | The component is measurably expensive (list rows, charts, maps), its parent re-renders often with the same props, and every prop is stable |

- **MZ1 NEVER** memoize cheap work: string building, a `map`/`filter` over a few hundred items, values used only in the same component's JSX, or handlers passed to non-memoized components such as `Pressable`'s `onPress`.
- **MZ2 MUST** keep every input stable, or skip the memo: one inline object, array or arrow function in the props of a `React.memo` component undoes it.
- **MZ3 MUST** measure before memoizing a calculation: `console.time` around it in a release-like build, and memoize only at 1 ms or more. `useMemo` never speeds up the first render.
- **MZ4 NEVER** remove existing manual memoization while touching unrelated code, even with the compiler on; removing it can change behavior. Remove it only in its own change, with tests.
- **MZ5 NEVER** rely on `useMemo` for correctness. It is a performance hint; React may recompute. Logic that must run once belongs in state, a ref or an event handler.

```tsx
// Compiler OFF, all three cases justified
const Row = React.memo(TransactionRow);                      // list row: rendered many times, props stable
const renderItem = useCallback(({ item }) => <Row tx={item} />, []); // list prop (PF4)
const summary = useMemo(() => summarize(txs), [txs]);       // measured 3 ms on 5,000 txs

// Compiler ON, the escape hatch
const options = useMemo(() => ({ roomId }), [roomId]);      // Effect dependency must keep identity
useEffect(() => { const c = connect(options); return () => c.close(); }, [options]);
```

### Animations

- **AN1 MUST** run animations off the JS thread. With Reanimated installed: CSS transitions and animations for state-driven changes, shared values and worklets for gesture- or scroll-driven ones. Without it: core `Animated` with `useNativeDriver: true`, or `LayoutAnimation` for fire-and-forget changes. NEVER animate with `setState` per frame or `setInterval`.
- **AN2 MUST**, on Reanimated 4, install the matching `react-native-worklets` version (check the compatibility table, A5) and list `react-native-worklets/plugin` last in the Babel config. NEVER the old `react-native-reanimated/plugin` there.
- **AN3 MUST** animate `transform` and `opacity`. NEVER animate `width`, `height`, `top` or `left` to move or resize something; scale with `transform`.
- **AN4 SHOULD** build gestures with `react-native-gesture-handler` + Reanimated rather than `PanResponder`.
- **AN5 MUST** respect the OS reduce-motion setting: skip or shorten non-essential animations.
- **AN6 NEVER** add an animation library for a single effect when `Animated` or `LayoutAnimation` can do it (V1–V8).
- **AN7 SHOULD** keep UI transitions around 150–300 ms, and NEVER block input while an animation runs.

```tsx
// Reanimated 4 CSS transition: state-driven, runs off the JS thread, no shared values needed
<Animated.View
  style={{
    opacity: visible ? 1 : 0,
    transform: [{ scale: pressed ? 0.97 : 1 }],
    transitionProperty: ['opacity', 'transform'],
    transitionDuration: 200,
  }}
/>
```

## Testing, tooling & CI/CD

Test what users do, let CI check every change the same way, and never let the agent ship to users on its own.

### Testing

- **T1 MUST** test behavior through the UI with React Native Testing Library: query by role, label or text, act with `userEvent`, assert what the user sees. NEVER test internal state or private functions, and NEVER rely on whole-screen snapshots as the main test.
- **T2 MUST** spend tests where bugs cost most: unit tests for pure logic (money math, validation, formatters), functional tests for screens (user events + mocked API), E2E only for critical journeys (sign-in, payment). NEVER chase a coverage percentage.
- **T3 MUST** ship every bug fix with a test that fails before the fix, and every new screen with at least one functional test for its success state and its error state (EB5).
- **T4 MUST** mock at the network boundary, not the query hooks: render with a real query client (retries off) inside one shared test wrapper.
- **T5 MUST** use the Jest preset for the stack: `jest-expo` in Expo projects, React Native's preset in bare ones. On React Native Testing Library v14, `render`, `act`, `renderHook` and `fireEvent` are async: await them (A5).
- **T6 MUST** keep tests deterministic: fake timers, no real network, no sleeps or arbitrary waits.
- **T7 SHOULD** use Maestro for E2E flows when the level calls for it (table below); in Expo projects it runs as a job in EAS Workflows.

### Test writing conventions

**Files and names**

- **TW1 MUST** colocate tests with the code: `TransferScreen.test.tsx` beside `TransferScreen.tsx` (or the repo's `__tests__/` convention). Performance tests end in `.perf-test.tsx`. Maestro flows live in `.maestro/`, one file per journey (`sign-in.yaml`, `send-transfer.yaml`).
- **TW2 MUST** name tests by behavior in plain words: `describe('TransferScreen')`, `it('shows an error with a retry button when loading fails')`. NEVER `it('works')` or names that repeat the implementation.
- **TW3 MUST** write one behavior per test in Arrange → Act → Assert order. NEVER `if` or loops inside a test; use `it.each` for variations.
- **TW4 MUST** query in this order: `getByRole` → `getByLabelText` → `getByText` → `getByTestId`. A `testID` is the last resort, or for Maestro flows. A screen that is hard to query by role usually has an accessibility bug (C6).
- **TW5 MUST** share setup through one `test/render.tsx` (providers + a fresh query client) and typed factories in `test/factories/` (`buildTransfer({ status: 'failed' })`). NEVER paste large JSON fixtures into tests.

**Unit tests**

- **UT1 MUST** unit-test pure logic: money math, formatters, validation schemas, reducers, and hooks with real logic. Cover the edges with `it.each`: 0, negative, maximum, rounding, empty input.
- **UT2 NEVER** unit-test a component's internals; components are covered by functional tests.
- **UT3 MUST** keep unit tests free of network, timers and native modules, so the whole unit suite stays fast enough to run on every save.

**Functional tests**

- **FT1 MUST** give every screen a functional test (Jest + React Native Testing Library): render it with providers and a mocked API, drive it with `userEvent`, assert what the user sees. Cover success, error, empty and the main action (submit, retry).
- **FT2 MUST** mock only the edges: network responses and native modules (`jest-expo` mocks the Expo SDK). Keep real components, real hooks and a real query client; use the router's testing utilities where they exist (A5). In Expo Router that is `renderRouter` from `expo-router/testing-library`, which needs React Native Testing Library v14 or later. Route tests NEVER go inside `app/`, because every file there becomes a route; put them beside the feature screen or in `__tests__/`.
- **FT3 MUST** write Maestro E2E flows for critical journeys only, run against a release-like build, selecting elements by accessibility label or `testID`. Each flow starts from a clean state and does not depend on another flow.

### Tooling

- **TL1 MUST** pass on every change: type check (`tsc --noEmit`), lint, tests, and `npx expo-doctor` in Expo projects. New projects lint with `--max-warnings 0`.
- **TL2 MUST** format with Prettier, on touched files only (P7).
- **TL3 MUST** pin the Node version (`.nvmrc` or `engines`) at or above the React Native minimum; React Native 0.84+ needs Node 22.
- **TL4 MUST** commit the lockfile and use one package manager. NEVER mix npm, Yarn, pnpm and Bun in one repo.
- **TL5 MUST** upgrade React Native or the Expo SDK in its own change, with no feature work mixed in, using the Upgrade Helper or `npx expo install --fix`.

### CI checks

Every check runs on every PR at its level and fails the build on its own; the agent runs the Starter checks locally before reporting done (D1).

| Check | Tool | Fails the build when | Level |
| --- | --- | --- | --- |
| Types | `tsc --noEmit` | Any type error | Starter |
| Lint | ESLint or `npx expo lint`, `--max-warnings 0` in new projects | Any error, or any warning in new projects | Starter |
| Circular dependencies | `dpdm -T --exit-code circular:1` on the app entry, or `madge --circular --extensions ts,tsx src/`, or Oxlint `import/no-cycle` | Any import cycle | Starter |
| Project health | `npx expo-doctor` (Expo projects) | Any failed check | Starter |
| Unit and functional tests | Jest + React Native Testing Library | Any failure | Starter |
| Render performance | Reassure, comparing the PR against `main` in the same CI run | A statistically significant slowdown or extra renders beyond the budget | Growing |
| Bundle size | Production export measured against `main` (Expo Atlas to inspect) | Growth beyond the budget with no note in the PR | Growing |
| Device performance | Flashlight on a release Android build, critical journeys | Score drops below the stored baseline | Scale |
| E2E | Maestro (EAS Workflows job in Expo projects) | Any failed flow | Scale |

- **CI1 NEVER** introduce an import cycle. The usual cause is a barrel file: inside a feature, import siblings directly, never through the feature's own `index.ts`; `index.ts` is only for other features (S3). Type-only imports (`import type`) are excluded from the cycle check.
- **CI2 MUST** add a Reassure test (`.perf-test.tsx`) for list rows, heavy screens and anything a PR claims to make faster. Compare against `main` on the same CI machine, never against numbers from another machine.
- **CI3 MUST** keep budgets (bundle size, render time, device score) in the repo's config. Going over a budget needs a guardrail exception with the reason (D2), never a silently raised budget.
- **CI4 NEVER** hide a flaky test with automatic retries. Quarantine it with a linked issue and fix it within the sprint.

### Builds and releases

- **R1 MUST** build anything for testers or stores in CI (EAS Build / Workflows or the repo's CI), never on a laptop.
- **R2 MUST** ship JavaScript-only changes as over-the-air updates and native changes as new builds: an update can only change the JS layer of the build it targets. Set a runtime version policy; `fingerprint` is the safer default because it changes whenever native code changes.
- **R3 NEVER** push an over-the-air update to all users at once: go through a preview channel, roll out in stages, and keep the previous update ready to roll back.
- **R4 NEVER** commit secrets, signing keys or keystores. They live in the CI or EAS secret store.
- **R5 MUST** let CI bump version and build numbers, never by hand.
- **R6 NEVER**, as an agent, start a production build, publish an update or submit to a store without the human's explicit approval in that conversation.

| Level | CI on every PR | Releases |
| --- | --- | --- |
| Starter | Types, lint, circular dependencies, project health, unit and functional tests | Manual store release from a CI build |
| Growing | + render performance, bundle size, preview build per PR | + OTA updates through a preview channel |
| Scale | + device performance, Maestro E2E on critical journeys | + staged rollouts, release owner, CODEOWNERS |

## Anti-patterns & scale triggers

These are the over-engineering moves agents make most often, and the conditions under which a heavier pattern becomes worth it. If a pattern's trigger has not happened, the pattern does not go in.

### Red flags

| Red flag | Do instead | Rule |
| --- | --- | --- |
| A `utils/`, `helpers/` or `common/` folder full of one-use functions | Keep the function in the feature that uses it | P2, P3 |
| A generic component with many boolean props (`variant`, `isCompact`, `showBadge`…) | Compose with slots, or split | C4, P6 |
| Server data copied into Redux, Zustand or `useState` | Read it from the query cache | ST1 |
| `useEffect` that sets state from other state or props | Derive in render, or handle in the event | ST2, SE5 |
| `useMemo` / `useCallback` / `React.memo` on everything | Follow the memoization table | P4, MZ1 |
| A DTO-to-model mapper for every endpoint | Use the API type until shapes truly differ | AP9 |
| A global store added "for later" | `useState`, then Context, then a store at the ST4 trigger | ST4 |
| Libraries installed before any feature needs them | Add each with the first feature that needs it | N3, A3 |
| Empty folders and placeholder files for future features | Create folders when code goes in them | N4 |
| A new library beside one that does the same job | Use the one already in the repo | A2 |
| A wrapper around a library "in case we swap it" | Call the library directly; wrap only at the 3rd duplicated setup | P1, P2 |
| Repo-wide refactors or reformatting inside a feature task | Separate change, asked for | P7, S6 |
| Silencing errors with `any`, `@ts-ignore` or `catch {}` | Fix the type or handle the error | TS2, EB6 |

### Scale triggers

| Pattern | Add it only when | Rule |
| --- | --- | --- |
| Global client store (Zustand) | 3+ unrelated screens read and write the same client state | ST4 |
| Form library | A form has 5+ fields or cross-field rules | State table |
| Shared component in `shared/ui` | The 3rd real use, or a primitive every screen needs | P2, C1 |
| Styles in a separate file | Styles block over ~40 lines or file over ~150 lines | SY3 |
| Splitting a component | File over ~200 lines, or fetching mixed with layout | C2 |
| FlashList v2 | A long or mixed-height list, or measured dropped frames | Defaults table |
| Image caching library (bare) | Caching is a measured problem | C8 |
| i18n library | A second language is planned | C9 |
| Dark mode | Product asks for it | SY2 |
| Import boundary lint rules | 4+ devs, or a cross-feature break happened | Structure levels |
| CODEOWNERS, `shared/` owned by a core team | 10+ devs or several squads | Structure levels |
| Monorepo / workspaces | A second app or web target needs the same code | S7 |
| E2E tests (Maestro) | Growing to Scale level, on critical journeys | T7 |
| Staged OTA rollouts | OTA updates are in use | R3 |

The agent applies the current level and suggests the next one when a trigger shows, with the evidence (for example: "3 screens now share cart state: `CartScreen`, `CheckoutScreen`, `ProductScreen`"). It NEVER moves up a level on its own.

## PR checklist

The agent runs this list before reporting a change as done, and pastes the result into the PR description. Any unchecked item is either fixed or listed as a guardrail exception with its reason (D2).

**Scope**

- [ ] Does only what the task asked; no speculative props, options or layers (P1)
- [ ] No refactor or reformat of untouched code (P7)
- [ ] Plan posted first if more than 5 files changed (A4)

**Structure**

- [ ] New code lives in its feature folder; nothing domain-specific added to `shared/` (S1, P6)
- [ ] No imports of another feature's internals (S3)
- [ ] No new abstraction with fewer than 3 real uses (P2)

**Dependencies**

- [ ] No new dependency, or one approved by the human with the vetting table (A3, V1–V8)
- [ ] APIs used were checked against the installed version's docs (A5)

**State, effects, data**

- [ ] Server data read from the query cache, not copied into state (ST1)
- [ ] No `useEffect` that only derives or reacts to user actions (SE1, SE2)
- [ ] Memoization only where the table allows (P4, MZ1–MZ5)
- [ ] No secrets, tokens or personal data in storage, logs or the bundle (ST9, AP7, AP8)

**UI**

- [ ] Loading, error, empty and success states for every query (EB5)
- [ ] Screen has an error boundary (EB2)
- [ ] Tokens only, no hex values or magic numbers (SY1)
- [ ] Pressables have roles and labels; font scaling left on (C6)
- [ ] Links and notification taps go through the router, with params validated (DL2, DL4, PN5)
- [ ] Notification permission asked in context; no sensitive data in notification text (PN2, PN7)

**Checks**

- [ ] Type check, lint and tests pass, and the commands run are listed (D1, TL1)
- [ ] New screen or bug fix has its test (T3)
- [ ] Native change? New build planned instead of an OTA update (R2)
- [ ] Nothing shipped to users without explicit approval (R6)
- [ ] No new import cycle; no feature imports its own `index.ts` (CI1)
- [ ] Tests follow the naming, query and factory conventions (TW1–TW5)
- [ ] Perf test added for list rows, heavy screens or claimed speed-ups; budgets not exceeded (CI2, CI3)

**Report**

- [ ] Assumptions listed (D2)
- [ ] Every guardrail exception listed with its rule ID and reason (D2)
- [ ] Next scale trigger noted if one showed up (Anti-patterns & scale triggers)