# AGENTS.md Guidelines for AI coding agents working in this repository. ## Build & Development Commands ```bash pnpm dev # Development server (binds to 0.0.0.0) pnpm build # Production build pnpm check-types # Type checking pnpm lint # Lint entire codebase pnpm lint path/to/file.tsx # Lint a single file pnpm db:generate # Generate migration files pnpm db:migrate # Apply migrations ``` No test suite exists. Validate changes via `pnpm typecheck` and `pnpm lint`. ## Code Style ### Formatting (Biome) - **Line width:** 80 characters - **Indentation:** 2 spaces (no tabs) - **Quotes:** Double quotes, no JSX single quotes - **Trailing commas:** ES5 style - **Semicolons:** Required - **Tailwind:** Classes auto-sorted via `biome --write --unsafe` ### Import Organization ```typescript // 1. React/Next.js core import { useState } from "react"; // 2. External libraries import { eq, desc } from "drizzle-orm"; // 3. Internal modules using @/ alias import { db } from "@/lib/db"; import Button from "@/components/ui/button"; ``` - Always use `@/` path aliases (never relative `../../`) - Use `type` keyword for type-only imports: `import type { Foo } from "bar"` ### TypeScript - **Strict mode** enabled - no implicit any, strict null checks - **Explicit return types** for API routes and server actions - **Zod** for runtime validation - share schemas between client and server - Avoid `any` - use `unknown` with type guards when necessary - Use `as const` for immutable config objects ### Naming Conventions | Element | Convention | Example | | ------------------- | ------------------------ | ---------------------------- | | Files | kebab-case | `contact-form.tsx` | | Components | PascalCase | `ContactForm` | | Functions/Variables | camelCase | `getComments`, `isPending` | | Types/Interfaces | PascalCase | `CommentWithUser` | | Constants | camelCase or UPPER_SNAKE | `siteConfig`, `DATABASE_URL` | ### Component Patterns **Prefer Server Components** - Only add `"use client"` when necessary for: - Event handlers (onClick, onChange, onSubmit) - React hooks (useState, useEffect, useTransition) - Browser-only APIs **Component structure:** - Arrow function components with default exports - Props destructured in parameters - Use `cn()` from `@/lib/utils` for className merging - Follow shadcn/ui patterns for UI components ```typescript const Button = ({ className, variant, ...rest }: React.ComponentProps<"button"> & VariantProps) => { return