# AGENTS.md Guide for agentic coding assistants working in the Officer monorepo. ## Quick Start Commands ### Development ```bash bun dev # Dashboard + API server (port 5000) bun dev:tracking # Tracking server (port 5001) bun dev:experiments # Experiments server bun dev:emailer # Emailer workspace ``` ### Building & Database ```bash bun run prebuild # Run prebuild tasks bun run build:dashboard # Build dashboard bun run build:editor # Build editor (app + extension + runtime) bun run build:runtime # Build all runtime scripts bun run db:gen && db:push # Generate & push officer_db migrations bun run db:gen:stats && db:push:stats # Generate & push statistics_db ``` ### Code Quality ```bash bun format # Format all files (Prettier, required before commit) bun format:check # Check formatting without writing bunx tsgo # TypeScript type checking (comprehensive, slow) ``` **Note:** No automated tests configured yet. Always run `bun format` before committing. ## Code Style Guide ### Imports Order: **types → external → workspace → relative** ```ts import type { Experiment } from 'types'; import { useState } from 'react'; import { useQuery } from '@tanstack/react-query'; import { useExperiment } from 'hooks/use-experiment'; import { formatDate } from '../helpers'; ``` ### TypeScript - Strict mode always - no `any` - Prefer `type` over `interface` - Colocate prop types with components as named exports - Early returns for null/undefined guards - Use optional chaining and nullish coalescing: `obj?.prop ?? fallback` ### Functions - Arrow functions for simple/one-liners - Regular functions for complex multi-line logic - Named exports only (never default exports) ```ts export const formatDate = (ts: number) => new Date(ts).toLocaleDateString(); export function calculateStats(data: DataPoint[]) { /* ... */ } ``` ### React Components - Functional components with named prop types - Arrow function syntax - No useMemo/useCallback (React 19 compiler handles optimization) ```tsx type CardProps = { title: string; onClick: () => void }; export const Card = ({ title, onClick }: CardProps) =>