Skip to main content

BMAD

BMad 方法指導原則

BMad Core 與 Method 是一個用於 AI 協助工作流程的自然語言框架,結合人類在迴路中的處理以及軟體開發。這些原則確保貢獻能維持該方法的效能。

Core Principles  核心原則

1. Dev Agents Must Be Lean 開發代理必須精簡

  • Minimize dev agent dependencies: Development agents that work in IDEs must have minimal context overhead
    將開發代理的依賴降到最低:在整合開發環境(IDE)中運作的開發代理應該只帶最少的上下文負擔
  • Save context for code: Every line counts - dev agents should focus on coding, not documentation
    為程式碼保留上下文:每一行都很重要 —— 開發代理應該專注於撰寫程式碼,而不是文件編撰
  • Planning agents can be larger: Planning agents (PM, Architect) used in web UI can have more complex tasks and dependencies
    規劃代理可以較大:用於網頁 UI 的規劃代理(PM、Architect)可以承擔更複雜的任務和相依性
  • Small files, loaded on demand: Multiple small, focused files are better than large files with many branches
    小型檔案、按需載入:多個小而專注的檔案勝過單一包含許多分支的大檔案

2. Natural Language First 以自然語言為先

  • Everything is markdown: Agents, tasks, templates - all written in plain English
    一切皆為 Markdown:代理(Agents)、任務、範本——全部以純英文撰寫
  • No code in core: The framework itself contains no programming code, only natural language instructions
    核心無程式碼:此框架本身不包含任何程式碼,僅有自然語言指示
  • Self-contained templates: Templates are defined as YAML files with structured sections that include metadata, workflow configuration, and detailed instructions for content generation
    自成一體的範本:範本以 YAML 檔案定義,包含結構化章節,內含資料描述、工作流程設定與內容產出之詳細指示

3. Agent and Task Design 代理人與任務設計

  • Agents define roles: Each agent is a persona with specific expertise (e.g., Frontend Developer, API Developer)
    代理人定義角色:每個代理人是一個具特定專業的角色(例如:前端開發者、API 開發者)
  • Tasks are procedures: Step-by-step instructions an agent follows to complete work
    任務是程序:代理人為完成工作而遵循的逐步指示
  • Templates are outputs: Structured documents with embedded instructions for generation
    範本是輸出:內含產生指示的結構化文件
  • Dependencies matter: Explicitly declare only what's needed
    相依性很重要:明確宣告僅需的部分

Practical Guidelines  實務指南

When to Add to Core
何時加入核心

  • Universal software development needs only
    通用軟體開發僅需
  • Doesn't bloat dev agent contexts
    不會膨脹開發代理的上下文
  • Follows existing agent/task/template patterns
    遵循現有的代理/任務/範本模式

When to Create Expansion Packs
何時建立擴充套件包

  • Domain-specific needs beyond software development
    超出軟體開發範疇的領域特定需求
  • Non-technical domains (business, wellness, education, creative)
    非技術領域(商業、健康、教育、創意)
  • Specialized technical domains (games, infrastructure, mobile)
    專門技術領域(遊戲、基礎設施、行動裝置)
  • Heavy documentation or knowledge bases
    大量文件或知識庫
  • Anything that would bloat core agents
    任何會使核心代理臃腫的事物

See Expansion Packs Guide for detailed examples and ideas.
請參閱擴充套件指南,了解詳細範例與點子。

Agent Design Rules  代理人設計規則

  1. Web/Planning Agents: Can have richer context, multiple tasks, extensive templates
    網頁/規劃代理人:可以擁有更豐富的上下文、多重任務與大量範本
  2. Dev Agents: Minimal dependencies, focused on code generation, lean task sets
    開發代理人:最小依賴、專注於程式碼產生、精簡任務集
  3. All Agents: Clear persona, specific expertise, well-defined capabilities
    所有代理人:清楚的角色、明確的專長、定義良好的能力

Task Writing Rules  任務撰寫規則

  1. Write clear step-by-step procedures
    撰寫清晰的逐步程序
  2. Use markdown formatting for readability
    為了可讀性使用 Markdown 格式
  3. Keep dev agent tasks focused and concise
    讓開發代理的任務保持專注且簡潔
  4. Planning tasks can be more elaborate
    規劃任務可以較為詳盡
  5. Prefer multiple small tasks over one large branching task
    偏好多個小任務而非一個大型分支任務
    • Instead of one task with many conditional paths
      不要只用一個包含許多條件路徑的任務
    • Create multiple focused tasks the agent can choose from
      建立多個聚焦任務,讓代理可以從中選擇
    • This keeps context overhead minimal
      這可將上下文負擔維持在最低
  6. Reuse common tasks - Don't create new document creation tasks
    重複使用常見任務 - 不要建立新的文件建立任務
    • Use the existing create-doc task
      使用現有的 create-doc 任務
    • Pass the appropriate YAML template with structured sections
      傳遞帶有結構化章節的適當 YAML 範本
    • This maintains consistency and reduces duplication
      這可維持一致性並減少重複

Template Rules  範本規則

Templates follow the BMad Document Template specification using YAML format:
範本遵循 BMad 文件範本規格,使用 YAML 格式:

  1. Structure: Templates are defined in YAML with clear metadata, workflow configuration, and section hierarchy
    結構:範本以 YAML 定義,包含明確的元資料、工作流程配置及章節層次結構
  2. Separation of Concerns: Instructions for LLMs are in instruction fields, separate from content
    關注點分離:給 LLMs 的指示位於 instruction 欄位,與內容分開
  3. Reusability: Templates are agent-agnostic and can be used across different agents
    可重用性:範本與代理無關,可跨不同代理使用
  4. Key Components:   主要組成部分:
    • template block for metadata (id, name, version, output settings)
      template 區塊用於描述資料的中繼資料(id、name、version、輸出設定)
    • workflow block for interaction mode configuration
      workflow 區塊用於互動模式的設定
    • sections array defining document structure with nested subsections
      sections 陣列定義文件結構並包含巢狀子章節
    • Each section has id, title, and instruction fields
      每個章節都有 idtitleinstruction 欄位
  5. Advanced Features:   進階功能:
    • Variable substitution using {{variable_name}} syntax
      使用 {{variable_name}} 語法的變數替換
    • Conditional sections with condition field
      具有 condition 欄位的條件區段
    • Repeatable sections with repeatable: true
      可重複的 repeatable: true 區段
    • Agent permissions with owner and editors fields
      代理項目權限,包含 ownereditors 欄位
    • Examples arrays for guidance (never included in output)
      範例陣列以供參考(絕不包含於輸出中)
  6. Clean Output: YAML structure ensures all processing logic stays separate from generated content
    清晰輸出:YAML 結構確保所有處理邏輯與產生內容完全分離

Remember  記得

  • The power is in natural language orchestration and human agent collaboration, not code
    力量在於自然語言協同與人類代理協作,而非程式碼
  • Dev agents code, planning agents plan
    開發代理負責編碼,規劃代理負責規劃
  • Keep dev agents lean for maximum coding efficiency
    保持開發代理精簡以達到最高的程式編寫效率
  • Expansion packs handle specialized domains
    擴充套件處理專門領域