This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Never push directly to
main - Always create a feature branch for changes
- After committing changes, push to the feature branch
- If no pull request exists for the feature branch, open a PR from the feature branch to
main
- DRY (Don't Repeat Yourself): Extract shared logic into reusable functions or components
- SRP (Single Responsibility Principle): Each module/function should do one thing well
- YAGNI (You Aren't Gonna Need It): Only implement what's needed now, not speculative features
- OCP (Open/Closed Principle): Code should be open for extension but closed for modification
pnpm install # Install dependencies
pnpm dev # Run development server (localhost:3000)
pnpm build # Build for production (runs contentlayer2 build first)
pnpm start # Start production server
pnpm lint # Run ESLintThis is a Next.js 16 blog using the App Router with MDX content managed by Contentlayer2.
- Blog posts are MDX files in
content/blog/ - Contentlayer2 processes MDX files at build time (
contentlayer.config.ts) - Generated types and data are imported from
contentlayer/generated - The
Postdocument type defines required fields:title,date,description - Posts with
published: falseare filtered from display
- MDX Rendering:
components/mdx-components.tsxprovides component overrides for MDX content usinguseMDXComponenthook fromnext-contentlayer2/hooks - Post Fetching: Import
allPostsfromcontentlayer/generated- it's an array of typed Post objects - Slug Resolution: Computed from file path in contentlayer config (e.g.,
content/blog/my-post.mdxbecomes slugmy-post) - Theming: Uses
next-themeswith ThemeProvider in root layout - Styling: Tailwind CSS with
@/lib/utilsforcn()class merging utility
Required fields:
title: stringdate: date (YYYY-MM-DD)description: string (for SEO/previews)
Optional fields:
image: string (cover image URL)author: stringtags: string[]published: boolean (defaults to true)
@/maps to project root (configured in tsconfig.json)