# Endgame Claude Workflows

A comprehensive workflow system for AI-native development using Claude Code's custom slash commands, sub-agents, and templates. Features a validation framework with phase gates to ensure quality at every step.

## Installation

Install the Endgame Claude Workflows into any project with a single command:

```bash
npx @endgame-build/claude-workflows
```

Or install globally:

```bash
npm install -g @endgame-build/claude-workflows
endgame-claude-workflows
```

## What's Included

This package installs a complete workflow system for Claude Code:

- **🎯 Commands** - Custom slash commands for every development phase
- **🤖 Agents** - Specialized AI agents for specific tasks
- **✅ Validators** - Quality assurance agents that ensure standards are met
- **📝 Templates** - Structured output formats for consistency
- **📁 Workflow State** - Organized tracking of development progress
- **🚦 Phase Gates** - Approval checkpoints between workflow stages
- **📊 Visual Progress** - Unicode progress bars for status tracking

## Workflows

### 🔵 Feature Development
Complete flow from idea to tested implementation with validation at each step:
```
/eg:define → validate → approve → /eg:architect → validate → approve → 
/eg:plan → validate → approve → /eg:implement → validate → /eg:test
```

### 🔴 Bug Fix
Focused debugging and resolution with root cause confirmation:
```
/eg:debug → confirm → /eg:implement → validate → /eg:test
```

### 🟢 Improvement
Refactoring and enhancements with architectural validation:
```
/eg:architect → validate → approve → /eg:implement → validate → /eg:test
```

## Quick Start

1. Install the workflows:
   ```bash
   npx @endgame-build/claude-workflows
   ```

2. Start a new feature:
   ```
   /eg:define auth-system "User authentication with email/password"
   ```

3. Continue through the workflow:
   ```
   /eg:architect auth-system @.eg/auth-system/feature-definition.md
   /eg:plan auth-system @.eg/auth-system/architecture.md
   /eg:implement auth-system @.eg/auth-system/plan.md
   /eg:test auth-system "Authentication flows"
   ```

4. Report issues with automatic type detection:
   ```
   /eg:issue "Login fails when 2FA is enabled"
   /eg:issue "Would be nice to have dark mode support"
   /eg:issue "Dashboard queries are slow with large datasets"
   ```

## Quality Assurance Framework

The eg workflow system includes built-in quality validation at every step:

### Validation Agents
- **📋 Definition Validator** - Ensures feature specs are complete and clear
- **🏗️ Architecture Validator** - Reviews technical designs for soundness
- **📝 Plan Validator** - Enforces atomic task criteria (15-30 min tasks)
- **✅ Implementation Validator** - Verifies code meets requirements

### Phase Gates
Each major workflow step requires explicit approval before proceeding:
- "The feature definition has been validated. Proceed to architecture? (yes/no)"
- "The architecture is ready. Proceed to planning? (yes/no)"
- "The plan has X atomic tasks. Proceed to implementation? (yes/no)"

### Atomic Task Management
All implementation tasks must meet 7 criteria:
1. **Max 3 files** - Focus on small, manageable changes
2. **15-30 minutes** - Completable in a single session
3. **Single outcome** - One clear, testable result
4. **Specific paths** - Exact file locations provided
5. **Clear dependencies** - Prerequisite tasks identified
6. **Success criteria** - Unambiguous completion definition
7. **No ambiguity** - Zero room for interpretation

## Available Commands

### Workflow Commands
- `/eg:define` - Create feature specifications with validation
- `/eg:architect` - Design technical solutions with review
- `/eg:plan` - Break down into atomic tasks (15-30 min each)
- `/eg:implement` - Execute with continuous validation
- `/eg:test` - Generate comprehensive tests with results template
- `/eg:debug` - Systematic debugging with root cause confirmation
- `/eg:fix` - Quick targeted fixes

### Utility Commands
- `/eg:analyze` - Deep code analysis with structured reports
- `/eg:review` - Thorough code review with actionable feedback
- `/eg:commit` - Smart commit messages
- `/eg:pr` - Create pull requests
- `/eg:summary` - Summarize changes using templates
- `/eg:issue` - Report issues with smart type detection (bug/feature/improvement)

### Configuration Commands
- `/eg:customize-templates` - Adapt templates to your project
- `/eg:analyze-project` - Create project profile
- `/eg:customize-agents` - Make agents project-aware
- `/eg:status` - View workflows with visual progress bars
- `/eg:learn` - Extract successful patterns

## File Structure

After installation, your project will have:

```
your-project/
├── .claude/
│   ├── commands/eg/     # Workflow commands
│   ├── agents/eg/       # AI agents
│   └── templates/       # Output templates
├── .eg/                 # Workflow state
└── CLAUDE.workflows.md   # Full documentation
```

## Producer/Reviewer/Validator Pattern

Each workflow stage uses specialized agents:
- **Producers** create content (specs, code, tests)
- **Reviewers** validate quality and completeness
- **Validators** ensure standards are met before progression

This three-layer approach ensures high-quality output at every step.

## Visual Progress Tracking

The `/eg:status` command provides comprehensive visual feedback:

```
📦 FEATURE DEVELOPMENT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📂 auth-system
  📋 Definition    ████████████ 100% ✅
  🏗️  Architecture  ████████████ 100% ✅
  📝 Planning      ████████████ 100% ✅
  ⚙️  Implementation ███████░░░░░  65% 🔄
     Tasks: 7/11 complete
  🧪 Testing       ░░░░░░░░░░░░   0% ⏳
```

Track multiple workflows, see progress percentages, and identify next actions at a glance.

## Documentation

For detailed information about all commands, agents, and workflows, see `CLAUDE.workflows.md` after installation.

## License

MIT

## Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

---

Built for developers who want structured, repeatable AI-assisted development workflows.