Auto-loaded by OpenAI Codex, Claude Code, and compatible AI agents. This is the root of a hierarchy — read the relevant per-app file before working in that workspace.
| File | Scope |
|---|---|
AGENTS.md (this file) |
Monorepo-wide rules |
apps/frontend/AGENTS.md |
Frontend: design system, Sonar, testing |
apps/backend/AGENTS.md |
Backend: Express, validation, services |
apps/mobileAppYC/AGENTS.md |
Mobile: React Native, Redux, navigation |
packages/AGENTS.md |
Shared packages: types, fhirtypes |
Claude Code users: same rules also structured as skills in .claude/skills/.
- Tooling:
pnpmworkspaces +turbo. Package manager:pnpm@8.15.6— never usenpmoryarn. - Workspaces:
apps/frontend,apps/backend,apps/mobileAppYC,apps/dev-docs,packages/types,packages/fhirtypes,packages/fhir. - Architecture baseline (scale, domain model, platform directions):
.claude/skills/monorepo-ops/project-baseline.md.
- Make the smallest safe change for the request.
- Keep code, tests, and docs in sync.
- For any behavior or contract change, update/add targeted tests in the same batch.
- Before every checkpoint, run and report lint + typecheck + targeted tests for each touched workspace.
- When resuming interrupted work, inspect
git statusfirst — preserve all uncommitted changes unless the user explicitly says otherwise. - NEVER run
git commityourself. After every logical batch, tell the user: "COMMIT CHECKPOINT — suggested message:<conventional commit message>" - Never run the full test suite without
--testPathPattern— takes 100+ seconds, forbidden. - Never commit secrets, tokens, private keys, or
.envvalues. - Never add co-author lines or signatures to commit messages.
- Let all pre-commit hooks pass naturally —
--no-verifyis forbidden. - TypeScript check timeout:
npx tsc --noemitcan take 60–120s on this repo. Set a 120s timeout. If it times out, tell the user explicitly — never silently skip it. - Tests for touched files: Before each COMMIT CHECKPOINT, check
src/app/__tests__/for a matching test file. If one exists, run it and fix any failures. If you add a new component/hook/function, write tests (≥ 90% coverage) in the same batch. Report results — never fabricate or omit them.
Conventional commits enforced by commitlint:
<type>(<scope>): <subject>
Types: feat | fix | chore | refactor | test | docs | style | perf | ci
Scopes: backend | frontend | mobile | dev-docs | types | fhirtypes | repo | ci | docs
For cross-workspace changes use repo. PR title must match the same pattern.
Frontend (apps/frontend):
npx tsc --noemit # from apps/frontend/
pnpm --filter frontend run lint
pnpm --filter frontend run test -- --testPathPattern="<YourFile>"Mobile (apps/mobileAppYC):
npx tsc --noemit # from apps/mobileAppYC/
pnpm --filter mobileAppYC run lint
pnpm --filter mobileAppYC run test -- --testPathPattern="<YourFile>"Coverage bar for any new file: Statements ≥ 90%, Branches ≥ 90%, Functions ≥ 90%.
| What you add | Required test |
|---|---|
| Service function / API call | Jest unit: success + all error branches |
| Zustand store / Redux slice | Jest: every action, selector, edge case |
| Custom hook | renderHook covering all return values and branches |
| Utility / lib function | Jest unit with full branch coverage |
| UI component (frontend) | RTL render + at least one interaction test |
| Screen (mobile) | Jest + Testing Library render test |
| E2E-critical flow | Playwright (frontend) or Detox (mobile) |
- Prefer strict typing; avoid
anyunless unavoidable. - Keep PRs focused and reversible.
- Never expose backend enums or acronyms in user-facing text (e.g.
PAYMENT_AT_CLINIC,VET). Map to plain language before rendering. - Do not use
Actoras a UI label — preferLead,Support, orUpdated by. - For frontend Sonar compliance:
apps/frontend/AGENTS.mdand.claude/skills/frontend-sonar/SKILL.mdare the source of truth.
- Base SHA:
git merge-base HEAD upstream/dev. - Draft from actual file diffs, not commit titles.
- Group changed files by domain; include Merck explicitly if
apps/mobileAppYC/src/features/merck/or backend Merck paths changed. - Templates:
.github/ISSUE_TEMPLATE/feature_request.mdand.github/PULL_REQUEST_TEMPLATE.md. - Output to
.tmp/agent-output/latest-issue-pr.md(gitignored, ephemeral).
- Treat all credentials as sensitive and non-committable.
- Prefer secure defaults and explicit validation at boundaries.
- Do not fabricate command output, test results, or external facts.