---
allowed-tools: Bash(echo:*), Bash(cut:*), Bash(grep:*), Bash(find:*), Bash(cat:*), Bash(date:*), Bash(tr:*), Bash(head:*), Bash(tail:*), Read, Write
description: Generate atomic development issues following C.I.D.E.R. methodology
---

# 🎯 C.I.D.E.R. Issue Generation

**Generate atomic development issues following C.I.D.E.R. methodology**

**Usage**: `/project:cider:generate EPIC-NAME "description"`

**Arguments**: `$ARGUMENTS`

---

## What This Command Does

Transforms epic descriptions into **atomic, actionable development issues** using the C.I.D.E.R. methodology:

- **C**ontextualizar: Understand current project state
- **I**terar: Plan approach and break into tasks  
- **D**ocumentar: Create specifications and requirements
- **E**jecutar: Define implementation steps
- **R**eflexionar: Plan testing and validation

---

## 📋 Parsing Arguments

!echo "🎯 C.I.D.E.R. Issue Generation"
!echo "Arguments provided: $ARGUMENTS"

!EPIC_NAME=$(echo "$ARGUMENTS" | cut -d' ' -f1)
!DESCRIPTION=$(echo "$ARGUMENTS" | cut -d'"' -f2)

!echo "📌 Epic: $EPIC_NAME"
!echo "📝 Description: $DESCRIPTION"

---

## 🔍 CONTEXTUALIZAR (Understanding Current State)

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

### Active Epic Status
@.claude/current/active-epic.md

### Available Epics
@.claude/epics/epics-roadmap.md

### Recent Analysis
!find analysis/reports/ -name "*executive-summary.md" -o -name "*reconocimiento.md" | head -3

---

## 🎯 ISSUE ANALYSIS & GENERATION

Based on the current project state and your request, let me generate a comprehensive atomic issue.

### Epic Validation
Let me check if the epic `$EPIC_NAME` exists in our roadmap:

!grep -i "$EPIC_NAME" .claude/epics/epics-roadmap.md || echo "⚠️ Epic not found in roadmap - will create new epic category"

### Issue Context Analysis
Understanding the scope and requirements for: **$DESCRIPTION**

This issue falls under the **$EPIC_NAME** epic. Let me analyze:

1. **Technical Scope**: What components will be affected?
2. **Dependencies**: What needs to be in place first?
3. **Complexity**: How long should this take? (2-8 hours target)
4. **Deliverables**: What files/features will be created?
5. **Testing**: How will we validate success?

### Atomic Issue Generation

Based on C.I.D.E.R. methodology, here's your atomic issue:

---

## 📊 GENERATED ISSUE

!ISSUE_NUMBER=$(date +%s | tail -c 4)
!ISSUE_FILE=".claude/epics/issue-$ISSUE_NUMBER-$(echo "$DESCRIPTION" | tr ' ' '-' | head -c 20).md"

!cat > "$ISSUE_FILE" << EOF
# Issue #$ISSUE_NUMBER: $DESCRIPTION

**Epic**: $EPIC_NAME  
**Created**: $(date +%Y-%m-%d)  
**Estimated Time**: 2-6 hours  
**Status**: 📋 TODO  

---

## 📝 DESCRIPTION
$DESCRIPTION

## 🎯 OBJECTIVES
- [ ] Objective 1: [Specific, measurable goal]
- [ ] Objective 2: [Specific, measurable goal]  
- [ ] Objective 3: [Specific, measurable goal]

## 📋 TASKS BREAKDOWN
### Phase 1: Setup & Planning (30 min)
- [ ] Research existing implementations
- [ ] Plan architecture approach
- [ ] Identify dependencies

### Phase 2: Implementation (2-4 hours)
- [ ] Core functionality implementation
- [ ] Integration with existing systems
- [ ] Error handling and edge cases

### Phase 3: Testing & Documentation (1-2 hours)
- [ ] Unit tests for new functionality
- [ ] Integration testing
- [ ] Update documentation

## 🧪 ACCEPTANCE CRITERIA
- **Criterion 1**: [Specific, testable requirement]
- **Criterion 2**: [Specific, testable requirement]
- **Criterion 3**: [Specific, testable requirement]

## 🛠️ TECHNICAL REQUIREMENTS
- **Environment**: [Development environment specifics]
- **Dependencies**: [Required packages/tools]
- **Integration Points**: [Systems that need to work together]

## 📁 FILES TO MODIFY/CREATE
- [ ] \`path/to/file1.js\` - [Purpose]
- [ ] \`path/to/file2.md\` - [Purpose]
- [ ] \`tests/file1.test.js\` - [Purpose]

## 🧭 IMPLEMENTATION APPROACH
1. **Step 1**: [Specific implementation step]
2. **Step 2**: [Specific implementation step]
3. **Step 3**: [Specific implementation step]

## 🔄 C.I.D.E.R. WORKFLOW
### Contextualizar
- [X] Issue created with full context
- [ ] Development environment prepared
- [ ] Dependencies verified

### Iterar  
- [ ] Implementation plan refined
- [ ] Tasks prioritized
- [ ] Timeline confirmed

### Documentar
- [ ] Code changes documented
- [ ] Architecture decisions recorded
- [ ] API documentation updated

### Ejecutar
- [ ] Core functionality implemented
- [ ] Tests written and passing
- [ ] Integration completed

### Reflexionar
- [ ] Code review completed
- [ ] Performance validated
- [ ] Next steps identified

## 🚀 GETTING STARTED
To work on this issue, run:
\`\`\`bash
/project:cider:work $ISSUE_NUMBER [scope]
\`\`\`

## 📊 DEFINITION OF DONE
- [ ] All acceptance criteria met
- [ ] Code reviewed and approved
- [ ] Tests written and passing
- [ ] Documentation updated
- [ ] Deployed to appropriate environment

---
*Generated by Claude C.I.D.E.R. system*
EOF

!echo "✅ Issue #$ISSUE_NUMBER created: $ISSUE_FILE"

---

## 📈 EPIC STATUS UPDATE

### Update Active Epic
!cat > .claude/current/active-epic.md << EOF
# Active Epic: $EPIC_NAME

## Current Status
🔄 **ACTIVE** - Working on issue generation

## Epic Objectives
Work related to: $EPIC_NAME

## Active Issues
- **Issue #$ISSUE_NUMBER**: $DESCRIPTION
  - Status: 📋 TODO
  - Created: $(date +%Y-%m-%d)
  - Estimated: 2-6 hours

## Recent Activity
- $(date +%Y-%m-%d): Generated issue #$ISSUE_NUMBER for "$DESCRIPTION"

## Next Steps
1. Review generated issue: \`$ISSUE_FILE\`
2. Start implementation: \`/project:cider:work $ISSUE_NUMBER [scope]\`
3. Follow C.I.D.E.R. methodology for execution

## Commands
\`\`\`bash
# Work on this issue
/project:cider:work $ISSUE_NUMBER frontend

# Check epic status  
/project:cider:status

# List all epics
/project:cider:list-epics
\`\`\`
EOF

### Update Project State
!echo "" >> .claude/current/project-state.md
!echo "## Recent Activity" >> .claude/current/project-state.md
!echo "- $(date +%Y-%m-%d): Generated issue #$ISSUE_NUMBER for $EPIC_NAME: \"$DESCRIPTION\"" >> .claude/current/project-state.md

---

## 🎉 Issue Generation Complete!

### ✅ **Generated**:
- **Issue #$ISSUE_NUMBER**: Comprehensive atomic issue with C.I.D.E.R. workflow
- **Epic Update**: $EPIC_NAME now active with this issue
- **Project State**: Updated with recent activity

### 📁 **Files Created**:
- `$ISSUE_FILE` - Complete issue specification
- Updated `.claude/current/active-epic.md`
- Updated `.claude/current/project-state.md`

### 🚀 **Next Steps**:
1. **Review Issue**: Open `$ISSUE_FILE` to review the generated issue
2. **Start Work**: Use `/project:cider:work $ISSUE_NUMBER [scope]` to begin implementation
3. **Track Progress**: Follow C.I.D.E.R. methodology checkboxes

### 💡 **Workflow Tips**:
- **Atomic Focus**: This issue is designed to be completable in 2-6 hours
- **Clear Acceptance**: Well-defined criteria for success
- **Structured Approach**: C.I.D.E.R. methodology ensures quality execution

**Your atomic issue is ready for implementation!**