Initialize CLAUDE.md with Ultrathink
Usage
/init-ultrathink [optional context about the project]
Context
- Project context: $ARGUMENTS
- This command creates a comprehensive CLAUDE.md file by analyzing the repository with multiple specialized agents
Your Role
You are the Coordinator Agent orchestrating specialized sub-agents to create a comprehensive CLAUDE.md file that will guide Claude in understanding and working with this codebase.
Sub-Agents
- Repository Analyst Agent - Analyzes project structure, tech stack, and patterns
- Context Gatherer Agent - Identifies key abstractions, workflows, and conventions
- Documentation Agent - Extracts insights from existing docs and comments
- Testing Agent - Analyzes test patterns and quality standards
- Git History Analyst Agent - Examines repository evolution and historical patterns
Process
Phase 1: Repository Analysis
-
Project Structure Analysis
- Identify project type (web app, CLI tool, library, etc.)
- Map complete directory structure with annotations
- Detect all build tools, task runners, and package managers
- Identify entry points and initialization sequences
-
Tech Stack Detection
- Programming languages and versions
- Frameworks and libraries with version constraints
- Development tools, linters, formatters
- Database systems and external services
-
Architecture Patterns
- Design patterns in use
- Code organization principles
- Data flow and state management
- Security layers and authentication flows
Phase 2: Context Discovery
-
Coding Conventions
- Naming conventions for all entities
- Code style guides (find .prettierrc, .eslintrc, etc.)
- Import/export patterns
- Error handling philosophy
-
Development Workflows
- Git workflow: branch naming, commit conventions, PR process
- Local development setup
- Testing procedures
- Deployment and release processes
-
Key Abstractions
- Core domain models
- Common utilities and shared code
- Reusable components
- Service boundaries and API contracts
Phase 3: Documentation Mining
-
Existing Documentation
- README files at every level
- API documentation
- Architecture decision records (ADRs)
- Inline code comments
-
Implicit Knowledge
- Complex algorithms explanations
- Performance optimizations
- Known issues and workarounds
- Historical context for design decisions
Phase 4: Quality Standards
-
Testing Patterns
- Test frameworks
- Coverage requirements
- Mocking strategies
-
Quality Gates
- Linting and type checking
- Pre-commit hooks
- CI/CD pipeline stages
Phase 5: Git History Analysis
-
Repository Evolution
- Major milestones and releases
- Technology migrations
- Refactoring patterns
-
Commit Patterns
- Commit message conventions
- Code ownership patterns
- Hot spots (frequently changed files)
Output Format
Generate a CLAUDE.md adapted to the project type with these core sections:
- Repository Overview - What the project is and does
- Quick Start - How to get up and running
- Essential Commands - Most important commands
- Architecture/Key Concepts - Core understanding needed
- Project Structure - Directory layout
- Important Patterns - Key conventions to follow
- Code Style - Naming and formatting standards
- Hidden Context - Non-obvious but crucial info
Final Steps
- Show the generated CLAUDE.md for review
- Make any requested adjustments
- Save the file to the repository root
- Remind user to commit the file when satisfied
Notes
- Be comprehensive - this document is for an AI agent
- Include ALL discovered patterns and workflows
- Make commands copy-pasteable
- Provide specific file paths whenever possible
- Document workarounds and technical debt honestly