|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This is **WebPerf Snippets** - a curated collection of web performance measurement JavaScript snippets designed for use in browser consoles or Chrome DevTools. The project is a documentation website built with Next.js and Nextra, serving as a comprehensive resource for web performance analysis tools. |
| 8 | + |
| 9 | +## Architecture |
| 10 | + |
| 11 | +### Technology Stack |
| 12 | +- **Framework**: Next.js 13+ with Nextra (documentation theme) |
| 13 | +- **Theme**: nextra-theme-docs for documentation layout |
| 14 | +- **Media**: Cloudinary integration via next-cloudinary for optimized images/videos |
| 15 | +- **Deployment**: Configured for Vercel |
| 16 | + |
| 17 | +### Project Structure |
| 18 | +- `pages/` - MDX documentation files organized by performance categories: |
| 19 | + - `CoreWebVitals/` - LCP, CLS, and related metrics |
| 20 | + - `Loading/` - Resource loading, TTFB, scripts, fonts analysis |
| 21 | + - `Interaction/` - User interaction and animation frame metrics |
| 22 | +- `_meta.json` files - Define navigation structure and page titles |
| 23 | +- `theme.config.jsx` - Nextra theme configuration with custom branding |
| 24 | +- `next.config.js` - Next.js configuration with Nextra integration and redirects |
| 25 | + |
| 26 | +### Content Organization |
| 27 | +The documentation follows a hierarchical structure where: |
| 28 | +- Each category has its own directory under `pages/` |
| 29 | +- Individual snippets are documented in `.mdx` files with code examples |
| 30 | +- Navigation is controlled via `_meta.json` files in each directory |
| 31 | +- All snippets are JavaScript code meant for browser execution |
| 32 | + |
| 33 | +## Development Commands |
| 34 | + |
| 35 | +### Build & Development |
| 36 | +```bash |
| 37 | +# Build the project |
| 38 | +npm run build |
| 39 | + |
| 40 | +# No dev server command defined - check with maintainer |
| 41 | +# Note: Standard Next.js commands likely work (npm run dev) |
| 42 | +``` |
| 43 | + |
| 44 | +### Testing |
| 45 | +```bash |
| 46 | +# No tests configured |
| 47 | +npm test # Will show error message |
| 48 | +``` |
| 49 | + |
| 50 | +## Key Files to Understand |
| 51 | + |
| 52 | +- `theme.config.jsx` - Contains site branding, meta tags, and navigation configuration |
| 53 | +- `pages/_app.js` - Next.js app wrapper |
| 54 | +- `pages/index.mdx` - Homepage with project introduction and video |
| 55 | +- Individual snippet files contain executable JavaScript with explanations |
| 56 | + |
| 57 | +## Content Guidelines |
| 58 | + |
| 59 | +When working with snippet documentation: |
| 60 | +- Each snippet should include clear explanations and usage instructions |
| 61 | +- Code blocks use the `copy` prop for easy copying to DevTools |
| 62 | +- Snippets are designed for Chrome DevTools console execution |
| 63 | +- Focus on web performance metrics (Core Web Vitals, loading, interactions) |
| 64 | +- Include performance measurement context and interpretation guidance |
| 65 | + |
| 66 | +## Navigation Structure |
| 67 | + |
| 68 | +The site uses Nextra's file-system based routing with `_meta.json` files controlling: |
| 69 | +- Page order in navigation |
| 70 | +- Display titles |
| 71 | +- Category organization |
| 72 | + |
| 73 | +Content is organized around web performance measurement topics, making it easy for developers to find relevant performance analysis tools. |
0 commit comments