選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

step-02-generate.md 8.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. # Step 2: Context Rules Generation
  2. ## MANDATORY EXECUTION RULES (READ FIRST):
  3. - 🛑 NEVER generate content without user input
  4. - ✅ ALWAYS treat this as collaborative discovery between technical peers
  5. - 📋 YOU ARE A FACILITATOR, not a content generator
  6. - 💬 FOCUS on unobvious rules that AI agents need to be reminded of
  7. - 🎯 KEEP CONTENT LEAN - optimize for LLM context efficiency
  8. - ⚠️ ABSOLUTELY NO TIME ESTIMATES - AI development speed has fundamentally changed
  9. - ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
  10. - ✅ YOU MUST ALWAYS WRITE all artifact and document content in `{document_output_language}`
  11. ## EXECUTION PROTOCOLS:
  12. - 🎯 Show your analysis before taking any action
  13. - 📝 Focus on specific, actionable rules rather than general advice
  14. - ⚠️ Present A/P/C menu after each major rule category
  15. - 💾 ONLY save when user chooses C (Continue)
  16. - 📖 Update frontmatter with completed sections
  17. - 🚫 FORBIDDEN to load next step until all sections are complete
  18. ## COLLABORATION MENUS (A/P/C):
  19. This step will generate content and present choices for each rule category:
  20. - **A (Advanced Elicitation)**: Use discovery protocols to explore nuanced implementation rules
  21. - **P (Party Mode)**: Bring multiple perspectives to identify critical edge cases
  22. - **C (Continue)**: Save the current rules and proceed to next category
  23. ## PROTOCOL INTEGRATION:
  24. - When 'A' selected: Invoke the `bmad-advanced-elicitation` skill
  25. - When 'P' selected: Invoke the `bmad-party-mode` skill
  26. - PROTOCOLS always return to display this step's A/P/C menu after the A or P have completed
  27. - User accepts/rejects protocol changes before proceeding
  28. ## CONTEXT BOUNDARIES:
  29. - Discovery results from step-1 are available
  30. - Technology stack and existing patterns are identified
  31. - Focus on rules that prevent implementation mistakes
  32. - Prioritize unobvious details that AI agents might miss
  33. ## YOUR TASK:
  34. Collaboratively generate specific, critical rules that AI agents must follow when implementing code in this project.
  35. ## CONTEXT GENERATION SEQUENCE:
  36. ### 1. Technology Stack & Versions
  37. Document the exact technology stack from discovery:
  38. **Core Technologies:**
  39. Based on user skill level, present findings:
  40. **Expert Mode:**
  41. "Technology stack from your architecture and package files:
  42. {{exact_technologies_with_versions}}
  43. Any critical version constraints I should document for agents?"
  44. **Intermediate Mode:**
  45. "I found your technology stack:
  46. **Core Technologies:**
  47. {{main_technologies_with_versions}}
  48. **Key Dependencies:**
  49. {{important_dependencies_with_versions}}
  50. Are there any version constraints or compatibility notes agents should know about?"
  51. **Beginner Mode:**
  52. "Here are the technologies you're using:
  53. **Main Technologies:**
  54. {{friendly_description_of_tech_stack}}
  55. **Important Notes:**
  56. {{key_things_agents_need_to_know_about_versions}}
  57. Should I document any special version rules or compatibility requirements?"
  58. ### 2. Language-Specific Rules
  59. Focus on unobvious language patterns agents might miss:
  60. **TypeScript/JavaScript Rules:**
  61. "Based on your codebase, I notice some specific patterns:
  62. **Configuration Requirements:**
  63. {{typescript_config_rules}}
  64. **Import/Export Patterns:**
  65. {{import_export_conventions}}
  66. **Error Handling Patterns:**
  67. {{error_handling_requirements}}
  68. Are these patterns correct? Any other language-specific rules agents should follow?"
  69. **Python/Ruby/Other Language Rules:**
  70. Adapt to the actual language in use with similar focused questions.
  71. ### 3. Framework-Specific Rules
  72. Document framework-specific patterns:
  73. **React Rules (if applicable):**
  74. "For React development, I see these patterns:
  75. **Hooks Usage:**
  76. {{hooks_usage_patterns}}
  77. **Component Structure:**
  78. {{component_organization_rules}}
  79. **State Management:**
  80. {{state_management_patterns}}
  81. **Performance Rules:**
  82. {{performance_optimization_requirements}}
  83. Should I add any other React-specific rules?"
  84. **Other Framework Rules:**
  85. Adapt for Vue, Angular, Next.js, Express, etc.
  86. ### 4. Testing Rules
  87. Focus on testing patterns that ensure consistency:
  88. **Test Structure Rules:**
  89. "Your testing setup shows these patterns:
  90. **Test Organization:**
  91. {{test_file_organization}}
  92. **Mock Usage:**
  93. {{mock_patterns_and_conventions}}
  94. **Test Coverage Requirements:**
  95. {{coverage_expectations}}
  96. **Integration vs Unit Test Rules:**
  97. {{test_boundary_patterns}}
  98. Are there testing rules agents should always follow?"
  99. ### 5. Code Quality & Style Rules
  100. Document critical style and quality rules:
  101. **Linting/Formatting:**
  102. "Your code style configuration requires:
  103. **ESLint/Prettier Rules:**
  104. {{specific_linting_rules}}
  105. **Code Organization:**
  106. {{file_and_folder_structure_rules}}
  107. **Naming Conventions:**
  108. {{naming_patterns_agents_must_follow}}
  109. **Documentation Requirements:**
  110. {{comment_and_documentation_patterns}}
  111. Any additional code quality rules?"
  112. ### 6. Development Workflow Rules
  113. Document workflow patterns that affect implementation:
  114. **Git/Repository Rules:**
  115. "Your project uses these patterns:
  116. **Branch Naming:**
  117. {{branch_naming_conventions}}
  118. **Commit Message Format:**
  119. {{commit_message_patterns}}
  120. **PR Requirements:**
  121. {{pull_request_checklist}}
  122. **Deployment Patterns:**
  123. {{deployment_considerations}}
  124. Should I document any other workflow rules?"
  125. ### 7. Critical Don't-Miss Rules
  126. Identify rules that prevent common mistakes:
  127. **Anti-Patterns to Avoid:**
  128. "Based on your codebase, here are critical things agents must NOT do:
  129. {{critical_anti_patterns_with_examples}}
  130. **Edge Cases:**
  131. {{specific_edge_cases_agents_should_handle}}
  132. **Security Rules:**
  133. {{security_considerations_agents_must_follow}}
  134. **Performance Gotchas:**
  135. {{performance_patterns_to_avoid}}
  136. Are there other 'gotchas' agents should know about?"
  137. ### 8. Generate Context Content
  138. For each category, prepare lean content for the project context file:
  139. #### Content Structure:
  140. ```markdown
  141. ## Technology Stack & Versions
  142. {{concise_technology_list_with_exact_versions}}
  143. ## Critical Implementation Rules
  144. ### Language-Specific Rules
  145. {{bullet_points_of_critical_language_rules}}
  146. ### Framework-Specific Rules
  147. {{bullet_points_of_framework_patterns}}
  148. ### Testing Rules
  149. {{bullet_points_of_testing_requirements}}
  150. ### Code Quality & Style Rules
  151. {{bullet_points_of_style_and_quality_rules}}
  152. ### Development Workflow Rules
  153. {{bullet_points_of_workflow_patterns}}
  154. ### Critical Don't-Miss Rules
  155. {{bullet_points_of_anti_patterns_and_edge_cases}}
  156. ```
  157. ### 9. Present Content and Menu
  158. After each category, show the generated rules and present choices:
  159. "I've drafted the {{category_name}} rules for your project context.
  160. **Here's what I'll add:**
  161. [Show the complete markdown content for this category]
  162. **What would you like to do?**
  163. [A] Advanced Elicitation - Explore nuanced rules for this category
  164. [P] Party Mode - Review from different implementation perspectives
  165. [C] Continue - Save these rules and move to next category"
  166. **HALT — wait for user selection before proceeding.**
  167. ### 10. Handle Menu Selection
  168. #### If 'A' (Advanced Elicitation):
  169. - Invoke the `bmad-advanced-elicitation` skill with current category rules
  170. - Process enhanced rules that come back
  171. - Ask user: "Accept these enhanced rules for {{category}}? (y/n)"
  172. - If yes: Update content, then return to A/P/C menu
  173. - If no: Keep original content, then return to A/P/C menu
  174. #### If 'P' (Party Mode):
  175. - Invoke the `bmad-party-mode` skill with category rules context
  176. - Process collaborative insights on implementation patterns
  177. - Ask user: "Accept these changes to {{category}} rules? (y/n)"
  178. - If yes: Update content, then return to A/P/C menu
  179. - If no: Keep original content, then return to A/P/C menu
  180. #### If 'C' (Continue):
  181. - Save the current category content to project context file
  182. - Update frontmatter: `sections_completed: [...]`
  183. - Proceed to next category or step-03 if complete
  184. ## APPEND TO PROJECT CONTEXT:
  185. When user selects 'C' for a category, append the content directly to `{output_folder}/project-context.md` using the structure from step 8.
  186. ## SUCCESS METRICS:
  187. ✅ All critical technology versions accurately documented
  188. ✅ Language-specific rules cover unobvious patterns
  189. ✅ Framework rules capture project-specific conventions
  190. ✅ Testing rules ensure consistent test quality
  191. ✅ Code quality rules maintain project standards
  192. ✅ Workflow rules prevent implementation conflicts
  193. ✅ Content is lean and optimized for LLM context
  194. ✅ A/P/C menu presented and handled correctly for each category
  195. ## FAILURE MODES:
  196. ❌ Including obvious rules that agents already know
  197. ❌ Making content too verbose for LLM context efficiency
  198. ❌ Missing critical anti-patterns or edge cases
  199. ❌ Not getting user validation for each rule category
  200. ❌ Not documenting exact versions and configurations
  201. ❌ Not presenting A/P/C menu after content generation
  202. ## NEXT STEP:
  203. After completing all rule categories and user selects 'C' for the final category, load `./step-03-complete.md` to finalize the project context file.
  204. Remember: Do NOT proceed to step-03 until all categories are complete and user explicitly selects 'C' for each!