Project Initialization for Claude Code
Goal
Produce a lean, high-signal CLAUDE.md (under 200 lines) and minimal supporting .claude/ structure so Claude Code has accurate, project-specific guidance from the first message of every session. Success = CLAUDE.md written, user has reviewed and approved it, and any quick-win suggestions are surfaced.
Dependencies
- Tools: Read, Write, Edit, Bash, Glob, Grep
- No external services or MCP servers required
- CLI: none required beyond standard shell
Context
- Reads existing project files to extract real conventions — never invents them
- Reference for what belongs in CLAUDE.md vs what to omit is encoded in Step 2 below
- Works for any language/framework; adapt commands and structure to what's found
Set up or optimize a project to work effectively with Claude Code. This creates a lean, high-signal CLAUDE.md and supporting structure.
Process
Step 1: Assess the Project
- Read existing CLAUDE.md, README.md, package.json, Makefile, pyproject.toml, or similar
- Identify: language, framework, build system, test runner, linter
- Check for existing
.claude/ directory, skills, agents, settings
- Look for Cursor rules (
.cursor/rules/), Copilot rules (.github/copilot-instructions.md)
Step 2: Create CLAUDE.md
Write a CLAUDE.md following these rules:
MUST include:
- Project purpose (1 line)
- Build, test, lint commands (exact commands, not descriptions)
- Architecture overview (only what requires reading multiple files to understand)
- Non-obvious conventions and gotchas
- Hard rules (NEVER/ALWAYS items specific to this project)
MUST NOT include:
- Generic development practices Claude already knows
- File-by-file descriptions discoverable by reading code
- Long explanations or tutorials
- Obvious instructions ("write clean code", "add error handling")
- API documentation (link to it with
@path imports instead)
Format rules:
- Target under 200 lines (under 100 is better)
- Use markdown headers and bullets
- Use emphasis for critical rules: "IMPORTANT:", "NEVER:", "ALWAYS:"
- Use
@path/to/file.md imports for detailed docs
Step 3: Create Supporting Structure
Only create what's needed:
.claude/
├── settings.json # Only if permissions or hooks needed
├── skills/ # Only if reusable workflows identified
├── agents/ # Only if specialized roles needed
└── rules/ # Only if path-specific rules needed
Rules files (.claude/rules/) - create when:
- Different conventions apply to different directories
- Frontend vs backend have different patterns
- Test files need different rules than source files
Format:
paths:
- "src/api/**/*.ts"
Rules content here...
Step 3 Checkpoint
CHECKPOINT: Before writing any files, present the proposed CLAUDE.md content to the user. Explain any non-obvious choices (why something was included or omitted). Do NOT write files until the user approves.
Ask: "Here's the proposed CLAUDE.md. Want me to write it as-is, adjust anything, or take a different approach?"
Step 4: Suggest Quick Wins
Based on the project, suggest:
- 1-2 hooks that would help (auto-format, safety checks)
- 1-2 skills worth creating (deploy, review, etc.)
- Permission allowlist entries for common commands
- Whether subagents would help (monorepo, large codebase)
CHECKPOINT: After writing the file, confirm with the user that the setup is complete and ask if they want any of the suggested quick wins implemented now.
Output
- Primary deliverable:
CLAUDE.md at the project root (or specified path)
- Optional:
.claude/settings.json, .claude/rules/*.md files if needed
- Format: Markdown, under 200 lines
- Save location: Project root (or
$ARGUMENTS path if provided)
- Present content for review before writing; do not overwrite an existing CLAUDE.md without explicit user confirmation
1---2name: project-init3description: Initialize or optimize a project for Claude Code. Use when setting up a new project, onboarding to an existing codebase, or when the user says "set up Claude Code", "create CLAUDE.md", "bootstrap", or "optimize this project for Claude".4---56# Project Initialization for Claude Code78## Goal9Produce a lean, high-signal CLAUDE.md (under 200 lines) and minimal supporting `.claude/` structure so Claude Code has accurate, project-specific guidance from the first message of every session. Success = CLAUDE.md written, user has reviewed and approved it, and any quick-win suggestions are surfaced.1011## Dependencies12- Tools: Read, Write, Edit, Bash, Glob, Grep13- No external services or MCP servers required14- CLI: none required beyond standard shell1516## Context17- Reads existing project files to extract real conventions — never invents them18- Reference for what belongs in CLAUDE.md vs what to omit is encoded in Step 2 below19- Works for any language/framework; adapt commands and structure to what's found2021Set up or optimize a project to work effectively with Claude Code. This creates a lean, high-signal CLAUDE.md and supporting structure.2223## Process2425### Step 1: Assess the Project26- Read existing CLAUDE.md, README.md, package.json, Makefile, pyproject.toml, or similar27- Identify: language, framework, build system, test runner, linter28- Check for existing `.claude/` directory, skills, agents, settings29- Look for Cursor rules (`.cursor/rules/`), Copilot rules (`.github/copilot-instructions.md`)3031### Step 2: Create CLAUDE.md32Write a CLAUDE.md following these rules:3334**MUST include:**35- Project purpose (1 line)36- Build, test, lint commands (exact commands, not descriptions)37- Architecture overview (only what requires reading multiple files to understand)38- Non-obvious conventions and gotchas39- Hard rules (NEVER/ALWAYS items specific to this project)4041**MUST NOT include:**42- Generic development practices Claude already knows43- File-by-file descriptions discoverable by reading code44- Long explanations or tutorials45- Obvious instructions ("write clean code", "add error handling")46- API documentation (link to it with `@path` imports instead)4748**Format rules:**49- Target under 200 lines (under 100 is better)50- Use markdown headers and bullets51- Use emphasis for critical rules: "IMPORTANT:", "NEVER:", "ALWAYS:"52- Use `@path/to/file.md` imports for detailed docs5354### Step 3: Create Supporting Structure55Only create what's needed:5657```58.claude/59├── settings.json # Only if permissions or hooks needed60├── skills/ # Only if reusable workflows identified61├── agents/ # Only if specialized roles needed62└── rules/ # Only if path-specific rules needed63```6465**Rules files** (`.claude/rules/`) - create when:66- Different conventions apply to different directories67- Frontend vs backend have different patterns68- Test files need different rules than source files6970Format:71```yaml72paths:73 - "src/api/**/*.ts"7475Rules content here...76```7778### Step 3 Checkpoint7980**CHECKPOINT:** Before writing any files, present the proposed CLAUDE.md content to the user. Explain any non-obvious choices (why something was included or omitted). Do NOT write files until the user approves.81Ask: "Here's the proposed CLAUDE.md. Want me to write it as-is, adjust anything, or take a different approach?"8283### Step 4: Suggest Quick Wins84Based on the project, suggest:85- 1-2 hooks that would help (auto-format, safety checks)86- 1-2 skills worth creating (deploy, review, etc.)87- Permission allowlist entries for common commands88- Whether subagents would help (monorepo, large codebase)8990**CHECKPOINT:** After writing the file, confirm with the user that the setup is complete and ask if they want any of the suggested quick wins implemented now.9192## Output93- **Primary deliverable:** `CLAUDE.md` at the project root (or specified path)94- **Optional:** `.claude/settings.json`, `.claude/rules/*.md` files if needed95- **Format:** Markdown, under 200 lines96- **Save location:** Project root (or `$ARGUMENTS` path if provided)97- Present content for review before writing; do not overwrite an existing CLAUDE.md without explicit user confirmation