diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 06d3a72b..d7fd3baa 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -50,6 +50,12 @@ your-project/ └── ... your code # maybe nothing else yet if a fresh new folder ``` +**For Claude Code users**, the installer also sets up: +- **BMAD Guide skill** (`~/.claude/skills/bmad-guide.md`) - Helps Claude stay on track with BMAD methodology + - Access with `/bmad-guide` command + - Provides phase navigation, workflow selection, and process guidance + - Automatically prevents common mistakes like skipping phases or manual implementation + ## Next Steps 1. **Read the [Quick Start Guide](../modules/bmm/quick-start.md)** to build your first feature diff --git a/resources/skills/README.md b/resources/skills/README.md new file mode 100644 index 00000000..6e61d896 --- /dev/null +++ b/resources/skills/README.md @@ -0,0 +1,146 @@ +# BMAD Guide Skill + +This directory contains the **BMAD Guide Skill** for Claude Code - a comprehensive reference that helps Claude stay on track with BMAD methodology. + +## What's Included + +- **bmad-guide.md** - The skill file that provides process navigation and workflow selection guidance + +## Automatic Installation + +When you run `npx bmad-method install` and select Claude Code as your IDE, this skill is **automatically installed** to `~/.claude/skills/bmad-guide.md`. + +This means Claude will have access to the `/bmad-guide` skill in any project, helping it: +- Navigate BMAD phases correctly +- Choose the right workflow for each task +- Avoid common mistakes (jumping to coding, skipping phases, etc.) +- Follow proper story lifecycle +- Self-correct when going off track + +## What the Skill Does + +The bmad-guide skill acts as Claude's "GPS" for BMAD methodology: + +### 📍 Phase Navigation +Quick reference for identifying current phase and what workflows are available + +### 🎯 Project Level Detection +Helps determine project complexity (Level 0-4) to route to correct planning track + +### 🔍 Workflow Decision Tree +Visual guide for choosing which workflow to use for any given task + +### ⚠️ Common Mistakes Prevention +Clear DO/DON'T lists to avoid derailment from BMAD process + +### 📚 Quick Reference +"I need to..." → workflow mapping table for fast lookup + +### 💡 Troubleshooting +Solutions for common issues like "I'm not sure which phase I'm in" + +### 🚨 Emergency Recovery +Course correction steps when Claude has gone off track + +## How It Works + +### Automatic Invocation +When combined with the proper CLAUDE.md configuration (see below), Claude will **automatically invoke** this skill: +- Before starting any task in BMAD projects +- When uncertain about which workflow to use +- Before implementing features manually +- When switching phases +- When detecting red flags (coding without workflows, etc.) + +### Manual Invocation +You can also invoke it manually anytime: +```bash +/bmad-guide +``` + +## CLAUDE.md Configuration (Optional but Recommended) + +For maximum effectiveness, add this to your `~/.claude/CLAUDE.md`: + +```markdown +# BMAD Method (MANDATORY) + +## Automatic Skill Invocation - THIS IS CRITICAL +**IMMEDIATELY invoke `/bmad-guide` skill in these situations:** + +1. **Starting ANY task in a BMAD project** - Check phase and workflow first +2. **Before implementing ANY feature** - Verify which workflow to use +3. **When uncertain about approach** - Consult guide before proceeding +4. **Before creating/modifying code manually** - Should you be using a workflow? +5. **When switching phases** - Verify phase progression rules +6. **When user mentions workflows, epics, stories, or phases** - Get guidance + +## BMAD Process Rules (NEVER VIOLATE) + +1. **ALWAYS use workflows** - Never implement features without BMAD workflows +2. **NEVER skip phases** - Each phase builds on previous (Phase 1 optional) +3. **ALWAYS check project level (0-4)** - Determines which workflows to use +4. **NEVER jump straight to coding** - Use proper workflow (dev-story, super-dev-story) +5. **ALWAYS follow story lifecycle** - create → dev → review → done +6. **ALWAYS complete current phase** - Before moving to next phase + +## Before ANY Work in BMAD Project + +\``` +1. Invoke /bmad-guide skill +2. Identify current phase (Analysis/Planning/Solutioning/Implementation) +3. Determine project level (0-4) +4. Verify correct workflow for task +5. Check prerequisites are complete +6. Proceed with workflow (not manual implementation) +\``` + +## Red Flags That Mean You're Off Track + +If you catch yourself: +- Writing code without using dev-story/super-dev-story +- Creating PRD/architecture manually instead of using workflows +- Skipping phases or prerequisites +- Not sure which workflow to use +- About to implement without a story + +**→ STOP. Invoke `/bmad-guide` immediately and course correct.** +``` + +## Installation Location + +The skill is installed to: +- **User level**: `~/.claude/skills/bmad-guide.md` (available across all projects) + +This is intentional so the skill is available in all BMAD projects without needing per-project installation. + +## Updating the Skill + +When you run `npx bmad-method install` again (to update BMAD), the skill will be updated automatically if a newer version exists. + +## Manual Installation + +If you want to install the skill without running the full BMAD installer: + +```bash +# Create skills directory +mkdir -p ~/.claude/skills + +# Copy skill file +cp resources/skills/bmad-guide.md ~/.claude/skills/ +``` + +## Success Metrics + +You'll know the skill is working when Claude: +- ✅ Checks phase before starting work +- ✅ Uses workflows instead of manual implementation +- ✅ Follows proper story lifecycle +- ✅ Self-corrects when going off track +- ✅ References the skill when uncertain +- ✅ Asks for clarification about phase/workflow +- ✅ Completes prerequisites before advancing phases + +--- + +**This skill is a core part of the BMAD Method and helps ensure Claude follows the methodology correctly.** diff --git a/resources/skills/bmad-guide.md b/resources/skills/bmad-guide.md new file mode 100644 index 00000000..0f2ac6aa --- /dev/null +++ b/resources/skills/bmad-guide.md @@ -0,0 +1,428 @@ +# BMAD Method Guide - Process Navigation & Workflow Selection + +You are working within the **BMAD Method (BMM)** - a 4-phase AI-powered agile development framework. This guide helps you stay on track and use the correct workflows. + +## 🚨 CRITICAL RULES + +1. **NEVER skip phases** - Each phase builds on the previous (except Phase 1 which is optional) +2. **ALWAYS check project level** - This determines which workflows to use +3. **ALWAYS use workflows** - Don't implement features manually without BMAD workflows +4. **ALWAYS consult workflow docs** - Located in `src/modules/bmm/workflows/` +5. **STAY IN PHASE** - Complete current phase before moving to next + +--- + +## 📍 WHERE AM I? - Quick Phase Check + +### Phase 0: Brownfield Documentation +**You're here if:** Working with existing codebase that needs documentation +**Workflow:** `document-project` +**Next:** Phase 2 (skip Phase 1) + +### Phase 1: Analysis (Optional) +**You're here if:** Need strategic exploration, research, or vision definition +**Workflows:** +- `brainstorm-project` - Explore multiple solution approaches +- `research` - Market/technical/competitive research +- `create-product-brief` - Define product vision + +**Next:** Phase 2 (Planning) + +### Phase 2: Planning (REQUIRED) +**You're here if:** Need to define requirements and scope +**Workflows:** +- **Level 0-1:** `bmad-quick-flow/create-tech-spec` (quick technical spec) +- **Level 2+:** `2-plan-workflows/prd` (full Product Requirements Document) +- **Optional:** `create-ux-design` (UX/UI specification - after PRD) + +**Next:** +- Level 0-1: Skip to Phase 4 (Implementation) +- Level 2: Phase 4 if simple, Phase 3 if needs architecture +- Level 3-4: Phase 3 (Solutioning) + +### Phase 3: Solutioning (Conditional) +**You're here if:** Need architectural decisions and epic breakdown +**Workflows:** +1. `create-architecture` - Make architectural decisions +2. `create-epics-and-stories` - Break requirements into implementable stories +3. `check-implementation-readiness` - Gate check validation + +**Next:** Phase 4 (Implementation) + +### Phase 4: Implementation (REQUIRED) +**You're here if:** Ready to implement stories +**Core Loop:** +1. `sprint-planning` (once) - Initialize sprint tracking +2. **For each story:** + - `create-story` - Create individual story + - `dev-story` or `super-dev-story` - Implement with tests + - `code-review` - Quality review + - Mark story as DONE +3. `retrospective` (per epic) - Review and extract lessons +4. `push-all` - Stage & push all changes when ready + +**Advanced/Automated:** +- `autonomous-epic` - Fully automated epic completion +- `super-dev-story` - Enhanced dev with pre/post validation +- `gap-analysis` - Validate story against codebase +- `create-story-with-gap-analysis` - Combined create + validate + +--- + +## 🎯 PROJECT LEVEL DETECTION + +**ALWAYS determine project level first** to route to correct planning track: + +| Level | Name | Stories | Detection Keywords | Planning Track | +|-------|------|---------|-------------------|----------------| +| **0** | Atomic | 1 | "bug", "fix", "typo", "update", "quick" | Tech spec only | +| **1** | Small | 1-10 | "small feature", "add button", "simple" | Tech spec only | +| **2** | Medium | 5-15 | "feature", "module", "component" | PRD (skip arch) | +| **3** | Complex | 12-40 | "system", "integration", "api", "architecture" | PRD + Architecture | +| **4** | Enterprise | 40+ | "platform", "enterprise", "multiple products" | PRD + Architecture | + +**How to detect:** +```bash +# Use workflow-init to automatically detect level +/workflow-init +``` + +--- + +## 🔍 WORKFLOW DECISION TREE + +``` +┌─ START: What do you need to do? +│ +├─ "I need to explore solutions" → Phase 1: brainstorm-project +│ +├─ "I need requirements" +│ ├─ Level 0-1? → Phase 2: bmad-quick-flow/create-tech-spec +│ └─ Level 2+? → Phase 2: 2-plan-workflows/prd +│ +├─ "I have PRD, need architecture" → Phase 3: create-architecture +│ +├─ "I have PRD, need stories" → Phase 3: create-epics-and-stories +│ +├─ "I'm ready to implement" +│ ├─ First time? → sprint-planning (initialize) +│ ├─ Need new story? → create-story +│ ├─ Implement story? → dev-story or super-dev-story +│ ├─ Automate epic? → autonomous-epic +│ └─ Review story? → code-review +│ +└─ "Epic is done" → retrospective +``` + +--- + +## ⚠️ COMMON MISTAKES TO AVOID + +### ❌ DON'T: +1. **Skip Phase 2** - Requirements are ALWAYS required +2. **Jump to coding** without workflows +3. **Create architecture for Level 0-2** projects (overkill) +4. **Skip sprint-planning** before dev-story +5. **Mix phases** - finish current phase first +6. **Implement manually** - use dev-story/super-dev-story +7. **Forget retrospectives** - extract lessons after each epic + +### ✅ DO: +1. **Check phase progression** - Am I in the right phase? +2. **Consult workflow docs** - Read the .md files in workflows/ +3. **Use workflow-init** - Let BMAD detect level +4. **Follow story lifecycle** - create → dev → review → done +5. **One story at a time** - Complete before moving to next +6. **Use autonomous-epic** - For efficient bulk processing +7. **Validate with gap-analysis** - Before and after development + +--- + +## 📚 HOW TO LOOK UP WORKFLOW INFO + +### Method 1: Read Workflow Documentation +```bash +# Read workflow guide for current phase +cat src/modules/bmm/workflows/README.md +cat src/modules/bmm/docs/workflows-{phase}.md + +# Example: Planning phase +cat src/modules/bmm/docs/workflows-planning.md + +# Example: Implementation phase +cat src/modules/bmm/docs/workflows-implementation.md +``` + +### Method 2: Read Specific Workflow +```bash +# Read workflow details +cat src/modules/bmm/workflows/{phase}/{workflow-name}/README.md + +# Example: PRD workflow +cat src/modules/bmm/workflows/2-plan-workflows/prd/README.md + +# Example: Dev story workflow +cat src/modules/bmm/workflows/4-implementation/dev-story/README.md +``` + +### Method 3: Check Workflow Configuration +```bash +# See workflow config +cat src/modules/bmm/workflows/{phase}/{workflow-name}/workflow.yaml +``` + +### Method 4: Use Explore Agent +``` +Use Task tool with subagent_type=Explore to search for workflow info: +"Find documentation about {workflow-name} in BMAD workflows" +``` + +--- + +## 🎬 TYPICAL PROJECT FLOWS + +### Small Change (Level 0-1) +``` +tech-spec → dev-story → code-review → done +``` + +### Medium Feature (Level 2) +``` +prd → [optional: create-ux-design] → create-epics-and-stories +→ sprint-planning → (create-story → dev-story → code-review)* → retrospective +``` + +### Complex System (Level 3-4) +``` +[optional: brainstorm/research] → prd → [optional: create-ux-design] +→ create-architecture → create-epics-and-stories → check-implementation-readiness +→ sprint-planning → (create-story → super-dev-story)* → retrospective +``` + +### Automated Epic Processing (Any Level) +``` +[Phase 2-3 complete] → sprint-planning → autonomous-epic {epic_number} +→ (auto: create-story → super-dev-story → commit)* → retrospective +``` + +--- + +## 🚀 WORKFLOW EXECUTION PATTERNS + +### Pattern 1: Step-File Workflows (PRD, Architecture, Epics) +- **Sequential execution** - Can't skip steps +- **One step at a time** - Load step file, execute, move to next +- **User approval gates** - Wait for approval between steps +- **Append-only building** - Never overwrite previous sections +- **State tracking** - Uses frontmatter `stepsCompleted` array + +**Example:** +``` +step-01-init.md → step-02-discovery.md → step-03-requirements.md → ... +``` + +### Pattern 2: YAML Configuration Workflows (Dev, Review, Sprint) +- **Full config in workflow.yaml** +- **Auto-discovery** - Finds story files automatically +- **System execution** - Agent-driven, not user-interactive +- **Config inheritance** - Reads from project config + +--- + +## 🔧 ADVANCED FEATURES + +### Autonomous Epic Processing +**When to use:** Want to automate entire epic completion +```bash +# After sprint-planning, automate all stories in epic +/autonomous-epic 2 +``` + +**What it does:** +- Creates story → Develops with super-dev-story → Commits → Repeat +- Includes pre/post gap analysis +- Includes code review +- Creates git commit per story +- Continues on failures (configurable) + +### Super-Dev-Story +**When to use:** Want enhanced development with validation +```bash +# Instead of dev-story, use super-dev-story +/super-dev-story +``` + +**What it does:** +- Pre-dev gap analysis (validate story before coding) +- Implement with tests +- Post-dev gap analysis (validate implementation) +- Built-in code review +- Fail-on-critical-issues (auto-fix loops) + +### Gap Analysis +**When to use:** Validate story against actual codebase +```bash +# Standalone validation +/gap-analysis +``` + +**What it checks:** +- Missing infrastructure before implementation +- Implementation matches story requirements +- All tasks from story are actually completed + +--- + +## 📋 WORKFLOW STATUS & TRACKING + +### Check Current Status +```bash +# View sprint status +cat {project-root}/_bmad/bmm/implementation/sprint-status.yaml + +# View workflow status +cat {project-root}/_bmad/bmm/workflow-status.yaml +``` + +### Story States +- `TODO` - Not started +- `IN PROGRESS` - Currently being developed +- `READY FOR REVIEW` - Implemented, needs review +- `DONE` - Complete and reviewed + +--- + +## 🎯 WHEN TO USE EACH WORKFLOW - QUICK REFERENCE + +| I need to... | Use this workflow | Phase | +|-------------|-------------------|-------| +| Explore solutions | brainstorm-project | 1 | +| Research market/tech | research | 1 | +| Define product vision | create-product-brief | 1 | +| Write requirements (quick) | bmad-quick-flow/create-tech-spec | 2 | +| Write requirements (full) | 2-plan-workflows/prd | 2 | +| Design UX/UI | create-ux-design | 2 | +| Make architecture decisions | create-architecture | 3 | +| Break into stories | create-epics-and-stories | 3 | +| Validate readiness | check-implementation-readiness | 3 | +| Start sprint | sprint-planning | 4 | +| Create individual story | create-story | 4 | +| Implement story | dev-story or super-dev-story | 4 | +| Automate epic | autonomous-epic | 4 | +| Validate against code | gap-analysis | 4 | +| Review quality | code-review | 4 | +| Review epic completion | retrospective | 4 | +| Push changes | push-all | 4 | + +--- + +## 💡 TROUBLESHOOTING + +### "I'm not sure which phase I'm in" +→ Check for existing artifacts: +- PRD exists? You're past Phase 2 +- Architecture exists? You're past Phase 3 +- Sprint-status.yaml exists? You're in Phase 4 +- No artifacts? Start with Phase 2 (or Phase 1 if exploring) + +### "I'm not sure which workflow to use" +→ Use this guide's decision tree or consult phase-specific docs: +- `workflows-planning.md` - Phase 2 workflows +- `workflows-solutioning.md` - Phase 3 workflows +- `workflows-implementation.md` - Phase 4 workflows + +### "Workflow isn't working" +→ Check these: +1. Is config.yaml set up? (project-root/_bmad/bmm/config.yaml) +2. Are you in the right phase? +3. Did you complete prerequisite workflows? +4. Check workflow README for requirements + +### "I want to automate everything" +→ Use autonomous-epic after completing Phase 2-3: +```bash +/sprint-planning # Initialize once +/autonomous-epic 1 # Automate epic 1 +/autonomous-epic 2 # Automate epic 2 +``` + +--- + +## 🎓 KEY PRINCIPLES + +1. **Scale-Adaptive** - Same system works for 1 story or 100 stories +2. **Phase-Gated** - Complete phases in order (except Phase 1 optional) +3. **Story-Centric** - Everything revolves around implementing stories +4. **Validation-First** - Gap analysis prevents mismatched implementations +5. **Automation-Friendly** - Can automate entire epics with autonomous workflows +6. **Quality-Built-In** - Code review and retrospectives are mandatory +7. **Documentation-Driven** - Every phase produces artifacts + +--- + +## 📖 ADDITIONAL RESOURCES + +### Core Documentation +- `src/modules/bmm/docs/workflows-analysis.md` - Phase 1 guidance +- `src/modules/bmm/docs/workflows-planning.md` - Phase 2 guidance +- `src/modules/bmm/docs/workflows-solutioning.md` - Phase 3 guidance +- `src/modules/bmm/docs/workflows-implementation.md` - Phase 4 guidance +- `src/modules/bmm/docs/scale-adaptive-system.md` - Level detection +- `src/modules/bmm/docs/brownfield-guide.md` - Existing codebases + +### Specialized Guides +- `src/modules/bmm/docs/test-architecture.md` - TestArch workflows +- `src/modules/bmm/docs/agents-guide.md` - All 12 specialized agents + +--- + +## ✅ CHECKLIST: Am I Following BMAD? + +Before proceeding, check: + +- [ ] I know what phase I'm in +- [ ] I know what project level this is (0-4) +- [ ] I've completed prerequisite phases +- [ ] I'm using a workflow (not coding manually) +- [ ] I've read the workflow documentation +- [ ] I'm following the story lifecycle (if Phase 4) +- [ ] I'm validating with gap analysis (if Phase 4) +- [ ] I'm doing code reviews (if Phase 4) +- [ ] I'm completing retrospectives (if finishing epic) + +**If any are unchecked, STOP and fix it before proceeding.** + +--- + +## 🚨 EMERGENCY: I Went Off Track + +1. **Identify where you are:** + - Check existing artifacts (PRD? Architecture? Sprint status?) + - Determine current phase + +2. **Determine where you should be:** + - What was the original request? + - What phase should that be in? + +3. **Course correct:** + - Use `correct-course` workflow if in Phase 4 + - Otherwise, restart the appropriate workflow for current phase + +4. **Prevent future derailment:** + - Consult this guide before starting work + - Read workflow docs before executing + - Use TodoWrite to track workflow steps + +--- + +## 🎯 REMEMBER + +**BMAD is a methodology, not a suggestion.** + +When in doubt: +1. Check this guide +2. Read workflow documentation +3. Ask the user for clarification +4. Use explore agent to find info + +**DO NOT improvise. Follow the process.** diff --git a/tools/cli/installers/lib/ide/claude-code.js b/tools/cli/installers/lib/ide/claude-code.js index 35e70b0b..870638b2 100644 --- a/tools/cli/installers/lib/ide/claude-code.js +++ b/tools/cli/installers/lib/ide/claude-code.js @@ -151,6 +151,9 @@ class ClaudeCodeSetup extends BaseIdeSetup { // Skip CLAUDE.md creation - let user manage their own CLAUDE.md file // await this.createClaudeConfig(projectDir, modules); + // Install BMAD Guide skill to user's Claude skills directory + await this.installBmadGuideSkill(); + // Generate workflow commands from manifest (if it exists) const workflowGen = new WorkflowCommandGenerator(this.bmadFolderName); const { artifacts: workflowArtifacts } = await workflowGen.collectWorkflowArtifacts(bmadDir); @@ -194,6 +197,39 @@ class ClaudeCodeSetup extends BaseIdeSetup { // Method removed - CLAUDE.md file management left to user + /** + * Install BMAD Guide skill to user's Claude skills directory + * This skill helps Claude stay on track with BMAD methodology + */ + async installBmadGuideSkill() { + const os = require('node:os'); + + // Source skill file in BMAD repository + const sourcePath = getSourcePath('resources', 'skills', 'bmad-guide.md'); + + // Target directory in user's home + const targetDir = path.join(os.homedir(), '.claude', 'skills'); + const targetPath = path.join(targetDir, 'bmad-guide.md'); + + try { + // Check if source file exists + if (!(await fs.pathExists(sourcePath))) { + console.log(chalk.dim(' Skipping BMAD Guide skill (source not found)')); + return; + } + + // Ensure skills directory exists + await this.ensureDir(targetDir); + + // Copy skill file + await fs.copyFile(sourcePath, targetPath); + console.log(chalk.green(' ✓ Installed BMAD Guide skill to ~/.claude/skills/')); + console.log(chalk.dim(' Access with: /bmad-guide')); + } catch (error) { + console.log(chalk.yellow(` ⚠ Warning: Could not install BMAD Guide skill: ${error.message}`)); + } + } + /** * Read and process file content */