Skip to Content
ConventionsOverview

Conventions

This section is the single source of truth for all coding conventions in RNCopilot. Every contributor, AI agent, and tool must follow these rules exactly. When in doubt, look at an existing file in the codebase and match its patterns.

These conventions are also available in the repository as CONVENTIONS.md. The docs here mirror that file and provide additional examples.

Why Conventions Matter

RNCopilot is designed to be maintained by both humans and AI agents. Consistent conventions mean:

  • AI agents produce correct code on the first try — they follow the same patterns every time.
  • Code reviews are faster — reviewers check logic, not formatting.
  • Onboarding is instant — new contributors read one page and know how to write code that fits.

Convention Areas

PageWhat It Covers
Naming ConventionsFile names, component names, hooks, stores, constants, and type imports
File OrganizationPath aliases, import order, barrel files, and directory structure
Styling RulesThe three laws of styling, variants API, responsive helpers, and theme tokens
State Management RulesReact Query for server state, Zustand for client state, selectors, and auth
i18n RulesTranslation requirements, locale files, dot notation keys, and RTL
TestingTest location, patterns, tooling, and coverage targets
Git WorkflowCommit format, branch naming, and pre-commit checks

The Non-Negotiables

These rules apply everywhere in the codebase without exception:

  1. No any types. Use unknown and narrow, or define a proper type.
  2. No inline styles. All styles go in StyleSheet.create.
  3. No color literals. All colors come from theme.colors.*.
  4. No hardcoded UI text. Every user-facing string goes through useTranslation().
  5. No default exports in src/. Named exports only. (Exception: screen files in app/ must use default exports for expo-router.)
  6. Always use path aliases. Never use relative paths that climb more than one level.
  7. Always use selectors with Zustand. Never subscribe to the whole store.
Last updated on