Section 10

Anti-patterns & scale triggers

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.