game-architect

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Game Architect Skill

游戏架构师技能

This skill assists in the documentation phase of game project development. It produces a series of technical documents that guide subsequent implementation work.
[!IMPORTANT] This skill focuses on documentation output only. The actual code implementation phase is outside the scope of this skill.
该技能可协助完成游戏项目开发的文档编制阶段工作,生成一系列指导后续实现工作的技术文档。
[!IMPORTANT] 本技能仅专注于文档输出。实际代码实现阶段不在本技能的服务范围内

Output Documents

输出文档

All documents are placed in an
architect/
directory (create if needed). The pipeline produces:
requirement.md  --->  technical_design.md  --->  implementation.md
DocumentPurposeDescription
requirement.md
Requirements AnalysisAnalyzes and formalizes user requirements
technical_design.md
Technical Solution DesignCore document - designs system approaches and patterns
implementation.md
Implementation PlanDetails data structures, algorithms, class designs, key code, and evolution strategies

所有文档将存放于
architect/
目录下(若不存在则自动创建)。流程会生成以下文档:
requirement.md  --->  technical_design.md  --->  implementation.md
文档用途描述
requirement.md
需求分析分析并规范化用户需求
technical_design.md
技术方案设计核心文档 - 设计系统方案与架构模式
implementation.md
实现规划详细说明数据结构、算法、类设计、关键代码及演进策略

Workflow

工作流程

Phase 0: Ask user if need review

阶段0:询问用户是否需要评审

  • Question: "Do you want to review the output document after every phase?"
  • Answer: "Yes" or "No"
  • Default: "Yes"
  • Output: User Review Flag
User Review Workflow:
  • Trigger: User explicitly requests "User Review" mode (via Phase 0).
  • Process:
    • After each Phase, pause and present the output to the user.
    • Request user feedback.
    • If feedback is received, iterate on the current phase's output before proceeding to the next phase.

  • 问题:"是否需要在每个阶段结束后评审输出文档?"
  • 回答:"是" 或 "否"
  • 默认值:"是"
  • 输出:用户评审标记
用户评审工作流:
  • 触发条件:用户在阶段0明确要求启用「用户评审」模式。
  • 流程:
    • 每个阶段完成后,暂停流程并向用户展示当前阶段的输出文档。
    • 收集用户反馈。
    • 若收到反馈,在进入下一阶段前,根据反馈对当前阶段的输出进行迭代优化

Phase 1: Requirement Analysis

阶段1:需求分析

Goal: Analyze user requirements and produce structured documentation.
  • Input: User request + LLM knowledge
  • Output:
    architect/requirement.md
  • Reference: Read
    references/requirements.md
Key Tasks:
  1. Extract and clarify user requirements
  2. Build Feature List (technological scope, including non-functional requirements)
  3. Define Domain Models (for core gameplay)
  4. Document Use Cases & User Flows
  5. Plan Iteration Milestones (incremental MVP delivery)

目标:分析用户需求并生成结构化文档。
  • 输入:用户需求 + 大语言模型知识库
  • 输出
    architect/requirement.md
  • 参考文档:阅读
    references/requirements.md
核心任务:
  1. 提取并明确用户需求
  2. 构建功能列表(技术范围,包含非功能性需求)
  3. 定义领域模型(针对核心玩法)
  4. 编写用例与用户流程文档
  5. 规划迭代里程碑(增量式MVP交付)

Phase 2: Technical Design

阶段2:技术设计

Goal: Design technical solutions for each system. This is the most critical phase.
  • Input:
    architect/requirement.md
  • Output:
    architect/technical_design.md
  • References:
    • Read
      references/macro-design.md
      for high-level structure
    • Read
      references/principles.md
      for core principles
Key Tasks:
  1. If existing project: Analyze the existing project code to understand the current architecture
    • Directory & module structure (layers, namespaces, key entry points)
    • Technology stack & dependencies (engine, language, third-party libraries)
    • Architectural paradigms in use (DDD, ECS, MVC, etc.)
    • Module boundaries & inter-module communication (events, interfaces, direct calls)
    • Data flow (config loading, persistence, runtime state management)
    • Known constraints & technical debt (coupling issues, performance bottlenecks, deprecated patterns)
    • Integration points for new systems (where to hook in, what to extend)
  2. Define Multi-Application structure (Client/Server)
  3. Select Technology Stack (Engine, Languages)
  4. Choose architectural paradigms using the Paradigm Selection Guide for each module
  5. Use the System-Specific References to design each module
  6. Map Iteration Milestones to system implementation scope (Milestone System Plan)
目标:为各系统设计技术方案。这是最关键的阶段
  • 输入
    architect/requirement.md
  • 输出
    architect/technical_design.md
  • 参考文档:
    • 阅读
      references/macro-design.md
      了解高层架构
    • 阅读
      references/principles.md
      了解核心设计原则
核心任务:
  1. 若为已有项目:分析现有项目代码,理解当前架构
    • 目录与模块结构(分层、命名空间、关键入口)
    • 技术栈与依赖(引擎、编程语言、第三方库)
    • 采用的架构范式(DDD, ECS, MVC等)
    • 模块边界与模块间通信(事件、接口、直接调用)
    • 数据流(配置加载、持久化、运行时状态管理)
    • 已知约束与技术债务(耦合问题、性能瓶颈、已废弃模式)
    • 新系统的集成点(接入位置、扩展内容)
  2. 定义多应用架构(客户端/服务器)
  3. 选择技术栈(引擎、编程语言)
  4. 为各模块选择架构范式(参考范式选择指南
  5. 参考系统专属文档设计各模块
  6. 将迭代里程碑映射到系统实现范围(里程碑系统规划)

Paradigm Selection Guide

范式选择指南

ParadigmKeyPointApplicability ScopeExamplesReference
Domain-Driven Design (DDD)OOP & Entity FirstHigh Rule Complexity. <br> Rich Domain Concepts. <br> Many Distinct Entities.Core Combat Logic, Physics Interactions, Damage/Buff Rules, Complex AI Decision.
references/domain-driven-design.md
Data-Driven DesignData Layer FirstHigh Content Complexity. <br> Flow Orchestration. <br> Simple Data Management.Content: Quests, Level Design.<br>Flow: Tutorial Flow, Skill Execution, Narrative.<br>Mgmt: Inventory, Shop, Mail, Leaderboard.
references/data-driven-design.md
Use-Case Driven PrototypeUse-Case Implementation FirstRapid ValidationGame Jam, Core Mechanic Testing.
references/prototype-design.md
范式核心要点适用范围示例参考文档
Domain-Driven Design (DDD)面向对象与实体优先规则复杂度高、领域概念丰富、实体类型多样的场景核心战斗逻辑、物理交互、伤害/ buff规则、复杂AI决策
references/domain-driven-design.md
Data-Driven Design数据层优先内容复杂度高、流程编排类、简单数据管理类场景内容类:任务、关卡设计<br>流程类:教程流程、技能释放、剧情叙事<br>管理类:背包、商店、邮件、排行榜
references/data-driven-design.md
Use-Case Driven Prototype用例实现优先快速验证场景Game Jam、核心玩法测试
references/prototype-design.md

System-Specific References

系统专属参考文档

System CategoryReference
Foundation & Core (Logs, Timers, Modules, Events, Resources, Audio, Input)
references/system-foundation.md
Time & Logic Flow (Update Loops, Async, FSM, Command Queues, Controllers)
references/system-time.md
Combat & Scene (Scene Graphs, Spatial Partitioning, ECS/EC, Loading)
references/system-scene.md
UI & Modules (Modules Management, MVC/MVP/MVVM, UI Management, Data Binding, Reactive)
references/system-ui.md
Skill System (Attribute, Skill, Buff)
references/system-skill.md
Action Combat System (HitBox, Damage, Melee, Projectiles)
references/system-action-combat.md
Narrative System (Dialogue, Cutscenes, Story Flow)
references/system-narrative.md
Game AI System (Movement, Pathfinding, Decision Making, Tactical)
references/system-game-ai.md
Algorithm & Data Structures (Pathfinding, Search, Physics, Generic Solver)
references/algorithm.md
系统分类参考文档
基础与核心系统(日志、计时器、模块、事件、资源、音频、输入)
references/system-foundation.md
时间与逻辑流(更新循环、异步、有限状态机FSM、命令队列、控制器)
references/system-time.md
战斗与场景(场景图、空间分区、ECS/EC、加载)
references/system-scene.md
UI与模块(模块管理、MVC/MVP/MVVM、UI管理、数据绑定、响应式)
references/system-ui.md
技能系统(属性、技能、Buff)
references/system-skill.md
动作战斗系统(碰撞盒、伤害、近战、投射物)
references/system-action-combat.md
叙事系统(对话、过场动画、剧情流程)
references/system-narrative.md
游戏AI系统(移动、寻路、决策、战术)
references/system-game-ai.md
算法与数据结构(寻路、搜索、物理、通用求解器)
references/algorithm.md

Mixing Paradigms

混合范式使用

Most projects mix paradigms:
  1. Macro Consistency: All modules follow the same Module Management Framework.
  2. Domain for Core Entities & Rules: Use DDD for systems with high rule complexity, rich domain concepts, and many distinct entities (e.g., Combat Actors, Damage Formulas, AI Decision).
  3. Data for Content, Flow & State: Use Data-Driven for expandable content (Quests, Level Design), flow orchestration (Tutorial, Skill Execution, Narrative), and simple data management (Inventory, Shop).
  4. Hybrid Paradigms:
    • 4.1 Entities as Data: Domain Entities naturally hold both data (fields) and behavior (methods). Design entities to be serialization-friendly (use IDs, keep state as plain fields) so they serve both roles without a separate data layer.
    • 4.2 Flow + Domain: Use data-driven flow to orchestrate the sequence/pipeline, domain logic to handle rules at each step. E.g., Skill System: flow drives cast→channel→apply, domain handles damage calc and buff interactions.
    • 4.3 Separate Data/Domain Layers: Only when edit-time and runtime representations truly diverge. Use a Bake/Compile step to bridge them. E.g., visual node-graph editors, compiled assets.
  5. Paradigm Interchangeability: Many systems can be validly implemented with either paradigm. E.g., Actor inheritance hierarchy (Domain) ↔ ECS components + systems (Data-Driven); Buff objects with encapsulated rules (Domain) ↔ Tag + Effect data entries resolved by a generic pipeline (Data-Driven). See Selection Criteria table above for trade-off signals.
  6. Integration: Application Layer bridges different paradigms.
Selection Criteria — when both DDD and Data-Driven fit, use these signals:
SignalFavor DDDFavor Data-Driven
Entity interactionsComplex multi-entity rules (attacker × defender × buffs × environment)Mostly CRUD + display, few cross-entity rules
Behavior sourceVaries by entity type, hard to express as pure dataDriven by config tables, designer-authored content
Change frequencyRules change with game balance iterationsContent/flow changes far more often than logic
Performance profileAcceptable overhead for rich object graphsNeeds batch processing, cache-friendly layouts
NetworkingStateful objects acceptableFlat state snapshots preferred (sync, rollback)
Team workflowProgrammers own the logicDesigners need to iterate without code changes

大多数项目会混合使用多种范式:
  1. 宏观一致性:所有模块遵循统一的模块管理框架。
  2. 核心实体与规则用DDD:对于规则复杂度高、领域概念丰富、实体类型多样的系统(如战斗角色、伤害公式、AI决策),使用DDD。
  3. 内容、流程与状态用数据驱动:对于可扩展内容(任务、关卡设计)、流程编排(教程、技能释放、剧情)、简单数据管理(背包、商店),使用数据驱动设计。
  4. 混合范式:
    • 4.1 实体即数据:领域实体自然包含数据(字段)与行为(方法)。设计实体时需支持序列化(使用ID、将状态设为普通字段),使其同时承担数据与领域实体的角色,无需单独的数据层。
    • 4.2 流程+领域:用数据驱动流程编排序列/管线,用领域逻辑处理每个步骤的规则。例如技能系统:流程驱动施法→引导→生效,领域逻辑处理伤害计算与Buff交互。
    • 4.3 分离数据/领域层:仅当编辑时与运行时的表示完全不同时才使用。通过烘焙/编译步骤连接两者。例如可视化节点图编辑器、编译后的资源。
  5. 范式互通:应用层负责桥接不同范式的模块。
选择标准 — 当DDD与数据驱动设计均适用时,参考以下信号:
信号优先选DDD优先选数据驱动
实体交互复杂的多实体规则(攻击者×防御者×Buff×环境)以CRUD和展示为主,跨实体规则少
行为来源因实体类型而异,难以用纯数据表达由配置表、设计师创作的内容驱动
变更频率规则随游戏平衡性迭代变更内容/流程的变更频率远高于逻辑
性能需求可接受富对象图带来的开销需要批处理、缓存友好的布局
网络需求允许有状态对象偏好扁平状态快照(同步、回滚)
团队工作流程序员负责逻辑设计师无需修改代码即可迭代

Phase 3: Implementation Planning & Evolution

阶段3:实现规划与演进

Goal: Create detailed implementation specifications, then review and refine for extensibility and maintainability.
  • Input:
    architect/technical_design.md
  • Output:
    architect/implementation.md
  • References:
    • Use Specific System Architecture documents from
      references/
    • Read
      references/evolution.md
      for evolution strategies
    • Read
      references/performance-optimization.md
      (only if user requires performance optimization)
Step 1 — Implementation Design:
  1. Directory Structure: Define the directory structure for the project
  2. Data Structures: Define all core data types and structures
  3. Algorithms: Specify key algorithms with pseudocode
  4. Class Design: Document class hierarchies and relationships
  5. Object Relationships: Define associations, dependencies, and lifecycles
  6. Key Code Snippets: Provide critical implementation examples
Step 2 — Evolution Review (applied in-place to the output above):
  1. Isolation: Ensure proper separation of concerns across modules
  2. Abstraction: Apply appropriate interface abstractions at change points
  3. Composition: Prefer composition over inheritance where applicable
  4. Future Changes: Anticipate likely evolution and mark extension points

目标:创建详细的实现规范,然后评审并优化以确保可扩展性与可维护性。
  • 输入
    architect/technical_design.md
  • 输出
    architect/implementation.md
  • 参考文档:
    • 使用
      references/
      下的特定系统架构文档
    • 阅读
      references/evolution.md
      了解演进策略
    • 若用户有性能优化需求,阅读
      references/performance-optimization.md
步骤1 — 实现设计:
  1. 目录结构:定义项目的目录结构
  2. 数据结构:定义所有核心数据类型与结构
  3. 算法:用伪代码说明关键算法
  4. 类设计:记录类的层次结构与关系
  5. 对象关系:定义关联、依赖与生命周期
  6. 关键代码片段:提供核心实现示例
步骤2 — 演进评审(直接应用于上述输出):
  1. 隔离性:确保模块间关注点正确分离
  2. 抽象化:在变更点应用合适的接口抽象
  3. 组合优先:适用场景下优先使用组合而非继承
  4. 未来变更:预判可能的演进方向并标记扩展点

Phase 4: Implementation (Out of Scope)

阶段4:实现(不在服务范围内)

The final
architect/implementation.md
is used for actual code implementation.
[!NOTE] Code implementation is not part of this skill. Hand off
implementation.md
to the implementation phase.

最终生成的
architect/implementation.md
将用于实际代码实现。
[!NOTE] 代码实现不属于本技能的服务范围。请将
implementation.md
移交至实现阶段。

Extensions

扩展功能

1. Refactor Phase (On-Demand)

1. 重构阶段(按需触发)

  • Trigger:
    • "User Review" flag is active.
    • OR User requests a refactor/update for a specific document after the fact.
  • Process:
    • Can target any specific Phase 1 - 3 individually.
    • Input: The existing Output file of that phase (e.g.,
      architect/technical_design.md
      if refactoring Phase 2). Crucial: Read the file first as the user may have modified it.
    • Goal: Optimize, correct, or expand the document based on specific user feedback or new insights.
    • Output: Update the target file in-place.

  • 触发条件:
    • 「用户评审」标记已启用。
    • 或用户在事后请求对特定文档进行重构/更新。
  • 流程:
    • 可单独针对阶段1-3中的任意一个阶段。
    • 输入:该阶段已有的输出文件(例如重构阶段2时输入
      architect/technical_design.md
      )。重要:需先读取该文件,因为用户可能已修改过。
    • 目标:根据用户的具体反馈或新见解,优化、修正或扩展文档。
    • 输出:原地更新目标文件。

Output Document Structure

输出文档结构

requirement.md

requirement.md

markdown
undefined
markdown
undefined

{Project Name} - Requirement Analysis

{项目名称} - 需求分析

1. Project Overview

1. 项目概述

Brief description of the project vision, target platform, and core goals.
项目愿景、目标平台与核心目标的简要描述。

2. Feature List

2. 功能列表

CategoryFeaturePriorityNotes
PlatformOS / Device targets-
GenreGame type & sub-genre-
NetworkSingle-player / Multiplayer-
ScopeProject scale & milestones-
PerformanceTarget FPS, memory budget, loading time-
TestabilityTest strategy, debug tools, GM panel-
ObservabilityLogging, monitoring, crash reporting-
DeploymentBuild pipeline, CI/CD, patching-
SecurityAnti-cheat, data validation, encryption-
分类功能优先级备注
平台目标操作系统/设备-
类型游戏类型与子类型-
网络单机/多人-
范围项目规模与里程碑-
性能目标FPS、内存预算、加载时间-
可测试性测试策略、调试工具、GM面板-
可观测性日志、监控、崩溃上报-
部署构建流水线、CI/CD、补丁更新-
安全性反作弊、数据验证、加密-

3. Domain Models

3. 领域模型

For core gameplay and complex logic systems.
针对核心玩法与复杂逻辑系统。

3.1 Domain Vocabulary

3.1 领域词汇表

TermDefinition
术语定义

3.2 Domain Model Diagram

3.2 领域模型图

Entity relationships, state diagrams, system diagrams (use text/mermaid).
实体关系、状态图、系统图(使用文本或mermaid语法)。

4. Use Cases

4. 用例

Per core feature, from summary → informal → detailed as needed.
针对每个核心功能,按需提供摘要→非正式→详细的用例描述。

4.x {Use Case Name}

4.x {用例名称}

  • Actor(s):
  • Preconditions:
  • Main Scenario: (numbered steps)
  • Extension Scenarios: (branch / edge cases)
  • Business Rules: (referenced rule IDs)
  • 参与者:
  • 前置条件:
  • 主场景:(编号步骤)
  • 扩展场景:(分支/边缘情况)
  • 业务规则:(引用规则ID)

5. User Flows

5. 用户流程

Interaction flows for UI, gameplay mechanics, and cutscenes.
UI、玩法机制与过场动画的交互流程。

5.x {Flow Name}

5.x {流程名称}

  • Type: UI Flow / Gameplay / Cutscene
  • Flow Description: (sequential screens/states with transitions)
  • 类型:UI流程 / 玩法流程 / 过场动画
  • 流程描述:(带过渡的连续界面/状态)

6. Iteration Milestones

6. 迭代里程碑

Plan incremental delivery milestones. Each milestone forms a playable/testable Minimum Viable Product (MVP) or meaningful increment.
规划增量交付的里程碑。每个里程碑需形成可玩/可测试的最小可行产品(MVP)或有意义的增量版本。

Milestone {N}: {Name}

里程碑{N}:{名称}

  • Goal: What this milestone validates or delivers.
  • Included Features: (reference Feature List items)
  • Included Use Cases: (reference Use Case IDs from §4)
  • Deliverable: What the user can see / play / test at this point.
  • Acceptance Criteria: How to verify this milestone is complete.
  • Dependencies: Prerequisites from previous milestones.

---
  • 目标:本里程碑要验证或交付的内容。
  • 包含功能:(引用功能列表项)
  • 包含用例:(引用第4节的用例ID)
  • 交付物:用户可体验/游玩/测试的内容。
  • 验收标准:如何验证本里程碑已完成。
  • 依赖:来自之前里程碑的前置条件。

---

technical_design.md

technical_design.md

markdown
undefined
markdown
undefined

{Project Name} - Technical Design

{项目名称} - 技术设计

1. Existing Project Analysis

1. 已有项目分析

Skip this section for new projects.
  • Directory & Module Structure: Layers, namespaces, key entry points.
  • Technology Stack & Dependencies: Engine, language, third-party libraries.
  • Architectural Paradigms in Use: DDD, ECS, MVC, etc.
  • Module Boundaries & Communication: Events, interfaces, direct calls.
  • Data Flow: Config loading, persistence, runtime state management.
  • Constraints & Tech Debt: Coupling issues, performance bottlenecks, deprecated patterns.
  • Integration Points: Where new systems hook in, what to extend.
新项目可跳过本节。
  • 目录与模块结构:分层、命名空间、关键入口。
  • 技术栈与依赖:引擎、编程语言、第三方库。
  • 采用的架构范式:DDD, ECS, MVC等。
  • 模块边界与通信:事件、接口、直接调用。
  • 数据流:配置加载、持久化、运行时状态管理。
  • 约束与技术债务:耦合问题、性能瓶颈、已废弃模式。
  • 集成点:新系统的接入位置、扩展内容。

2. Multi-Application Design

2. 多应用架构设计

  • Network Form: Single-player / Client-Server / P2P.
  • Application List:
    ApplicationRoleDescription
  • Interaction Scheme: Protocol / RPC / API between applications.
  • 网络形式:单机 / 客户端-服务器 / P2P。
  • 应用列表:
    应用角色描述
  • 交互方案:应用间的协议 / RPC / API。

3. Technology Stack

3. 技术栈

CategorySelectionAlternativesReason
Engine
Language
Networking
Data Storage
Key Libraries
分类选型备选方案理由
引擎
编程语言
网络
数据存储
核心库

4. Architecture Overview

4. 架构概述

4.1 Layer Diagram

4.1 分层图

Foundation Layer / Logic Layer / Application Layer separation.
基础层 / 逻辑层 / 应用层的分离。

4.2 Module Map

4.2 模块映射

ModuleLayerParadigmDescription
模块层级范式描述

4.3 Module Dependencies

4.3 模块依赖

Inter-module dependency and communication diagram (events, interfaces).
模块间的依赖与通信图(事件、接口)。

5. Module Design

5. 模块设计

Per module, repeat this section.
每个模块重复本节内容。

5.x {Module Name}

5.x {模块名称}

  • Paradigm: DDD / Data-Driven / Prototype (with justification)
  • Responsibilities: What this module owns.
  • Key Domain Concepts / Data Structures: Core abstractions (no code).
  • External Interfaces: How other modules interact with this one.
  • Internal Flow: Key processes and state transitions.
  • Design Decisions: Trade-offs and rationale.
  • 范式:DDD / 数据驱动 / 原型(附选型理由)
  • 职责:该模块的核心职责。
  • 核心领域概念/数据结构:核心抽象(无需代码)。
  • 外部接口:其他模块与本模块的交互方式。
  • 内部流程:核心流程与状态转换。
  • 设计决策:权衡与选型理由。

6. Milestone System Plan

6. 里程碑系统规划

Map each milestone (from requirement.md §6) to concrete system implementation scope.
将需求分析第6节的每个里程碑映射到具体的系统实现范围。

Milestone {N}: {Name}

里程碑{N}:{名称}

  • Systems to Implement:
    ModuleScope (Full / Partial)Key DeliverablesNotes
  • Integration Work: Cross-module wiring needed for this milestone.
  • Stub / Mock: Systems not yet implemented but needed as placeholders.
  • 待实现系统:
    模块范围(完整/部分)核心交付物备注
  • 集成工作:本里程碑所需的跨模块对接工作。
  • 桩/模拟实现:尚未实现但需作为占位符的系统。

Prototype Iteration Breakdown

原型迭代分解

For modules using the Use-Case Driven Prototype paradigm, further split each milestone into small iterations (1–3 days each).
对于采用用例驱动原型范式的模块,需将每个里程碑进一步拆分为小迭代(每个迭代1-3天)。

Milestone {N} - Iteration {M}: {Short Description}

里程碑{N} - 迭代{M}:{简短描述}

  • Target Use Case: (reference Use Case ID)
  • Implementation Focus: What to build in this iteration.
  • Fake / Deferred: What to stub out (fake data, temp UI, placeholder art).
  • Validation: How to verify the use case works (playtest criteria).
  • Refactor Notes: Technical debt introduced, to be addressed later.

---
  • 目标用例:(引用用例ID)
  • 实现重点:本迭代需完成的内容。
  • 模拟/延迟实现:需用桩替代的内容(模拟数据、临时UI、占位美术)。
  • 验证方式:如何验证用例可正常工作( playtest 标准)。
  • 重构说明:引入的技术债务,后续需处理。

---

implementation.md

implementation.md

markdown
undefined
markdown
undefined

{Project Name} - Implementation Plan

{项目名称} - 实现规划

1. Directory Structure

1. 目录结构

text
project-root/
├── src/
│   ├── foundation/     # Foundation Layer
│   ├── logic/          # Logic Layer modules
│   └── app/            # Application Layer
├── configs/            # Data tables & configurations
├── assets/             # Art, audio, etc.
└── tests/
text
project-root/
├── src/
│   ├── foundation/     # 基础层
│   ├── logic/          # 逻辑层模块
│   └── app/            # 应用层
├── configs/            # 数据表与配置
├── assets/             # 美术、音频等资源
└── tests/

2. Data Structures

2. 数据结构

Per module, define core types.
每个模块单独定义核心数据类型与结构。

2.x {Module} Data Structures

2.x {模块} 数据结构

  • Type Name: Purpose, fields, constraints.
  • Relationships: References (by ID), ownership, lifecycle.
  • Data Classification: Config (static) / Data (persistent) / Instance (runtime).
  • 类型名称:用途、字段、约束。
  • 关系:引用方式(通过ID)、所有权、生命周期。
  • 数据分类:配置(静态)/ 数据(持久化)/ 实例(运行时)。

3. Key Algorithms

3. 关键算法

3.x {Algorithm Name}

3.x {算法名称}

  • Purpose:
  • Input / Output:
  • Pseudocode: (step-by-step)
  • Complexity: Time & space.
  • 用途:
  • 输入/输出:
  • 伪代码:(分步说明)
  • 复杂度:时间与空间复杂度。

4. Class Design

4. 类设计

Per module, document class hierarchies.
每个模块记录类的层次结构。

4.x {Module} Classes

4.x {模块} 类

  • Class Diagram: Inheritance & composition relationships (text/mermaid).
  • Key Classes:
    ClassRole (Entity/Service/VO/Repository/Factory)Responsibilities
  • Interface Definitions: Abstract contracts between components.
  • 类图:继承与组合关系(文本或mermaid语法)。
  • 核心类:
    角色(实体/服务/值对象/仓库/工厂)职责
  • 接口定义:组件间的抽象契约。

5. Object Relationships

5. 对象关系

5.x {Module or Cross-Module} Relationships

5.x {模块或跨模块} 关系

  • Associations: Who holds references to whom (and how: direct / ID / event).
  • Lifecycles: Creation → active use → disposal flow.
  • Ownership: Aggregate boundaries, who manages disposal.
  • 关联:谁持有谁的引用(方式:直接引用/ ID / 事件)。
  • 生命周期:创建→活跃使用→销毁流程。
  • 所有权:聚合边界,谁负责销毁对象。

6. Key Code Snippets

6. 关键代码片段

Critical implementation examples that clarify design intent.
用于明确设计意图的核心实现示例。

6.x {Snippet Title}

6.x {片段标题}

  • Context: Which class/module this belongs to.
  • Code: (language-appropriate snippet)
  • Notes: Why this approach, edge cases to handle.
  • 上下文:所属的类/模块。
  • 代码:(对应编程语言的代码片段)
  • 说明:为何采用该方案、需处理的边缘情况。

7. Evolution & Extension Points

7. 演进与扩展点

Document decisions from the Evolution Review (Phase 3 Step 2).
记录阶段3步骤2中演进评审的决策。

7.x {Module or Cross-Module}

7.x {模块或跨模块}

  • Isolation: How this module is decoupled from others (communication method, dependency direction).
  • Abstractions: Interfaces / strategies introduced at change points (and why).
  • Composition: Component or strategy splits applied (what was decomposed, how parts recombine).
  • Anticipated Changes: Likely future requirements and the extension points reserved for them.

---
  • 隔离性:本模块与其他模块的解耦方式(通信方法、依赖方向)。
  • 抽象化:在变更点引入的接口/策略(及原因)。
  • 组合:应用的组件或策略拆分(拆分的内容、各部分的组合方式)。
  • 预期变更:可能的未来需求及预留的扩展点。

---

Example Workflows

示例工作流

Example 1: New Project (DDD Focus)

示例1:新项目(以DDD为主)

  • User Input: "I want to build an ARPG with complex combat involving many states, damage rules, and AI interactions."
  • Execution Path:
    1. Phase 0: Ask review preference.
    2. Phase 1 - Requirement Analysis:
      • Read
        references/requirements.md
        .
      • Focus on Domain Model Analysis for combat entities and Use Cases for combat flows.
      • Plan milestones (e.g., M1: basic movement + attack, M2: damage rules + buffs, M3: AI combat).
      • Output:
        architect/requirement.md
        .
    3. Phase 2 - Technical Design:
      • Read
        references/macro-design.md
        +
        references/principles.md
        .
      • Define multi-application structure and technology stack.
      • Select DDD for core combat (high rule complexity, rich domain concepts). Read
        references/domain-driven-design.md
        .
      • System refs:
        system-skill.md
        ,
        system-action-combat.md
        ,
        system-time.md
        ,
        system-scene.md
        ,
        algorithm.md
        .
      • Map milestones to system scope (Milestone System Plan).
      • Output:
        architect/technical_design.md
        .
    4. Phase 3 - Implementation Planning & Evolution:
      • Read
        references/evolution.md
        .
      • Step 1: Design data structures, class hierarchies, and key algorithms for combat systems.
      • Step 2: Apply composition and abstraction patterns; mark extension points for new weapon/enemy types.
      • Output:
        architect/implementation.md
        .
  • 用户输入:"我想做一款ARPG,包含复杂的战斗系统,有多种状态、伤害规则和AI交互。"
  • 执行路径:
    1. 阶段0:询问评审偏好。
    2. 阶段1 - 需求分析:
      • 阅读
        references/requirements.md
      • 重点分析战斗实体的领域模型和战斗流程的用例
      • 规划里程碑(例如M1:基础移动+攻击,M2:伤害规则+Buff,M3:AI战斗)。
      • 输出:
        architect/requirement.md
    3. 阶段2 - 技术设计:
      • 阅读
        references/macro-design.md
        +
        references/principles.md
      • 定义多应用架构与技术栈。
      • 核心战斗系统选择DDD(规则复杂度高、领域概念丰富)。阅读
        references/domain-driven-design.md
      • 参考系统文档:
        system-skill.md
        ,
        system-action-combat.md
        ,
        system-time.md
        ,
        system-scene.md
        ,
        algorithm.md
      • 将里程碑映射到系统范围(里程碑系统规划)。
      • 输出:
        architect/technical_design.md
    4. 阶段3 - 实现规划与演进:
      • 阅读
        references/evolution.md
      • 步骤1:设计战斗系统的数据结构、类层次与关键算法。
      • 步骤2:应用组合与抽象模式,为新武器/敌人类型预留扩展点。
      • 输出:
        architect/implementation.md

Example 2: Existing Project (Hybrid Paradigms)

示例2:已有项目(混合范式)

  • User Input: "I want to add a Skill System to my current combat engine. It needs effects, cooldowns, and data-configurable skills."
  • Execution Path:
    1. Phase 0: Ask review preference.
    2. Phase 1 - Requirement Analysis:
      • Read
        references/requirements.md
        .
      • Define domain entities (Skill, Effect) and use cases for skill interactions.
      • Plan milestones (e.g., M1: basic skill cast + cooldown, M2: effects + buffs, M3: data-configurable skills).
      • Output:
        architect/requirement.md
        .
    3. Phase 2 - Technical Design:
      • Analyze existing project code to understand current architecture.
      • Read
        references/macro-design.md
        +
        references/principles.md
        .
      • Select DDD for core skill logic (rules, interactions). Read
        references/domain-driven-design.md
        .
      • Select Data-Driven for skill configurations (tables, content). Read
        references/data-driven-design.md
        .
      • System refs:
        system-skill.md
        ,
        system-foundation.md
        ,
        system-time.md
        .
      • Map milestones to system scope (Milestone System Plan).
      • Output:
        architect/technical_design.md
        .
    4. Phase 3 - Implementation Planning & Evolution:
      • Read
        references/evolution.md
        .
      • Step 1: Design skill data structures, effect class hierarchies, and configuration schemas.
      • Step 2: Apply composition (component pattern for reusable effects) and abstraction (interfaces for targeting); ensure isolation from existing combat modules.
      • Output:
        architect/implementation.md
        .
  • 用户输入:"我想给现有的战斗引擎添加一个技能系统,需要包含效果、冷却时间和可配置的技能。"
  • 执行路径:
    1. 阶段0:询问评审偏好。
    2. 阶段1 - 需求分析:
      • 阅读
        references/requirements.md
      • 定义领域实体(技能、效果)和技能交互的用例。
      • 规划里程碑(例如M1:基础技能释放+冷却,M2:效果+Buff,M3:可配置技能)。
      • 输出:
        architect/requirement.md
    3. 阶段2 - 技术设计:
      • 分析现有项目代码,理解当前架构。
      • 阅读
        references/macro-design.md
        +
        references/principles.md
      • 核心技能逻辑选择DDD(规则、交互)。阅读
        references/domain-driven-design.md
      • 技能配置选择数据驱动(表格、内容)。阅读
        references/data-driven-design.md
      • 参考系统文档:
        system-skill.md
        ,
        system-foundation.md
        ,
        system-time.md
      • 将里程碑映射到系统范围(里程碑系统规划)。
      • 输出:
        architect/technical_design.md
    4. 阶段3 - 实现规划与演进:
      • 阅读
        references/evolution.md
      • 步骤1:设计技能数据结构、效果类层次与配置 schema。
      • 步骤2:应用组合模式(可复用效果的组件模式)与抽象模式(目标选择接口);确保与现有战斗模块的隔离性。
      • 输出:
        architect/implementation.md

Example 3: Rapid Prototype

示例3:快速原型

  • User Input: "I have a puzzle mechanic idea. I want to build a quick demo this weekend to validate it."
  • Execution Path:
    1. Phase 0: Ask review preference.
    2. Phase 1 - Requirement Analysis (lightweight):
      • Read
        references/requirements.md
        .
      • Minimal analysis, focus on core puzzle mechanic.
      • Plan milestones as iterations (e.g., M1: display map, M2: character movement, M3: puzzle interaction).
      • Output:
        architect/requirement.md
        .
    3. Phase 2 - Technical Design (lightweight):
      • Read
        references/macro-design.md
        +
        references/principles.md
        .
      • Select Use-Case Driven Prototype. Read
        references/prototype-design.md
        .
      • System refs as needed:
        system-time.md
        ,
        algorithm.md
        .
      • Map milestones to prototype iteration breakdown.
      • Output:
        architect/technical_design.md
        .
    4. Phase 3 - Implementation Planning & Evolution:
      • Read
        references/evolution.md
        .
      • Step 1: Focus on rapid implementation of core use case; minimal class design.
      • Step 2: Plan extraction points for after mechanic is validated; mark refactor targets.
      • Output:
        architect/implementation.md
        .
  • 用户输入:"我有一个解谜玩法的想法,想在周末做一个快速Demo来验证。"
  • 执行路径:
    1. 阶段0:询问评审偏好。
    2. 阶段1 - 需求分析(轻量化):
      • 阅读
        references/requirements.md
      • 仅做最小化分析,聚焦核心解谜机制。
      • 将里程碑规划为迭代(例如M1:显示地图,M2:角色移动,M3:解谜交互)。
      • 输出:
        architect/requirement.md
    3. 阶段2 - 技术设计(轻量化):
      • 阅读
        references/macro-design.md
        +
        references/principles.md
      • 选择用例驱动原型范式。阅读
        references/prototype-design.md
      • 按需参考系统文档:
        system-time.md
        ,
        algorithm.md
      • 将里程碑映射到原型迭代分解。
      • 输出:
        architect/technical_design.md
    4. 阶段3 - 实现规划与演进:
      • 阅读
        references/evolution.md
      • 步骤1:聚焦核心用例的快速实现,简化类设计。
      • 步骤2:规划玩法验证后的代码提取点,标记重构目标。
      • 输出:
        architect/implementation.md

Example 4: Refactor Extension (On-Demand)

示例4:重构扩展(按需)

  • User Input: "I've drafted the implementation plan. Review and refactor it for better architecture and performance."
  • Execution Path:
    1. Read existing
      architect/implementation.md
      .
    2. Refactor Phase (Extension) targeting Phase 3:
      • Read
        references/evolution.md
        .
      • Read
        references/performance-optimization.md
        (user requested performance).
      • Apply isolation, composition, and abstraction patterns.
      • Introduce pooling, caching, or time-slicing where needed.
      • Update:
        architect/implementation.md
        .

  • 用户输入:"我已经写好了实现规划,请评审并重构以优化架构和性能。"
  • 执行路径:
    1. 读取已有的
      architect/implementation.md
    2. 重构阶段(扩展) 针对阶段3:
      • 阅读
        references/evolution.md
      • 阅读
        references/performance-optimization.md
        (用户要求优化性能)。
      • 应用隔离、组合与抽象模式。
      • 按需引入对象池、缓存或时间切片。
      • 更新:
        architect/implementation.md