# 🚀 Generate CLAUDE.md with Complete Methodology

**Generate a comprehensive CLAUDE.md file that includes all development methodologies**

**Usage**: `/init:claude`

---

## What This Command Does

Creates a comprehensive CLAUDE.md file that includes:
- **Complete Git Workflow** from `.claude/guides/git-workflow.md`
- **C.I.D.E.R. Development Methodology** from `.claude/guides/development-methodology.md`
- **Project Structure** and organization
- **Available Commands** and usage
- **Epic Management** approach

This ensures that `claude init` (Claude IDE native command) has access to all your development methodologies and workflows.

---

## 📋 Pre-flight Checks

### Verify Project Setup
!if [ ! -d ".claude" ]; then
    echo "❌ ERROR: .claude directory not found!"
    echo "💡 Please run 'claudio init' first to set up your project"
    exit 1
fi

### Check Required Files
!echo "🔍 Checking required files..."
!if [ -f ".claude/guides/git-workflow.md" ]; then
    echo "✅ Git workflow guide found"
else
    echo "⚠️ Git workflow guide missing"
fi

!if [ -f ".claude/guides/development-methodology.md" ]; then
    echo "✅ Development methodology found"
else
    echo "⚠️ Development methodology missing"
fi

### Project Information
!echo "📁 Project: $(basename $(pwd))"
!echo "📅 Generated: $(date +%Y-%m-%d)"

---

## 📝 Generating CLAUDE.md

### Reading Methodology Files
!echo "📖 Loading methodology files..."

### Git Workflow Content
@.claude/guides/git-workflow.md

### Development Methodology Content
@.claude/guides/development-methodology.md

### Current Project State
@.claude/current/project-state.md

### Epic Roadmap
@.claude/epics/epics-roadmap.md

---

## 🎯 Creating Comprehensive CLAUDE.md

!cat > CLAUDE.md << 'EOF'
# CLAUDE.md - AI Development Assistant Configuration

Generated by HeyClaudio on $(date +%Y-%m-%d)

## 🎯 Project Overview

**Project**: $(basename $(pwd))  
**Technology Stack**: [Auto-detected from package.json, requirements.txt, etc.]  
**Development Methodology**: C.I.D.E.R. Protocol  
**Git Workflow**: Feature Branch Strategy  

---

## 🚀 Development Methodology

### C.I.D.E.R. Protocol
Every development session follows this structured approach:

#### 1. **C**ontextualizar (Contextualize)
- Read `.claude/current/active-epic.md`
- Read `.claude/current/project-state.md`
- Review `.claude/current/next-session.md`
- Understand current state and objectives

#### 2. **I**terar (Iterate)
- Plan specific tasks for this session
- Break down work into small, manageable steps
- Set clear session objectives

#### 3. **D**ocumentar (Document)
- Create session file in `.claude/sessions/YYYY-MM/`
- Document decisions and changes as they happen
- Update relevant epic and project state files

#### 4. **E**jecutar (Execute)
- Implement planned changes
- Test incrementally
- Commit regularly with descriptive messages

#### 5. **R**eflexionar (Reflect)
- Update `.claude/current/project-state.md`
- Update epic progress in `.claude/current/active-epic.md`
- Plan next session in `.claude/current/next-session.md`
- Create session summary

---

## 🔧 Git Workflow

### Branch Strategy
- `main`: Production-ready code
- `develop`: Integration branch for features
- `feature/epic-xxx-description`: Feature branches for epics
- `fix/issue-xxx-description`: Bug fix branches

### Commit Message Format
```
[TYPE](scope): description

Epic: #epic-number
Issue: #issue-number
```

#### Commit Types
- `feat`: New feature
- `fix`: Bug fix
- `docs`: Documentation changes
- `refactor`: Code refactoring
- `test`: Adding tests
- `chore`: Maintenance tasks

### Development Workflow
1. Create feature branch from develop
2. Work on epic/issue
3. Commit regularly with descriptive messages
4. Push branch and create pull request
5. Code review and merge

### Git Commands Reference
```bash
# Start new epic
git checkout develop
git pull origin develop
git checkout -b feature/epic-001-authentication

# Work and commit
git add .
git commit -m "feat(auth): implement user login component

Epic: #1
Issue: #123"

# Push and create PR
git push origin feature/epic-001-authentication
```

---

## 📋 Project Structure

```
.claude/
├── commands/          # Custom slash commands
├── current/           # Active project state
│   ├── project-state.md
│   ├── active-epic.md
│   └── next-session.md
├── epics/             # Epic management
├── guides/            # Development guides
├── sessions/          # Session history
└── templates/         # Reusable templates
```

---

## 🎯 Epic Management

### Active Epics
Check `.claude/epics/epics-roadmap.md` for complete list.

### Working with Epics
1. Choose epic based on priorities and dependencies
2. Break into atomic issues (2-8 hours each)
3. Update status regularly
4. Document completion criteria

---

## 🚀 Available Commands

### Analysis Commands
- `/radar:analyze` - Complete project analysis
- `/radar:quick` - Quick project overview

### Issue Management
- `/cider:generate EPIC "description"` - Generate atomic issue
- `/cider:work ISSUE_NUMBER` - Work on specific issue
- `/cider:status` - Check project status
- `/cider:list-epics` - List available epics

### Initialization
- `/init:claude` - Generate this CLAUDE.md file

---

## 📊 Session Workflow

### Session Start (5 min)
1. Read current documentation
2. Set session objectives
3. Create session file

### Development (30-90 min)
1. Implement planned features
2. Document decisions and changes
3. Test incrementally

### Session End (10 min)
1. Update all relevant documentation
2. Plan next session
3. Commit and push changes

---

## 🔍 File Update Rules

### Always update after significant changes:
- `.claude/current/project-state.md`
- `.claude/current/active-epic.md`

### Create new for each session:
- `.claude/sessions/YYYY-MM/YYYYMMDD_HHMM_description.md`

### Update as needed:
- `.claude/current/next-session.md`
- `.claude/epics/epic-xxx-name.md`

---

## 🎨 Quality Standards

- All code changes must pass tests
- Document architectural decisions
- Maintain consistent code style
- Update relevant documentation
- Follow git workflow strictly

---

## 🚀 Getting Started

1. **Review this file** to understand the project methodology
2. **Check current state**: `.claude/current/project-state.md`
3. **Choose an epic**: `/cider:list-epics`
4. **Generate issue**: `/cider:generate EPIC "description"`
5. **Start work**: `/cider:work ISSUE_NUMBER`

---

## 📝 Important Notes

- **Session Discipline**: Always follow C.I.D.E.R. protocol
- **Documentation First**: Document decisions before implementing
- **Atomic Commits**: Small, focused commits with clear messages
- **Regular Updates**: Keep project state current
- **Test Everything**: Ensure quality with comprehensive testing

---

*This CLAUDE.md was generated by HeyClaudio to ensure all development methodologies are preserved for AI-assisted development.*
EOF

!echo "✅ CLAUDE.md generated successfully!"

---

## 📋 Integrating Methodology Content

### Append Git Workflow Details
!echo "" >> CLAUDE.md
!echo "## 📚 Detailed Git Workflow Guide" >> CLAUDE.md
!echo "" >> CLAUDE.md
!cat .claude/guides/git-workflow.md >> CLAUDE.md 2>/dev/null || echo "Git workflow guide not found"

### Append Development Methodology Details
!echo "" >> CLAUDE.md
!echo "## 📚 Detailed C.I.D.E.R. Methodology" >> CLAUDE.md
!echo "" >> CLAUDE.md
!cat .claude/guides/development-methodology.md >> CLAUDE.md 2>/dev/null || echo "Development methodology not found"

---

## ✅ CLAUDE.md Generation Complete!

### Generated File
- **Location**: `CLAUDE.md` in project root
- **Size**: Comprehensive document with all methodologies
- **Purpose**: Ensures Claude IDE has access to complete development workflow

### What's Included
✅ **Git Workflow**: Complete branch strategy and commit conventions  
✅ **C.I.D.E.R. Protocol**: Full development methodology  
✅ **Project Structure**: Directory organization and file purposes  
✅ **Command Reference**: All available slash commands  
✅ **Quality Standards**: Development best practices  

### Next Steps
1. **Review CLAUDE.md**: Ensure all information is accurate
2. **Run `claude init`**: Claude IDE will now have access to full methodology
3. **Start Development**: Follow the structured workflow

### Why This Matters
When you run `claude init` in Claude IDE, it will now have access to:
- Your complete git workflow methodology
- C.I.D.E.R. development protocol
- Project-specific conventions
- All available commands and their usage

**Your development methodology is now fully preserved!** 🎉