agentleFS
LedgerHQLedgerHQ/ledger-live/.agents/skills/react-general/SKILL.md

react-general

Skill627 starsChanged 7 days agoMITView on GitHub

General React and React Native engineering rules for Ledger Live. Read when writing or reviewing any .ts/.tsx file.

The file

Show its rules and text

We split this skill into the rules it gives an agent

18 rules. About 0 are common, 11 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Keep components focused and reasonably sized.

    line 13
  2. Distinctive:

    Use composition for extensibility.

    line 15
  3. Very specific:

    Use RTK Query (with slices) only when necessary for app-wide state.

    line 20
  4. Very specific:

    Mobile: use Lumen UI React Native — see ldls-native.

    line 26
  5. Very specific:

    Desktop: use Lumen UI React — see ldls-web.

    line 27
  6. Distinctive:

    All styles must support theme switching (dark/light mode).

    line 28
  7. Distinctive:

    Use lazy loading for large screens or modules.

    line 36
  8. Distinctive:

    Mobile: use React Navigation; ensure correct deep-link support.

    line 40
  9. Distinctive:

    Desktop: use React Router; implement route guards when necessary.

    line 41
  10. Very specific:

    Use RTK Query hooks from a domain/api package.

    line 45
  11. Distinctive:

    Use consistent loading, retry, and error states.

    line 46
  12. Distinctive:

    Prefer optimistic UI when appropriate.

    line 47
  13. Distinctive:

    Desktop: use semantic HTML tags; implement full keyboard navigation.

    line 53
  14. Very specific:

    React Native: use Platform.select for small iOS/Android variations inside a .native file.

    line 64
  15. Distinctive:

    Desktop: use environment flags for Electron/Web differences.

    line 65
  16. Very specific:

    Mobile: use the native driver whenever feasible.

    line 69
  17. Distinctive:

    Desktop: use CSS transitions for lightweight animations.

    line 70
  18. Very specific:

    Keep translation keys descriptive and structured.

    line 76

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill 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
SKILL.md

General React & React Native Patterns

These rules apply to all files, including those inside src/mvvm/. See mvvm-architecture for MVVM-specific structure.

Component Architecture

  • Prefer functional components.
  • Keep components focused and reasonably sized.
  • Decompose large UI into smaller reusable elements.
  • Use composition for extensibility.

State Management

  • Prioritize local state for UI-only concerns.
  • Use RTK Query (with slices) only when necessary for app-wide state. See domain-data.
  • Apply optimized selectors to limit re-rendering.
  • Connect Redux at the lowest component level when possible.

Styling

  • Mobile: use Lumen UI React Native — see ldls-native.
  • Desktop: use Lumen UI React — see ldls-web.
  • All styles must support theme switching (dark/light mode).

Performance

  • Memoize expensive operations with useMemo.
  • Stabilize callbacks with useCallback.
  • Wrap costly components in React.memo.
  • Apply list virtualization where needed.
  • Use lazy loading for large screens or modules.

Navigation

  • Mobile: use React Navigation; ensure correct deep-link support; keep navigation types strict.
  • Desktop: use React Router; implement route guards when necessary; maintain clear history logic.

Data Fetching

  • Use RTK Query hooks from a domain/api package. See domain-data.
  • Use consistent loading, retry, and error states.
  • Prefer optimistic UI when appropriate.
  • Apply caching and stale-time strategies.

Accessibility

  • Mobile: provide accessible labels for all interactive elements; support screen reader flows; ensure proper focus transitions.
  • Desktop: use semantic HTML tags; implement full keyboard navigation; apply meaningful ARIA attributes when required.

Error Boundaries

  • Wrap critical areas in error boundaries.
  • Report errors to monitoring services.
  • Provide clean, user-friendly fallback UIs.

Platform-Specific Code

  • Web vs native (packages under features/, shared/, domain/): split by file suffix, X.web.tsx for desktop and X.native.tsx for mobile, and import the unsuffixed ./X. The moduleSuffixes in support/tsconfig/web.json and support/tsconfig/native.json pick the right file. Both files take one props contract: the X.types.ts contract in universal-components.
  • React Native: use Platform.select for small iOS/Android variations inside a .native file; ensure behavior parity across iOS and Android.
  • Desktop: use environment flags for Electron/Web differences; keep platform abstraction consistent.

Animations

  • Mobile: use the native driver whenever feasible; prefer Animated and layout animations for performance.
  • Desktop: use CSS transitions for lightweight animations; use Framer Motion for complex animations; respect reduced-motion system preferences.

Internationalization (i18n)

  • In features/, domain/ and shared/, import useTranslation and Trans from @shared/i18n, never from react-i18next. The app mounts its I18nProvider once; see shared/i18n/README.md.
  • In apps/*, keep using react-i18next.
  • Keep translation keys descriptive and structured; features own their keys (see i18n-keys).
  • Support pluralization, gender, and variable interpolation.
  • Validate components across multiple locales.

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.