|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Build Commands |
| 6 | +- `npm run dev` - Start development server |
| 7 | +- `npm run build` - Build for production |
| 8 | +- `npm run start` - Start production server |
| 9 | +- `npm run lint` - Run linting with ESLint |
| 10 | +- `npm test` - Run Playwright tests |
| 11 | +- `npm run test:ui` - Run tests with Playwright UI |
| 12 | +- `npm run test:debug` - Run tests in debug mode |
| 13 | +- `npm run test:visual` - Run visual regression tests |
| 14 | +- Testing: Use `/api/test` endpoint in development mode only (accessible via Test Controls button) |
| 15 | + |
| 16 | +## Development Approach |
| 17 | +- Use Test-Driven Development (TDD) when implementing new features |
| 18 | +- Write tests first, ensure they fail, then implement the feature |
| 19 | +- Use Playwright for visual regression and integration testing |
| 20 | +- Add data-testid attributes to elements for reliable test selection |
| 21 | +- For API changes, use the test endpoint or create simple test scripts |
| 22 | +- Verify changes work in both development and production builds |
| 23 | + |
| 24 | +## Code Style Guidelines |
| 25 | +- TypeScript: Strict mode with strictNullChecks enabled |
| 26 | +- ESLint: Extends Next.js core-web-vitals and TypeScript configs |
| 27 | +- Imports: Use absolute imports with `@/` prefix for src directory |
| 28 | +- Components: Use functional React components with TypeScript types |
| 29 | +- Error handling: Use try/catch with specific error types when possible |
| 30 | +- Naming: PascalCase for components, camelCase for functions/variables |
| 31 | +- Styling: Use Tailwind CSS with custom theme extensions |
| 32 | +- State management: Use React hooks (useState, useEffect) |
| 33 | + |
| 34 | +## Copyright Headers |
| 35 | +All source files must include the following copyright header: |
| 36 | +``` |
| 37 | +/* |
| 38 | + * Copyright The OpenTelemetry Authors |
| 39 | + * SPDX-License-Identifier: Apache-2.0 |
| 40 | + */ |
| 41 | +``` |
| 42 | + |
| 43 | +## Project Structure |
| 44 | +- `/src/app` - Next.js app router pages and API routes |
| 45 | +- `/src/components` - React components |
| 46 | +- `/src/lib` - Utility functions and shared code |
| 47 | +- `/src/types` - TypeScript type definitions |
| 48 | + |
| 49 | +## PR Guidelines |
| 50 | +- Each PR should address a single issue |
| 51 | +- Reference the issue number in the PR description with "Closes #X" |
| 52 | +- All linting must pass (`npm run lint`) |
| 53 | +- Make sure all copyright headers are present |
| 54 | +- Keep changes focused and minimal |
0 commit comments