Skip to content

init — Project Initialization

  • Trigger: /init or keywords "initialize project", "create CLAUDE.md"
  • Best for: Onboarding projects to Claude Code, documenting existing projects
  • Not for: Updating existing CLAUDE.md (edit directly)

Overview

init analyzes the current project and generates a CLAUDE.md file — the core entry point for Claude Code to understand your project. It covers architecture, tech stack, conventions, and key file paths.

Trigger Conditions

init auto-triggers when you:

  • Mention "initialize", "init project"
  • Want to onboard a new project to Claude Code
  • Use the /init command

Examples

Example 1: Initialize New Project

/init

Claude scans the project and generates a CLAUDE.md:

markdown
# Project Name

## Architecture
- Monorepo with pnpm workspaces
- Frontend: React + TypeScript
- Backend: Node.js + Express

## Key Directories
- `packages/web/` — Frontend app
- `packages/api/` — Backend API
- `packages/shared/` — Shared types and utils

## Conventions
- Use functional components, no class components
- API routes follow RESTful conventions
- Tests colocated with source files

Example 2: Specify Tech Stack

/init This is a Next.js 14 + Prisma + PostgreSQL project using App Router

Example 3: Python Project

/init FastAPI backend project using SQLAlchemy + Alembic

CLAUDE.md Content

SectionDescription
ArchitectureProject architecture overview
Tech StackTechnologies and versions
Key DirectoriesCore directory descriptions
ConventionsCode conventions and standards
CommandsCommon commands (build, test, deploy)
GotchasPitfalls and exceptions to note

Notes

  • CLAUDE.md should be concise — it's not a README replacement
  • Avoid overly detailed API docs — Claude can learn from the code
  • Conventions and gotchas are the most valuable parts — teach Claude what's counterintuitive
  • Review and edit the initial generation for accuracy
  • init won't overwrite an existing CLAUDE.md