# Agent Guidelines for Documenso ## Build/Test/Lint Commands - `npm run build` - Build all packages - `npm run lint` - Lint all packages - `npm run lint:fix` - Auto-fix linting issues - `npm run test:e2e` - Run E2E tests with Playwright - `CI=true npm run test:dev -w @documenso/app-tests -- e2e/path/to/file.spec.ts` - Run a single E2E test against a running dev server - `npm run test-ui:dev -w @documenso/app-tests` - Run E2E tests with UI - `npm run format` - Format code with Biome - `npm run dev` - Start development server for the React Router app (`apps/remix`) **Important:** Do not run `npm run build` to verify changes unless explicitly asked. Builds take a long time (~2 minutes). Use `npm run typecheck -w @documenso/remix` for the app (it runs `react-router typegen` first) or `npx tsc --noEmit` inside other packages. **Important:** Always set `CI=true` when running Playwright. Without it the browser runs headfully. ## Code Style Guidelines - Use TypeScript for all code; prefer `type` over `interface` - Use functional components with `const Component = () => {}` - Never use classes; prefer functional/declarative patterns - Use descriptive variable names with auxiliary verbs (isLoading, hasError) - Directory names: lowercase with dashes (auth-wizard) - Use named exports for components - Never use 1-line if statements - Structure files: exported component, subcomponents, helpers, static content, types ## Error Handling & Validation - Use custom AppError class when throwing errors - When catching errors on the frontend use `const error = AppError.parse(error)` to get the error code - Use early returns and guard clauses - Use Zod for form validation and react-hook-form for forms - Use error boundaries for unexpected errors ## UI & Styling - Use Shadcn UI, Radix, and Tailwind CSS with mobile-first approach - Use `