/init Command
Generates an initial CLAUDE.md file by analyzing the current project's codebase — package.json, tsconfig, directory structure, and code patterns. Produces a starting point that must be reviewed and augmented with team conventions not visible in code.
Syntax
claude-code
// Run inside an interactive Claude Code session:
/init
// Or as a one-shot command:
claude -p "Analyze this project and create a comprehensive CLAUDE.md with tech stack, conventions, project structure, commands, and constraints based on what you observe."Example
claude-code
// Start a session in project root:
claude
// Generate the file:
/init
// Claude Code reads package.json, tsconfig.json, src/ structure...
// Writes CLAUDE.md to project root
// Review and edit the generated file:
// - Confirm the tech stack is accurate
// - Add conventions not visible from code
// - Add frozen file/directory rules
// - Add the correct test and build commands