bmad初始化

This commit is contained in:
2025-11-01 19:22:39 +08:00
parent 5b21dc0bd5
commit 426ae41f54
447 changed files with 80633 additions and 0 deletions

View File

@@ -0,0 +1,119 @@
# Edit Workflow
## Purpose
An intelligent workflow editor that helps you modify existing BMAD workflows while adhering to all best practices and conventions documented in the workflow creation guide.
## Use Case
When you need to:
- Fix issues in existing workflows
- Update workflow configuration or metadata
- Improve instruction clarity and specificity
- Add new features or capabilities
- Ensure compliance with BMAD workflow conventions
## How to Invoke
```
workflow edit-workflow
```
Or through a BMAD agent:
```
*edit-workflow
```
## Expected Inputs
- **Target workflow path**: Path to the workflow.yaml file or workflow folder you want to edit
- **Edit type selection**: Choice of what aspect to modify
- **User approval**: For each proposed change
## Generated Outputs
- Modified workflow files (in place)
- Optional change log at: `{output_folder}/workflow-edit-log-{date}.md`
## Features
1. **Comprehensive Analysis**: Checks workflows against the official creation guide
2. **Prioritized Issues**: Identifies and ranks issues by importance
3. **Guided Editing**: Step-by-step process with explanations
4. **Best Practices**: Ensures all edits follow BMAD conventions
5. **Instruction Style Optimization**: Convert between intent-based and prescriptive styles
6. **Validation**: Checks all changes for correctness
7. **Change Tracking**: Documents what was modified and why
## Understanding Instruction Styles
When editing workflows, one powerful option is **adjusting the instruction style** to better match the workflow's purpose.
### Intent-Based vs Prescriptive Instructions
**Intent-Based (Recommended for most workflows)**
Guides the AI with goals and principles, allowing flexible conversation.
- **More flexible and conversational** - AI adapts to user responses
- **Better for complex discovery** - Requirements gathering, creative exploration
- **Quality over consistency** - Deep understanding matters more
- **Example**: `<action>Guide user to define their target audience with specific demographics and needs</action>`
**When to use:**
- Complex discovery processes (user research, requirements)
- Creative brainstorming and ideation
- Iterative refinement workflows
- Workflows requiring nuanced understanding
**Prescriptive**
Provides exact questions with structured options.
- **More controlled and predictable** - Consistent questions every time
- **Better for simple data collection** - Platform, format, yes/no choices
- **Consistency over quality** - Same execution every run
- **Example**: `<ask>What is your target platform? Choose: PC, Console, Mobile, Web</ask>`
**When to use:**
- Simple data collection (platform, format, binary choices)
- Compliance verification and standards adherence
- Configuration with finite options
- Quick setup wizards
### Edit Workflow's Style Adjustment Feature
The **"Adjust instruction style"** editing option (menu option 11) helps you:
1. **Analyze current style** - Identifies whether workflow is primarily intent-based or prescriptive
2. **Convert between styles** - Transform prescriptive steps to intent-based (or vice versa)
3. **Optimize the mix** - Intelligently recommend the best style for each step
4. **Step-by-step control** - Review and decide on each step individually
**Common scenarios:**
- **Make workflow more conversational**: Convert rigid <ask> tags to flexible <action> tags for complex steps
- **Make workflow more consistent**: Convert open-ended <action> tags to structured <ask> tags for simple data collection
- **Balance both approaches**: Use intent-based for discovery, prescriptive for simple choices
This feature is especially valuable when converting legacy workflows or adapting workflows for different use cases.
## Workflow Steps
1. Load and analyze target workflow
2. Check against best practices
3. Select editing focus
4. Load relevant documentation
5. Perform edits with user approval
6. Validate all changes (optional)
7. Generate change summary
## Requirements
- Access to workflow creation guide
- Read/write permissions for target workflow
- Understanding of BMAD workflow types

View File

@@ -0,0 +1,70 @@
# Edit Workflow - Validation Checklist
## Pre-Edit Analysis
- [ ] Target workflow.yaml file successfully loaded and parsed
- [ ] All referenced workflow files identified and accessible
- [ ] Workflow type correctly determined (document/action/interactive/autonomous/meta)
- [ ] Best practices guide loaded and available for reference
## Edit Execution Quality
- [ ] User clearly informed of identified issues with priority levels
- [ ] Edit menu presented with all 8 standard options
- [ ] Selected edit type matches the actual changes made
- [ ] All proposed changes explained with reasoning before application
## File Integrity
- [ ] All modified files maintain valid YAML/Markdown syntax
- [ ] No placeholders like {TITLE} or {WORKFLOW_CODE} remain in edited files
- [ ] File paths use proper variable substitution ({project-root}, {installed_path})
- [ ] All file references resolve to actual paths
## Convention Compliance
- [ ] Instructions.md contains critical workflow engine reference header
- [ ] Instructions.md contains workflow.yaml processing reference header
- [ ] All step numbers are sequential (1, 2, 3... or 1a, 1b, 2a...)
- [ ] Each step has both n= attribute and goal= attribute
- [ ] Variable names use snake_case consistently
- [ ] Template variables (if any) match <template-output> tags exactly
## Instruction Quality
- [ ] Each step has a single, clear goal stated
- [ ] Instructions are specific with quantities (e.g., "3-5 items" not "several items")
- [ ] Optional steps marked with optional="true" attribute
- [ ] Repeating steps use proper repeat syntax (repeat="3" or repeat="until-complete")
- [ ] User prompts use <ask> tags and wait for response
- [ ] Actions use <action> tags for required operations
## Validation Criteria (if checklist.md exists)
- [ ] All checklist items are measurable and specific
- [ ] No vague criteria like "Good documentation" present
- [ ] Checklist organized into logical sections
- [ ] Each criterion can be objectively verified as true/false
## Change Documentation
- [ ] All changes logged with description of what and why
- [ ] Change summary includes list of modified files
- [ ] Improvements clearly articulated in relation to best practices
- [ ] Next steps or recommendations provided
## Post-Edit Verification
- [ ] Edited workflow follows patterns from production examples
- [ ] No functionality broken by the edits
- [ ] Workflow ready for testing or production use
- [ ] User given option to test the edited workflow
## Common Issues Resolved
- [ ] Missing critical headers added if they were absent
- [ ] Broken variable references fixed
- [ ] Vague instructions made specific
- [ ] Template-only workflows have template.md file
- [ ] Action workflows have template: false in workflow.yaml
- [ ] Step count reasonable (5-10 steps maximum unless justified)

View File

@@ -0,0 +1,342 @@
# Edit Workflow - Workflow Editor Instructions
<critical>The workflow execution engine is governed by: {project-root}/bmad/core/tasks/workflow.xml</critical>
<critical>You MUST have already loaded and processed: {project-root}/bmad/bmb/workflows/edit-workflow/workflow.yaml</critical>
<critical>This workflow uses ADAPTIVE FACILITATION - adjust your communication based on context and user needs</critical>
<critical>The goal is COLLABORATIVE IMPROVEMENT - work WITH the user, not FOR them</critical>
<critical>Communicate all responses in {communication_language}</critical>
<workflow>
<step n="1" goal="Load and deeply understand the target workflow">
<ask>What is the path to the workflow you want to edit? (provide path to workflow.yaml or workflow directory)</ask>
<action>Load the target workflow completely:
- workflow.yaml configuration
- instructions.md (if exists)
- template.md (if exists)
- checklist.md (if exists)
- Any additional data files referenced
</action>
<action>Load ALL workflow documentation to inform understanding:
- Workflow creation guide: {workflow_creation_guide}
- Workflow execution engine: {workflow_execution_engine}
- Study example workflows from: {project-root}/bmad/bmm/workflows/
</action>
<action>Analyze the workflow deeply:
- Identify workflow type (document, action, interactive, autonomous, meta)
- Understand purpose and user journey
- Map out step flow and logic
- Check variable consistency across files
- Evaluate instruction style (intent-based vs prescriptive)
- Assess template structure (if applicable)
- Review validation criteria
- Identify config dependencies
- Check for web bundle configuration
- Evaluate against best practices from loaded guides
</action>
<action>Reflect understanding back to {user_name}:
Present a warm, conversational summary adapted to the workflow's complexity:
- What this workflow accomplishes (its purpose and value)
- How it's structured (type, steps, interactive points)
- What you notice (strengths, potential improvements, issues)
- Your initial assessment based on best practices
- How it fits in the larger BMAD ecosystem
Be conversational and insightful. Help {user_name} see their workflow through your eyes.
</action>
<ask>Does this match your understanding of what this workflow should accomplish?</ask>
<template-output>workflow_understanding</template-output>
</step>
<step n="2" goal="Discover improvement goals collaboratively">
<critical>Understand WHAT the user wants to improve and WHY before diving into edits</critical>
<action>Engage in collaborative discovery:
Ask open-ended questions to understand their goals:
- What prompted you to want to edit this workflow?
- What feedback have you gotten from users running it?
- Are there specific steps that feel clunky or confusing?
- Is the workflow achieving its intended outcome?
- Are there new capabilities you want to add?
- Is the instruction style working well for your users?
Listen for clues about:
- User experience issues (confusing steps, unclear instructions)
- Functional issues (broken references, missing validation)
- Performance issues (too many steps, repetitive, tedious)
- Maintainability issues (hard to update, bloated, inconsistent variables)
- Instruction style mismatch (too prescriptive when should be adaptive, or vice versa)
- Integration issues (doesn't work well with other workflows)
</action>
<action>Based on their responses and your analysis from step 1, identify improvement opportunities:
Organize by priority and user goals:
- CRITICAL issues blocking successful runs
- IMPORTANT improvements enhancing user experience
- NICE-TO-HAVE enhancements for polish
Present these conversationally, explaining WHY each matters and HOW it would help.
</action>
<action>Assess instruction style fit:
Based on the workflow's purpose and your analysis:
- Is the current style (intent-based vs prescriptive) appropriate?
- Would users benefit from more/less structure?
- Are there steps that should be more adaptive?
- Are there steps that need more specificity?
Discuss style as part of improvement discovery, not as a separate concern.
</action>
<action>Collaborate on priorities:
Don't just list options - discuss them:
- "I noticed {{issue}} - this could make users feel {{problem}}. Want to address this?"
- "The workflow could be more {{improvement}} which would help when {{use_case}}. Worth exploring?"
- "Based on what you said about {{user_goal}}, we might want to {{suggestion}}. Thoughts?"
Let the conversation flow naturally. Build a shared vision of what "better" looks like.
</action>
<template-output>improvement_goals</template-output>
</step>
<step n="3" goal="Facilitate improvements collaboratively" repeat="until-user-satisfied">
<critical>Work iteratively - improve, review, refine. Never dump all changes at once.</critical>
<action>For each improvement area, facilitate collaboratively:
1. **Explain the current state and why it matters**
- Show relevant sections of the workflow
- Explain how it works now and implications
- Connect to user's goals from step 2
2. **Propose improvements with rationale**
- Suggest specific changes that align with best practices
- Explain WHY each change helps
- Provide examples from the loaded guides when helpful
- Show before/after comparisons for clarity
- Reference the creation guide's patterns naturally
3. **Collaborate on the approach**
- Ask if the proposed change addresses their need
- Invite modifications or alternative approaches
- Explain tradeoffs when relevant
- Adapt based on their feedback
4. **Apply changes iteratively**
- Make one focused improvement at a time
- Show the updated section
- Confirm it meets their expectation
- Move to next improvement or refine current one
</action>
<action>Common improvement patterns to facilitate:
**If refining instruction style:**
- Discuss where the workflow feels too rigid or too loose
- Identify steps that would benefit from intent-based approach
- Identify steps that need prescriptive structure
- Convert between styles thoughtfully, explaining tradeoffs
- Show how each style serves the user differently
- Test proposed changes by reading them aloud
**If improving step flow:**
- Walk through the user journey step by step
- Identify friction points or redundancy
- Propose streamlined flow
- Consider where steps could merge or split
- Ensure each step has clear goal and value
- Check that repeat conditions make sense
**If fixing variable consistency:**
- Identify variables used across files
- Find mismatches in naming or usage
- Propose consistent naming scheme
- Update all files to match
- Verify variables are defined in workflow.yaml
**If enhancing validation:**
- Review current checklist (if exists)
- Discuss what "done well" looks like
- Make criteria specific and measurable
- Add validation for new features
- Remove outdated or vague criteria
**If updating configuration:**
- Review standard config pattern
- Check if user context variables are needed
- Ensure output_folder, user_name, communication_language are used appropriately
- Add missing config dependencies
- Clean up unused config fields
**If adding/updating templates:**
- Understand the document structure needed
- Design template variables that match instruction outputs
- Ensure variable names are descriptive snake_case
- Include proper metadata headers
- Test that all variables can be filled
**If configuring web bundle:**
- Identify all files the workflow depends on
- Check for invoked workflows (must be included)
- Verify paths are bmad/-relative
- Remove config_source dependencies
- Build complete file list
**If improving user interaction:**
- Find places where <ask> could be more open-ended
- Add educational context where users might be lost
- Remove unnecessary confirmation steps
- Make questions clearer and more purposeful
- Balance guidance with user autonomy
</action>
<action>Throughout improvements, educate when helpful:
Share insights from the guides naturally:
- "The creation guide recommends {{pattern}} for workflows like this"
- "Looking at examples in BMM, this type of step usually {{approach}}"
- "The execution engine expects {{structure}} for this to work properly"
Connect improvements to broader BMAD principles without being preachy.
</action>
<ask>After each significant change:
- "Does this flow feel better for what you're trying to achieve?"
- "Want to refine this further, or move to the next improvement?"
- "How does this change affect the user experience?"
</ask>
<template-output>improvement_implementation</template-output>
</step>
<step n="4" goal="Validate improvements holistically">
<action>Run comprehensive validation conversationally:
Don't just check boxes - explain what you're validating and why it matters:
- "Let me verify all file references resolve correctly..."
- "Checking that variables are consistent across all files..."
- "Making sure the step flow is logical and complete..."
- "Validating template variables match instruction outputs..."
- "Ensuring config dependencies are properly set up..."
</action>
<action>Load validation checklist: {installed_path}/checklist.md</action>
<action>Check all items from checklist systematically</action>
<check if="validation_issues_found">
<action>Present issues conversationally:
Explain what's wrong and implications:
- "I found {{issue}} which could cause {{problem}} when users run this"
- "The {{component}} needs {{fix}} because {{reason}}"
Propose fixes immediately:
- "I can fix this by {{solution}}. Should I?"
- "We have a couple options here: {{option1}} or {{option2}}. Thoughts?"
</action>
<action>Fix approved issues and re-validate</action>
</check>
<check if="validation_passes">
<action>Confirm success warmly:
"Excellent! Everything validates cleanly:
- All file references resolve
- Variables are consistent throughout
- Step flow is logical and complete
- Template aligns with instructions (if applicable)
- Config dependencies are set up correctly
- Web bundle is complete (if applicable)
Your workflow is in great shape."
</action>
</check>
<template-output>validation_results</template-output>
</step>
<step n="5" goal="Review improvements and guide next steps">
<action>Create a conversational summary of what improved:
Tell the story of the transformation:
- "We started with {{initial_state}}"
- "You wanted to {{user_goals}}"
- "We made these key improvements: {{changes_list}}"
- "Now your workflow {{improved_capabilities}}"
Highlight the impact:
- "This means users will experience {{benefit}}"
- "The workflow is now more {{quality}}"
- "It follows best practices for {{patterns}}"
</action>
<action>Guide next steps based on changes made:
If instruction style changed:
- "Since we made the workflow more {{style}}, you might want to test it with a real user to see how it feels"
If template was updated:
- "The template now has {{new_variables}} - run the workflow to generate a sample document"
If this is part of larger module work:
- "This workflow is part of {{module}} - consider if other workflows need similar improvements"
If web bundle was configured:
- "The web bundle is now set up - you can test deploying this workflow standalone"
Be a helpful guide to what comes next, not just a task completer.
</action>
<ask>Would you like to:
- Test the edited workflow by running it
- Edit another workflow
- Make additional refinements to this one
- Return to your module work
</ask>
<template-output>completion_summary</template-output>
</step>
</workflow>

View File

@@ -0,0 +1,28 @@
# Edit Workflow - Workflow Editor Configuration
name: "edit-workflow"
description: "Edit existing BMAD workflows while following all best practices and conventions"
author: "BMad"
# Critical variables load from config_source
config_source: "{project-root}/bmad/bmb/config.yaml"
communication_language: "{config_source}:communication_language"
user_name: "{config_source}:user_name"
# Required Data Files - Critical for understanding workflow conventions
workflow_creation_guide: "{project-root}/bmad/bmb/workflows/create-workflow/workflow-creation-guide.md"
workflow_execution_engine: "{project-root}/bmad/core/tasks/workflow.xml"
# Optional docs that can be used to understand the target workflow
recommended_inputs:
- target_workflow: "Path to the workflow.yaml file to edit"
- workflow_examples: "{project-root}/bmad/bmm/workflows/"
# Module path and component files
installed_path: "{project-root}/bmad/bmb/workflows/edit-workflow"
template: false # This is an action workflow - no template needed
instructions: "{installed_path}/instructions.md"
validation: "{installed_path}/checklist.md"
standalone: true
# Web bundle configuration