architecture-design
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMANDATORY IMPORTANT MUST use to break ALL work into small tasks BEFORE starting.
MANDATORY IMPORTANT MUST use at EVERY decision point — never assume user preferences.
MANDATORY IMPORTANT MUST research top 3 options per architecture concern, compare with evidence, present report with recommendation + confidence %.
TaskCreateAskUserQuestionExternal Memory: For complex or lengthy work (research, analysis, scan, review), write intermediate findings and final results to a report file in— prevents context loss and serves as deliverable.plans/reports/
Evidence Gate: MANDATORY IMPORTANT MUST — every claim, finding, and recommendation requiresproof or traced evidence with confidence percentage (>80% to act, <80% must verify first).file:line
强制要求 重要须知 在开始所有工作前,必须使用将其拆分为小型任务。
强制要求 重要须知 在每个决策点必须使用——绝不假设用户偏好。
强制要求 重要须知 针对每个架构关注点研究Top3方案,结合证据进行对比,呈现包含推荐方案及置信度百分比的报告。
TaskCreateAskUserQuestion外部内存:对于复杂或冗长的工作(研究、分析、扫描、评审),将中间结果和最终结果写入目录下的报告文件中——避免上下文丢失,同时作为交付物。plans/reports/
证据校验:强制要求 重要须知 —— 每一个主张、发现和推荐都需要格式的证据或可追溯的证据,并附带置信度百分比(置信度>80%才可执行,<80%必须先验证)。file:line
Quick Summary
快速概述
Goal: Act as a solution architect — research, critically analyze, and recommend the complete technical architecture for a project or feature. Cover ALL architecture concerns: backend, frontend, design patterns, library ecosystem, testing strategy, CI/CD, deployment, monitoring, code quality, and dependency management. Produce a comprehensive comparison report with actionable recommendations.
Workflow (12 steps):
- Load Context — Read domain model, tech stack, business evaluation, refined PBI
- Derive Architecture Requirements — Map business/domain complexity to architecture constraints
- Backend Architecture — Research top 3 backend architecture styles + design patterns
- Frontend Architecture — Research top 3 frontend architecture styles + design patterns
- Library Ecosystem Research — Best-practice libraries per concern (validation, caching, logging, utils, etc.)
- Testing Architecture — Unit, integration, E2E, performance testing frameworks + strategy
- CI/CD & Deployment — Pipeline design, containerization, orchestration, IaC
- Observability & Monitoring — Logging, metrics, tracing, alerting stack
- Code Quality & Clean Code — Linters, analyzers, formatters, enforcement tooling
- Dependency Risk Assessment — Package health, obsolescence risk, maintenance cost
- Generate Report — Full architecture decision report with all recommendations
- User Validation — Present findings, ask 8-12 questions, confirm all decisions
Key Rules:
- MANDATORY IMPORTANT MUST research minimum 3 options per architecture concern with web evidence
- MANDATORY IMPORTANT MUST include confidence % with evidence for every recommendation
- MANDATORY IMPORTANT MUST run user validation interview at end (never skip)
- Delegate to agent for complex architecture decisions
solution-architect - All claims must cite sources (URL, benchmark, case study, or codebase evidence)
- Never recommend based on familiarity alone — evidence required
Be skeptical. Apply critical thinking, sequential thinking. Every claim needs traced proof, confidence percentages (Idea should be more than 80%).
目标:担任解决方案架构师——研究、批判性分析并为项目或功能推荐完整的技术架构。覆盖所有架构关注点:后端、前端、设计模式、库生态系统、测试策略、CI/CD、部署、监控、代码质量和依赖管理。生成包含可执行建议的综合对比报告。
工作流程(12步):
- 加载上下文 — 读取领域模型、技术栈、业务评估、细化后的PBI
- 推导架构需求 — 将业务/领域复杂度映射为架构约束
- 后端架构 — 研究Top3后端架构风格+设计模式
- 前端架构 — 研究Top3前端架构风格+设计模式
- 库生态系统研究 — 各关注点的最佳实践库(验证、缓存、日志、工具类等)
- 测试架构 — 单元测试、集成测试、E2E测试、性能测试框架+策略
- CI/CD与部署 — 流水线设计、容器化、编排、IaC
- 可观测性与监控 — 日志、指标、链路追踪、告警栈
- 代码质量与整洁代码 — 代码检查器、分析器、格式化工具、强制执行工具
- 依赖风险评估 — 包健康度、过时风险、维护成本
- 生成报告 — 包含所有推荐的完整架构决策报告
- 用户验证 — 呈现研究结果,提出8-12个问题,确认所有决策
核心规则:
- 强制要求 重要须知 针对每个架构关注点至少研究3个方案,并提供网络证据
- 强制要求 重要须知 每个推荐方案必须附带置信度百分比和证据
- 强制要求 重要须知 最后必须进行用户验证访谈(绝不跳过)
- 复杂架构决策委托给agent
solution-architect - 所有主张必须引用来源(URL、基准测试、案例研究或代码库证据)
- 绝不仅凭熟悉度推荐——必须有证据支持
保持怀疑态度。运用批判性思维、顺序思维。每一个主张都需要可追溯的证据和置信度百分比(想法置信度需超过80%)。
Step 1: Load Context
步骤1:加载上下文
Read artifacts from prior workflow steps (search in and ):
plans/team-artifacts/- Domain model / ERD (complexity, bounded contexts, aggregate count)
- Tech stack decisions (confirmed languages, frameworks, databases)
- Business evaluation (scale, constraints, compliance)
- Refined PBI (scope, acceptance criteria)
- Discovery interview (team skills, experience level)
Extract and summarize:
| Signal | Value | Source |
|---|---|---|
| Bounded contexts | ... | domain model |
| Aggregate count | ... | domain model |
| Cross-context events | ... | domain model |
| Confirmed tech stack | ... | tech stack phase |
| Expected scale | ... | business eval |
| Team architecture exp. | ... | discovery |
| Compliance requirements | ... | business eval |
| Real-time needs | Yes/No | refined PBI |
| Integration complexity | Low/Med/High | domain model |
| Deployment target | ... | business eval |
读取先前工作流程步骤中的工件(在和中搜索):
plans/team-artifacts/- 领域模型/ERD(复杂度、限界上下文、聚合根数量)
- 技术栈决策(已确认的语言、框架、数据库)
- 业务评估(规模、约束、合规性)
- 细化后的PBI(范围、验收标准)
- 发现访谈(团队技能、经验水平)
提取并总结:
| 信号 | 值 | 来源 |
|---|---|---|
| 限界上下文 | ... | 领域模型 |
| 聚合根数量 | ... | 领域模型 |
| 跨上下文事件 | ... | 领域模型 |
| 已确认技术栈 | ... | 技术栈阶段 |
| 预期规模 | ... | 业务评估 |
| 团队架构经验 | ... | 发现访谈 |
| 合规要求 | ... | 业务评估 |
| 实时需求 | 是/否 | 细化后的PBI |
| 集成复杂度 | 低/中/高 | 领域模型 |
| 部署目标 | ... | 业务评估 |
Step 2: Derive Architecture Requirements
步骤2:推导架构需求
Map signals to architecture constraints:
| Signal | Architecture Requirement | Priority |
|---|---|---|
| Many bounded contexts | Clear module boundaries, context isolation | Must |
| High scale | Horizontal scaling, stateless services, caching strategy | Must |
| Complex domain | Rich domain model, separation of domain from infra | Must |
| Cross-context events | Event-driven communication, eventual consistency | Must |
| Small team | Low ceremony, fewer layers, convention over configuration | Should |
| Compliance | Audit trail, immutable events, access control layers | Must |
| Real-time | Event sourcing or pub/sub, WebSocket/SSE support | Should |
| High integration complexity | Anti-corruption layers, adapter pattern, API gateway | Should |
MANDATORY IMPORTANT MUST validate derived requirements with user via before proceeding.
AskUserQuestion将信号映射为架构约束:
| 信号 | 架构需求 | 优先级 |
|---|---|---|
| 多个限界上下文 | 清晰的模块边界、上下文隔离 | 必须 |
| 高规模需求 | 水平扩展、无状态服务、缓存策略 | 必须 |
| 复杂领域 | 丰富的领域模型、领域与基础设施分离 | 必须 |
| 跨上下文事件 | 事件驱动通信、最终一致性 | 必须 |
| 小型团队 | 低仪式感、更少层级、约定优于配置 | 应该 |
| 合规要求 | 审计追踪、不可变事件、访问控制层 | 必须 |
| 实时需求 | 事件溯源或发布/订阅、WebSocket/SSE支持 | 应该 |
| 高集成复杂度 | 防腐层、适配器模式、API网关 | 应该 |
强制要求 重要须知 在继续之前,必须通过与用户验证推导的需求。
AskUserQuestionStep 3: Backend Architecture
步骤3:后端架构
3A: Architecture Styles
3A:架构风格
WebSearch top 3 backend architecture styles. Candidates:
| Style | Best For | Research Focus |
|---|---|---|
| Clean Architecture | Complex domains, long-lived projects | Dependency rule, testability, flexibility |
| Hexagonal (Ports+Adapt) | Integration-heavy, multiple I/O adapters | Port contracts, adapter isolation |
| Vertical Slice | Feature-focused teams, rapid delivery | Slice isolation, code locality |
| Modular Monolith | Starting simple, eventual decomposition | Module boundaries, migration path |
| Microservices | Large teams, independent deployment | Service boundaries, operational overhead |
| CQRS + Event Sourcing | Audit-heavy, complex queries | Read/write separation, event store |
| Layered (N-Tier) | Simple CRUD, small teams | Layer responsibilities, coupling risk |
Web搜索Top3后端架构风格。候选风格:
| 架构风格 | 适用场景 | 研究重点 |
|---|---|---|
| Clean Architecture | 复杂领域、长期维护的项目 | 依赖规则、可测试性、灵活性 |
| Hexagonal (Ports+Adapt) | 集成密集型、多I/O适配器场景 | 端口契约、适配器隔离 |
| Vertical Slice | 以功能为中心的团队、快速交付 | 切片隔离、代码本地性 |
| Modular Monolith | 从简单开始、最终拆分 | 模块边界、迁移路径 |
| Microservices | 大型团队、独立部署 | 服务边界、运维开销 |
| CQRS + Event Sourcing | 审计密集型、复杂查询 | 读写分离、事件存储 |
| Layered (N-Tier) | 简单CRUD、小型团队 | 层级职责、耦合风险 |
3B: Backend Design Patterns
3B:后端设计模式
Evaluate applicability per layer:
| Pattern | Layer | When to Apply |
|---|---|---|
| Repository | Data Access | Abstract data store, enable testing |
| CQRS | Application | Separate read/write models, complex queries |
| Mediator | Application | Decouple handlers from controllers |
| Strategy | Domain/App | Multiple interchangeable algorithms |
| Observer/Events | Domain | Cross-aggregate side effects |
| Factory | Domain | Complex object creation with invariants |
| Decorator | Cross-cutting | Add behavior without modifying (logging, caching) |
| Adapter | Infrastructure | Isolate external dependencies |
| Specification | Domain | Composable business rules, complex filtering |
| Unit of Work | Data Access | Transaction management across repositories |
| Saga/Orchestr. | Cross-service | Distributed transactions, compensating actions |
| Outbox | Messaging | Reliable event publishing with DB transactions |
| Circuit Breaker | Infrastructure | External service resilience |
For each recommended pattern, document: Apply to, Why, Example, Risk if skipped.
评估各层级的适用性:
| 设计模式 | 层级 | 适用场景 |
|---|---|---|
| Repository | 数据访问层 | 抽象数据存储、支持测试 |
| CQRS | 应用层 | 读写模型分离、复杂查询 |
| Mediator | 应用层 | 解耦处理器与控制器 |
| Strategy | 领域层/应用层 | 多种可互换算法 |
| Observer/Events | 领域层 | 跨聚合根副作用 |
| Factory | 领域层 | 带不变量的复杂对象创建 |
| Decorator | 横切关注点 | 不修改原有代码的情况下添加行为(日志、缓存) |
| Adapter | 基础设施层 | 隔离外部依赖 |
| Specification | 领域层 | 可组合的业务规则、复杂过滤 |
| Unit of Work | 数据访问层 | 跨仓库的事务管理 |
| Saga/Orchestr. | 跨服务层 | 分布式事务、补偿操作 |
| Outbox | 消息层 | 结合数据库事务的可靠事件发布 |
| Circuit Breaker | 基础设施层 | 外部服务容错 |
对于每个推荐的模式,记录:应用层级、原因、示例、跳过风险。
Step 4: Frontend Architecture
步骤4:前端架构
4A: Architecture Styles
4A:架构风格
WebSearch top 3 frontend architecture styles. Candidates:
| Style | Best For | Research Focus |
|---|---|---|
| MVVM | Data-binding heavy, forms-over-data apps | ViewModel responsibility, two-way binding |
| MVC | Server-rendered, traditional web apps | Controller routing, view separation |
| Component Architecture | Modern SPA (React, Angular, Vue) | Component isolation, props/events, reuse |
| Reactive Store (Redux) | Complex state, multi-component sync | Single source of truth, immutable state |
| Signal-based Reactivity | Fine-grained reactivity (Angular 19, Solid) | Granular updates, no zone.js overhead |
| Micro Frontends | Multiple teams, independent deployment | Module federation, routing, shared state |
| Feature-based Modules | Large monolith SPA, lazy loading | Feature boundaries, route-level splitting |
| Server Components (RSC) | SEO, initial load performance | Server/client boundary, streaming |
Web搜索Top3前端架构风格。候选风格:
| 架构风格 | 适用场景 | 研究重点 |
|---|---|---|
| MVVM | 重度数据绑定、以表单数据为主的应用 | ViewModel职责、双向绑定 |
| MVC | 服务端渲染、传统Web应用 | 控制器路由、视图分离 |
| Component Architecture | 现代SPA(React、Angular、Vue) | 组件隔离、Props/事件、复用 |
| Reactive Store (Redux) | 复杂状态、多组件同步 | 单一数据源、不可变状态 |
| Signal-based Reactivity | 细粒度响应式(Angular 19、Solid) | 粒度更新、无zone.js开销 |
| Micro Frontends | 多团队、独立部署 | 模块联邦、路由、共享状态 |
| Feature-based Modules | 大型单体SPA、懒加载 | 功能边界、路由级拆分 |
| Server Components (RSC) | SEO、首屏加载性能 | 服务端/客户端边界、流式传输 |
4B: Frontend Design Patterns
4B:前端设计模式
| Pattern | Layer | When to Apply |
|---|---|---|
| Container/Presentational | Component | Separate logic from UI rendering |
| Reactive Store | State | Centralized state, cross-component communication |
| Facade Service | Service | Simplify complex API interactions |
| Adapter/Mapper | Data | Transform API response to view model |
| Observer (RxJS) | Async | Event streams, real-time data, debounce/throttle |
| Strategy (renderers) | UI | Conditional rendering strategies per entity type |
| Composite (components) | UI | Tree structures, recursive components |
| Command (undo/redo) | UX | Form wizards, canvas editors, undoable actions |
| Lazy Loading | Performance | Route/module-level code splitting |
| Virtual Scrolling | Performance | Large lists, infinite scroll |
| 设计模式 | 层级 | 适用场景 |
|---|---|---|
| Container/Presentational | 组件层 | 逻辑与UI渲染分离 |
| Reactive Store | 状态层 | 集中式状态、跨组件通信 |
| Facade Service | 服务层 | 简化复杂API交互 |
| Adapter/Mapper | 数据层 | 将API响应转换为视图模型 |
| Observer (RxJS) | 异步层 | 事件流、实时数据、防抖/节流 |
| Strategy (renderers) | UI层 | 针对实体类型的条件渲染策略 |
| Composite (components) | UI层 | 树形结构、递归组件 |
| Command (undo/redo) | UX层 | 表单向导、画布编辑器、可撤销操作 |
| Lazy Loading | 性能优化层 | 路由/模块级代码拆分 |
| Virtual Scrolling | 性能优化层 | 大型列表、无限滚动 |
Step 4B: UI System Architecture
步骤4B:UI系统架构
Skip if: Backend-only project, no frontend component.
Research and recommend the project's design system architecture. Use for each decision.
AskUserQuestion跳过条件:纯后端项目,无前端组件。
研究并推荐项目的设计系统架构。每个决策都使用。
AskUserQuestion4B-1: Styling Approach
4B-1:样式方案
WebSearch top 3 styling approaches for the confirmed frontend framework:
| Approach | Best For | Research Focus |
|---|---|---|
| Utility-first (Tailwind CSS) | Rapid prototyping, design enforcement | JIT, custom config, design tokens |
| CSS Modules / Scoped CSS | Component isolation, no global conflicts | Naming, composition patterns |
| SCSS/SASS with BEM | Complex theming, token variables | BEM methodology, mixin libraries |
| CSS-in-JS | Dynamic styling, theme providers | Runtime perf, SSR support |
| CSS Custom Properties | Native theming, framework-agnostic | Browser support, fallback strategy |
Web搜索已确认前端框架的Top3样式方案:
| 方案 | 适用场景 | 研究重点 |
|---|---|---|
| Utility-first (Tailwind CSS) | 快速原型设计、设计规范落地 | JIT、自定义配置、设计令牌 |
| CSS Modules / Scoped CSS | 组件隔离、无全局冲突 | 命名规范、组合模式 |
| SCSS/SASS with BEM | 复杂主题、令牌变量 | BEM方法论、混合库 |
| CSS-in-JS | 动态样式、主题提供器 | 运行时性能、SSR支持 |
| CSS Custom Properties | 原生主题、框架无关 | 浏览器支持、降级策略 |
4B-2: Design Token Strategy
4B-2:设计令牌策略
| Decision | Options | Default |
|---|---|---|
| Token format | CSS custom properties / JSON / SCSS variables | CSS custom properties |
| Token categories | Color, spacing, typography, breakpoints, shadows, z-index | All |
| Token naming | Semantic ( | Semantic first |
| Theming | Light/dark toggle / Multi-brand / Single theme | Single + dark mode |
| 决策 | 选项 | 默认值 |
|---|---|---|
| 令牌格式 | CSS自定义属性 / JSON / SCSS变量 | CSS自定义属性 |
| 令牌分类 | 颜色、间距、排版、断点、阴影、z-index | 全部 |
| 令牌命名 | 语义化( | 优先语义化 |
| 主题支持 | 亮/暗模式切换 / 多品牌 / 单一主题 | 单一主题+暗模式 |
4B-3: Component Library Strategy
4B-3:组件库策略
| Decision | Options | Default |
|---|---|---|
| Library | Build custom / Headless (Radix, Headless UI) / Full kit (MUI, Ant, PrimeNG) | Based on team and timeline |
| Component tiers | Common → Domain-Shared → Page (per ui-wireframe-protocol) | Standard 3-tier |
| Documentation | Storybook / Docusaurus / In-code only | Based on team size |
| 决策 | 选项 | 默认值 |
|---|---|---|
| 组件库 | 自定义构建 / Headless(Radix、Headless UI) / 完整套件(MUI、Ant、PrimeNG) | 基于团队和时间线 |
| 组件层级 | 通用 → 领域共享 → 页面(遵循ui-wireframe-protocol) | 标准3-tier |
| 文档 | Storybook / Docusaurus / 仅代码内文档 | 基于团队规模 |
4B-4: Responsive Strategy
4B-4:响应式策略
| Decision | Options | Default |
|---|---|---|
| Approach | Mobile-first / Desktop-first / Adaptive | Mobile-first |
| Breakpoints | 320/768/1024/1280 / Custom | Standard |
| Grid system | CSS Grid / Flexbox / Framework grid | CSS Grid + Flexbox |
MANDATORY IMPORTANT MUST validate all UI system decisions with user via before proceeding to Step 5.
AskUserQuestion| 决策 | 选项 | 默认值 |
|---|---|---|
| 方案 | 移动端优先 / 桌面端优先 / 自适应 | 移动端优先 |
| 断点 | 320/768/1024/1280 / 自定义 | 标准 |
| 网格系统 | CSS Grid / Flexbox / 框架内置网格 | CSS Grid + Flexbox |
强制要求 重要须知 在进入步骤5之前,必须通过与用户验证所有UI系统决策。
AskUserQuestionStep 5: Library Ecosystem Research
步骤5:库生态系统研究
For EACH concern below, WebSearch top 3 library options for the confirmed tech stack. Evaluate: maturity, community, bundle size, maintenance activity, license, learning curve.
针对以下每个关注点,Web搜索已确认技术栈的Top3库选项。评估:成熟度、社区活跃度、包体积、维护活跃度、许可证、学习曲线。
Library Concerns Checklist
库关注点清单
| Concern | What to Research | Evaluation Criteria |
|---|---|---|
| Validation | Input validation, schema validation, form validation | Type safety, composability, error messages |
| HTTP Client / API Layer | REST client, GraphQL client, API code generation | Interceptors, retry, caching, type generation |
| State Management | Global store, local state, server state caching | DevTools, SSR support, bundle size |
| Utilities / Helpers | Date/time, collections, deep clone, string manipulation | Tree-shakability, size, native alternatives |
| Caching | In-memory cache, distributed cache, HTTP cache, query cache | TTL, invalidation, persistence |
| Logging | Structured logging, log levels, log aggregation | Structured output, transports, performance |
| Error Handling | Global error boundary, error tracking, crash reporting | Source maps, breadcrumbs, alerting integration |
| Authentication / AuthZ | JWT, OAuth, RBAC/ABAC, session management | Standards compliance, SSO, token refresh |
| File Upload / Storage | Multipart upload, cloud storage SDK, image processing | Streaming, resumable, size limits |
| Real-time | WebSocket, SSE, SignalR, Socket.io | Reconnection, scaling, protocol support |
| Internationalization | i18n, l10n, pluralization, date/number formatting | ICU support, lazy loading, extraction tools |
| PDF / Export | PDF generation, Excel export, CSV | Server-side vs client-side, template support |
| 关注点 | 研究内容 | 评估标准 |
|---|---|---|
| 验证 | 输入验证、 schema验证、表单验证 | 类型安全、可组合性、错误提示 |
| HTTP客户端/API层 | REST客户端、GraphQL客户端、API代码生成 | 拦截器、重试、缓存、类型生成 |
| 状态管理 | 全局存储、本地状态、服务端状态缓存 | DevTools、SSR支持、包体积 |
| 工具类/辅助函数 | 日期/时间、集合、深克隆、字符串处理 | 摇树优化支持、体积、原生替代方案 |
| 缓存 | 内存缓存、分布式缓存、HTTP缓存、查询缓存 | TTL、失效策略、持久化 |
| 日志 | 结构化日志、日志级别、日志聚合 | 结构化输出、传输方式、性能 |
| 错误处理 | 全局错误边界、错误追踪、崩溃报告 | Source Maps、面包屑、告警集成 |
| 认证/授权 | JWT、OAuth、RBAC/ABAC、会话管理 | 标准合规、SSO、令牌刷新 |
| 文件上传/存储 | 多部分上传、云存储SDK、图像处理 | 流式传输、可恢复、大小限制 |
| 实时 | WebSocket、SSE、SignalR、Socket.io | 重连机制、扩展性、协议支持 |
| 国际化 | i18n、l10n、复数化、日期/数字格式化 | ICU支持、懒加载、提取工具 |
| PDF/导出 | PDF生成、Excel导出、CSV | 服务端vs客户端、模板支持 |
Per-Library Evaluation Template
单库评估模板
markdown
undefinedmarkdown
undefined{Concern}: Top 3 Options
{关注点}:Top3选项
| Criteria | Option A | Option B | Option C |
|---|---|---|---|
| GitHub Stars | ... | ... | ... |
| Last Release | ... | ... | ... |
| Bundle Size | ... | ... | ... |
| Weekly Downloads | ... | ... | ... |
| License | ... | ... | ... |
| Maintenance | Active/Slow/Stale | ... | ... |
| Learning Curve | Low/Med/High | ... | ... |
Recommendation: {Option} — Confidence: {X}%
---| 评估标准 | 选项A | 选项B | 选项C |
|---|---|---|---|
| GitHub Stars | ... | ... | ... |
| 最后发布日期 | ... | ... | ... |
| 包体积 | ... | ... | ... |
| 周下载量 | ... | ... | ... |
| 许可证 | ... | ... | ... |
| 维护状态 | 活跃/缓慢/停滞 | ... | ... |
| 学习曲线 | 低/中/高 | ... | ... |
推荐方案: {选项} — 置信度:{X}%
---Step 6: Testing Architecture
步骤6:测试架构
Research best testing tools and strategy for the confirmed tech stack:
| Testing Layer | What to Research | Top Candidates to Compare |
|---|---|---|
| Unit Testing | Test runner, assertion library, mocking framework | Jest/Vitest/xUnit/NUnit, mocking |
| Integration Testing | API testing, DB testing, service testing | Supertest, TestContainers, WebAppFactory |
| E2E Testing | Browser automation, BDD, visual regression | Playwright/Cypress/Selenium, SpecFlow |
| Performance Testing | Load testing, stress testing, benchmarking | k6/Artillery/JMeter/NBomber, BenchmarkDotNet |
| Contract Testing | API contract validation between services | Pact, Dredd, Spectral |
| Mutation Testing | Test quality validation | Stryker, PITest |
| Coverage | Code coverage collection, reporting, enforcement | Istanbul/Coverlet, SonarQube |
| Test Data | Factories, fixtures, seeders, fakers | Bogus/AutoFixture/Faker.js |
研究已确认技术栈的最佳测试工具和策略:
| 测试层级 | 研究内容 | 候选对比工具 |
|---|---|---|
| 单元测试 | 测试运行器、断言库、Mock框架 | Jest/Vitest/xUnit/NUnit、Mock工具 |
| 集成测试 | API测试、数据库测试、服务测试 | Supertest、TestContainers、WebAppFactory |
| E2E测试 | 浏览器自动化、BDD、视觉回归 | Playwright/Cypress/Selenium、SpecFlow |
| 性能测试 | 负载测试、压力测试、基准测试 | k6/Artillery/JMeter/NBomber、BenchmarkDotNet |
| 契约测试 | 服务间API契约验证 | Pact、Dredd、Spectral |
| 突变测试 | 测试质量验证 | Stryker、PITest |
| 覆盖率 | 代码覆盖率收集、报告、强制执行 | Istanbul/Coverlet、SonarQube |
| 测试数据 | 工厂、 fixtures、种子数据、伪造数据 | Bogus/AutoFixture/Faker.js |
Test Strategy Template
测试策略模板
markdown
undefinedmarkdown
undefinedTest Pyramid
测试金字塔
- Unit (70%): {framework} — {what to test}
- Integration (20%): {framework} — {what to test}
- E2E (10%): {framework} — {what to test}
- 单元测试(70%):{框架} — 测试内容
- 集成测试(20%):{框架} — 测试内容
- E2E测试(10%):{框架} — 测试内容
Coverage Targets
覆盖率目标
- Unit: {X}% | Integration: {X}% | E2E: critical paths only
- Enforcement: {tool} in CI pipeline, fail build below threshold
---- 单元测试:{X}% | 集成测试:{X}% | E2E测试:仅关键路径
- 强制执行:CI流水线中使用{工具},低于阈值则构建失败
---Step 7: CI/CD & Deployment
步骤7:CI/CD与部署
Research deployment architecture and CI/CD tooling:
| Concern | What to Research | Top Candidates to Compare |
|---|---|---|
| CI/CD Platform | Pipeline orchestration, parallelism, caching | GitHub Actions/Azure DevOps/GitLab CI/Jenkins |
| Containerization | Container runtime, image building, registry | Docker/Podman, BuildKit, ACR/ECR/GHCR |
| Orchestration | Container orchestration, service mesh, scaling | Kubernetes/Docker Compose/ECS/Nomad |
| IaC (Infra as Code) | Infrastructure provisioning, drift detection | Terraform/Pulumi/Bicep/CDK |
| Artifact Management | Package registry, versioning, vulnerability scanning | NuGet/npm/Artifactory/GitHub Packages |
| Feature Flags | Progressive rollout, A/B testing, kill switches | LaunchDarkly/Unleash/Flagsmith |
| Secret Management | Vault, key rotation, environment variables | Azure KeyVault/HashiCorp Vault/SOPS |
| Database Migration | Schema versioning, rollback, seed data | EF Migrations/Flyway/Liquibase/dbmate |
研究部署架构和CI/CD工具:
| 关注点 | 研究内容 | 候选对比工具 |
|---|---|---|
| CI/CD平台 | 流水线编排、并行执行、缓存 | GitHub Actions/Azure DevOps/GitLab CI/Jenkins |
| 容器化 | 容器运行时、镜像构建、镜像仓库 | Docker/Podman、BuildKit、ACR/ECR/GHCR |
| 编排 | 容器编排、服务网格、伸缩 | Kubernetes/Docker Compose/ECS/Nomad |
| IaC(基础设施即代码) | 基础设施部署、漂移检测 | Terraform/Pulumi/Bicep/CDK |
| 工件管理 | 包仓库、版本控制、漏洞扫描 | NuGet/npm/Artifactory/GitHub Packages |
| 功能开关 | 渐进式发布、A/B测试、熔断开关 | LaunchDarkly/Unleash/Flagsmith |
| 密钥管理 | 密钥库、密钥轮换、环境变量 | Azure KeyVault/HashiCorp Vault/SOPS |
| 数据库迁移 | 版本化Schema、回滚、种子数据 | EF Migrations/Flyway/Liquibase/dbmate |
Deployment Strategy Comparison
部署策略对比
| Strategy | Risk | Downtime | Complexity | Best For |
|---|---|---|---|---|
| Blue-Green | Low | Zero | Medium | Critical services |
| Canary | Low | Zero | High | Gradual rollout |
| Rolling | Med | Zero | Low | Stateless services |
| Recreate | High | Yes | Low | Dev/staging environments |
| Feature Flags | Low | Zero | Medium | Feature-level control |
| 策略 | 风险 | 停机时间 | 复杂度 | 适用场景 |
|---|---|---|---|---|
| 蓝绿部署 | 低 | 零 | 中 | 核心服务 |
| 金丝雀部署 | 低 | 零 | 高 | 渐进式发布 |
| 滚动部署 | 中 | 零 | 低 | 无状态服务 |
| 重建部署 | 高 | 是 | 低 | 开发/预发布环境 |
| 功能开关 | 低 | 零 | 中 | 功能级控制 |
Step 8: Observability & Monitoring
步骤8:可观测性与监控
| Concern | What to Research | Top Candidates to Compare |
|---|---|---|
| Structured Logging | Log format, correlation IDs, log levels, aggregation | Serilog/NLog/Winston/Pino |
| Log Aggregation | Centralized log search, dashboards, alerts | ELK/Loki+Grafana/Datadog/Seq |
| Metrics | Application metrics, custom counters, histograms | Prometheus/OpenTelemetry/App Insights |
| Distributed Tracing | Request tracing across services, span visualization | Jaeger/Zipkin/OpenTelemetry/Tempo |
| APM | Application performance monitoring, auto-instrumentation | Datadog/New Relic/App Insights/Elastic |
| Alerting | Threshold alerts, anomaly detection, on-call routing | PagerDuty/OpsGenie/Grafana Alerting |
| Health Checks | Liveness, readiness, startup probes | AspNetCore.Diagnostics/Terminus |
| Uptime Monitoring | External availability monitoring, SLA tracking | UptimeRobot/Pingdom/Checkly |
| 关注点 | 研究内容 | 候选对比工具 |
|---|---|---|
| 结构化日志 | 日志格式、关联ID、日志级别、聚合 | Serilog/NLog/Winston/Pino |
| 日志聚合 | 集中式日志搜索、仪表盘、告警 | ELK/Loki+Grafana/Datadog/Seq |
| 指标 | 应用指标、自定义计数器、直方图 | Prometheus/OpenTelemetry/App Insights |
| 分布式链路追踪 | 跨服务请求追踪、Span可视化 | Jaeger/Zipkin/OpenTelemetry/Tempo |
| APM | 应用性能监控、自动插桩 | Datadog/New Relic/App Insights/Elastic |
| 告警 | 阈值告警、异常检测、值班路由 | PagerDuty/OpsGenie/Grafana Alerting |
| 健康检查 | 存活探针、就绪探针、启动探针 | AspNetCore.Diagnostics/Terminus |
| 可用性监控 | 外部可用性监控、SLA跟踪 | UptimeRobot/Pingdom/Checkly |
Observability Decision: 3 Pillars
可观测性决策:三大支柱
markdown
undefinedmarkdown
undefinedRecommended Observability Stack
推荐可观测性栈
| Pillar | Tool | Why |
|---|---|---|
| Logs | {tool} | {rationale} |
| Metrics | {tool} | {rationale} |
| Traces | {tool} | {rationale} |
| Alerting | {tool} | {rationale} |
---| 支柱 | 工具 | 原因 |
|---|---|---|
| 日志 | {工具} | {理由} |
| 指标 | {工具} | {理由} |
| 链路追踪 | {工具} | {理由} |
| 告警 | {工具} | {理由} |
---Step 9: Code Quality & Clean Code Enforcement
步骤9:代码质量与整洁代码强制执行
Research and recommend tooling for automated code quality:
| Concern | What to Research | Top Candidates to Compare |
|---|---|---|
| Linter (Backend) | Static analysis, code style, bug detection | Roslyn Analyzers/SonarQube/StyleCop/ReSharper |
| Linter (Frontend) | JS/TS linting, accessibility, complexity | ESLint/Biome/oxlint |
| Formatter | Auto-formatting, consistent style | Prettier/dotnet-format/EditorConfig |
| Code Analyzer | Security scanning, complexity metrics, duplication | SonarQube/CodeClimate/Codacy |
| Pre-commit Hooks | Git hooks, staged file validation | Husky+lint-staged/pre-commit/Lefthook |
| Editor Config | Cross-IDE consistency | .editorconfig/IDE-specific configs |
| Architecture Rules | Layer dependency enforcement, naming conventions | ArchUnit/NetArchTest/Dependency-Cruiser |
| API Design Standards | OpenAPI validation, naming, versioning | Spectral/Redocly/swagger-lint |
| Commit Conventions | Commit message format, changelog generation | Commitlint/Conventional Commits |
| Code Review Automation | Automated PR review, suggestion bots | Danger.js/Reviewdog/CodeRabbit |
研究并推荐自动化代码质量工具:
| 关注点 | 研究内容 | 候选对比工具 |
|---|---|---|
| 后端代码检查器 | 静态分析、代码风格、Bug检测 | Roslyn Analyzers/SonarQube/StyleCop/ReSharper |
| 前端代码检查器 | JS/TS代码检查、可访问性、复杂度 | ESLint/Biome/oxlint |
| 格式化工具 | 自动格式化、一致风格 | Prettier/dotnet-format/EditorConfig |
| 代码分析器 | 安全扫描、复杂度指标、重复代码检测 | SonarQube/CodeClimate/Codacy |
| 提交前钩子 | Git钩子、暂存文件验证 | Husky+lint-staged/pre-commit/Lefthook |
| 编辑器配置 | 跨IDE一致性 | .editorconfig/IDE特定配置 |
| 架构规则 | 层级依赖强制执行、命名约定 | ArchUnit/NetArchTest/Dependency-Cruiser |
| API设计标准 | OpenAPI验证、命名、版本控制 | Spectral/Redocly/swagger-lint |
| 提交规范 | 提交消息格式、变更日志生成 | Commitlint/Conventional Commits |
| 代码评审自动化 | 自动化PR评审、建议机器人 | Danger.js/Reviewdog/CodeRabbit |
Enforcement Strategy
强制执行策略
markdown
undefinedmarkdown
undefinedCode Quality Gates
代码质量门禁
| Gate | Tool | Trigger | Fail Criteria |
|---|---|---|---|
| Pre-commit | {tool} | git commit | Lint errors, format |
| PR Check | {tool} | Pull request | Coverage < X%, issues |
| CI Pipeline | {tool} | Push to branch | Build fail, test fail |
| Scheduled | {tool} | Weekly/nightly | Security vulns, debt |
undefined| 门禁 | 工具 | 触发条件 | 失败标准 |
|---|---|---|---|
| 提交前 | {工具} | git commit | 代码检查错误、格式问题 |
| PR检查 | {工具} | Pull request | 覆盖率<X%、问题项 |
| CI流水线 | {工具} | 推送至分支 | 构建失败、测试失败 |
| 定时扫描 | {工具} | 每周/夜间 | 安全漏洞、技术债务 |
undefinedScaffold Handoff (MANDATORY — consumed by /scaffold
)
/scaffold脚手架交付(强制要求 — 供/scaffold
使用)
/scaffoldRef:.claude/skills/shared/scaffold-production-readiness-protocol.md
After completing code quality research, produce this handoff table in the architecture report. The skill reads this table to generate actual config files — without it, scaffold cannot auto-configure quality tooling.
/scaffoldmarkdown
undefined参考:.claude/skills/shared/scaffold-production-readiness-protocol.md
完成代码质量研究后,在架构报告中生成此交付表。技能会读取此表生成实际配置文件——没有它,脚手架无法自动配置质量工具。
/scaffoldmarkdown
undefinedScaffold Handoff — Tool Choices
脚手架交付 — 工具选择
| Concern | Chosen Tool | Config File | Rationale |
|---|---|---|---|
| Linter (FE) | {tool} | {filename} | {why} |
| Linter (BE) | {tool} | {filename} | {why} |
| Formatter | {tool} | {filename} | {why} |
| Pre-commit | {tool} | {filename} | {why} |
| Error handling | {pattern} | {files} | {why} |
| Loading state | {pattern} | {files} | {why} |
| Docker | {compose pattern} | {files} | {why} |
**Also include:** Error handling strategy (4-layer pattern), loading state approach (global vs per-component), and Docker profile structure. See protocol for framework-specific options.
---| 关注点 | 选定工具 | 配置文件 | 理由 |
|---|---|---|---|
| 前端代码检查器 | {工具} | {文件名} | {原因} |
| 后端代码检查器 | {工具} | {文件名} | {原因} |
| 格式化工具 | {工具} | {文件名} | {原因} |
| 提交前钩子 | {工具} | {文件名} | {原因} |
| 错误处理 | {模式} | {文件} | {原因} |
| 加载状态 | {模式} | {文件} | {原因} |
| Docker | {组合模式} | {文件} | {原因} |
**还需包含:** 错误处理策略(4层模式)、加载状态方案(全局vs组件级)、Docker配置文件结构。参考协议获取框架特定选项。
---Step 10: Dependency Risk Assessment
步骤10:依赖风险评估
For EVERY recommended library/package, evaluate maintenance and obsolescence risk:
针对每个推荐的库/包,评估维护和过时风险:
Package Health Scorecard
包健康度评分卡
| Criteria | Score (1-5) | How to Verify |
|---|---|---|
| Last Release Date | ... | npm/NuGet page — stale if >12 months |
| Open Issues Ratio | ... | GitHub issues open vs closed |
| Maintainer Count | ... | Bus factor — single maintainer = high risk |
| Breaking Change Freq. | ... | Changelog — frequent major versions = churn cost |
| Dependency Depth | ... | |
| Known Vulnerabilities | ... | Snyk/npm audit/GitHub Dependabot |
| License Compatibility | ... | SPDX identifier — check viral licenses (GPL) |
| Community Activity | ... | Monthly commits, PR merge rate, Discord/forums |
| Migration Path | ... | Can swap to alternative if abandoned? |
| Framework Alignment | ... | Official recommendation by framework team? |
| 评估标准 | 评分(1-5) | 验证方式 |
|---|---|---|
| 最后发布日期 | ... | npm/NuGet页面 — 超过12个月未更新则视为停滞 |
| 开放问题比例 | ... | GitHub开放问题vs已关闭问题 |
| 维护者数量 | ... | 总线因子 — 单一维护者=高风险 |
| 重大变更频率 | ... | 变更日志 — 频繁大版本更新=迁移成本高 |
| 依赖深度 | ... | |
| 已知漏洞 | ... | Snyk/npm audit/GitHub Dependabot |
| 许可证兼容性 | ... | SPDX标识符 — 检查病毒式许可证(如GPL) |
| 社区活跃度 | ... | 月提交量、PR合并率、Discord/论坛活跃度 |
| 迁移路径 | ... | 若包被弃用,能否切换至替代方案? |
| 框架对齐 | ... | 是否为框架团队官方推荐? |
Risk Categories
风险分类
| Risk Level | Criteria | Action |
|---|---|---|
| Low | Active, >3 maintainers, recent release, no CVEs | Use freely |
| Medium | 1-2 maintainers, release <6mo, minor CVEs patched | Use with monitoring plan |
| High | Single maintainer, >12mo stale, open CVEs | Find alternative or plan exit strategy |
| Critical | Abandoned, unpatched CVEs, deprecated | DO NOT USE — find replacement |
| 风险等级 | 判定标准 | 应对措施 |
|---|---|---|
| 低 | 活跃维护、>3个维护者、最近发布、无CVE漏洞 | 自由使用 |
| 中 | 1-2个维护者、6个月内发布、小漏洞已修复 | 谨慎使用并制定监控计划 |
| 高 | 单一维护者、>12个月未更新、未修复CVE漏洞 | 寻找替代方案或制定退出策略 |
| 严重 | 已弃用、未修复CVE漏洞、已被标记为废弃 | 禁止使用 — 寻找替代方案 |
Dependency Maintenance Strategy
依赖维护策略
markdown
undefinedmarkdown
undefinedRecommended Practices
推荐实践
- Automated scanning: {tool} (Dependabot/Renovate/Snyk) — weekly PR for updates
- Lock file strategy: Commit lock files, pin major versions, allow patch auto-update
- Audit schedule: Monthly /
npm auditdotnet list package --vulnerable - Vendor policy: Max {N} dependencies per concern, prefer well-maintained alternatives
- Exit strategy: For each High-risk dependency, document migration path to alternative
---- 自动化扫描: {工具}(Dependabot/Renovate/Snyk) — 每周提交更新PR
- 锁文件策略: 提交锁文件、固定大版本、允许补丁自动更新
- 审计计划: 每月执行/
npm auditdotnet list package --vulnerable - 供应商政策: 每个关注点最多{N}个依赖,优先选择维护良好的替代方案
- 退出策略: 为每个高风险依赖记录迁移至替代方案的路径
---Step 11: Generate Report
步骤11:生成报告
Write report to with sections:
{plan-dir}/research/architecture-design.md- Executive summary (recommended architecture in 8-10 lines)
- Architecture requirements table (from Step 2)
- Backend architecture — style comparison + recommended patterns (Steps 3)
- Frontend architecture — style comparison + recommended patterns (Step 4)
- Library ecosystem — per-concern recommendations with alternatives (Step 5)
- Testing architecture — pyramid, tools, coverage targets (Step 6)
- CI/CD & deployment — pipeline design, deployment strategy (Step 7)
- Observability stack — 3 pillars + alerting (Step 8)
- Code quality — enforcement gates, tooling (Step 9)
- Dependency risk matrix — high-risk packages, mitigation (Step 10)
- Architecture diagram (Mermaid — showing all layers and data flow)
- Risk assessment for overall architecture
- Unresolved questions
将报告写入,包含以下章节:
{plan-dir}/research/architecture-design.md- 执行摘要(8-10行总结推荐架构)
- 架构需求表(来自步骤2)
- 后端架构 — 风格对比+推荐模式(步骤3)
- 前端架构 — 风格对比+推荐模式(步骤4)
- 库生态系统 — 各关注点推荐方案及替代选项(步骤5)
- 测试架构 — 测试金字塔、工具、覆盖率目标(步骤6)
- CI/CD与部署 — 流水线设计、部署策略(步骤7)
- 可观测性栈 — 三大支柱+告警(步骤8)
- 代码质量 — 强制执行门禁、工具(步骤9)
- 依赖风险矩阵 — 高风险包、缓解措施(步骤10)
- 架构图(Mermaid — 展示所有层级和数据流)
- 整体架构风险评估
- 未解决问题
Architecture Diagram Template
架构图模板
markdown
```mermaid
graph TB
subgraph "Frontend"
UI[SPA / Micro Frontend]
STORE[State Management]
end
subgraph "API Gateway"
GW[Gateway / BFF]
end
subgraph "Backend Services"
CMD[Commands / Handlers]
QRY[Queries / Read Models]
SVC[Domain Services]
ENT[Entities / Aggregates]
end
subgraph "Infrastructure"
DB[(Database)]
CACHE[(Cache)]
MSG[Message Bus]
SEARCH[(Search Index)]
end
subgraph "Observability"
LOG[Logging]
METRIC[Metrics]
TRACE[Tracing]
end
subgraph "CI/CD"
PIPE[Pipeline]
REG[Container Registry]
K8S[Orchestration]
end
UI --> GW --> CMD & QRY
CMD --> SVC --> ENT --> DB
QRY --> CACHE & SEARCH
ENT -.-> MSG
CMD & QRY -.-> LOG & METRIC & TRACE
PIPE --> REG --> K8S
```markdown
```mermaid
graph TB
subgraph "Frontend"
UI[SPA / Micro Frontend]
STORE[State Management]
end
subgraph "API Gateway"
GW[Gateway / BFF]
end
subgraph "Backend Services"
CMD[Commands / Handlers]
QRY[Queries / Read Models]
SVC[Domain Services]
ENT[Entities / Aggregates]
end
subgraph "Infrastructure"
DB[(Database)]
CACHE[(Cache)]
MSG[Message Bus]
SEARCH[(Search Index)]
end
subgraph "Observability"
LOG[Logging]
METRIC[Metrics]
TRACE[Tracing]
end
subgraph "CI/CD"
PIPE[Pipeline]
REG[Container Registry]
K8S[Orchestration]
end
UI --> GW --> CMD & QRY
CMD --> SVC --> ENT --> DB
QRY --> CACHE & SEARCH
ENT -.-> MSG
CMD & QRY -.-> LOG & METRIC & TRACE
PIPE --> REG --> K8S
```Step 12: User Validation Interview
步骤12:用户验证访谈
MANDATORY IMPORTANT MUST present findings and ask 8-12 questions via :
AskUserQuestion强制要求 重要须知 呈现研究结果并通过提出8-12个问题:
AskUserQuestionRequired Questions
必选问题
- Backend architecture — "I recommend {style}. Agree?"
- Frontend architecture — "I recommend {style} with {state management}. Agree?"
- Design patterns — "Recommended backend patterns: {list}. Frontend patterns: {list}. Any to add/remove?"
- Key libraries — "For {concern}, I recommend {lib} over {alternatives}. Agree?"
- Testing strategy — "Test pyramid: {unit}%/{integration}%/{E2E}% using {frameworks}. Appropriate?"
- CI/CD — "Pipeline: {tool} with {deployment strategy}. Fits your infra?"
- Observability — "Monitoring stack: {logs}/{metrics}/{traces}. Sufficient?"
- Code quality — "Enforcement: {linter + formatter + pre-commit hooks}. Team ready?"
- Dependency risk — "Found {N} high-risk dependencies. Accept or find alternatives?"
- Complexity check — "This architecture has {N} concerns addressed. Appropriate for team size?"
- 后端架构 — "我推荐{风格}。是否同意?"
- 前端架构 — "我推荐{风格}搭配{状态管理工具}。是否同意?"
- 设计模式 — "推荐的后端模式:{列表}。前端模式:{列表}。是否需要添加/移除?"
- 核心库 — "针对{关注点},我推荐{库}而非{替代选项}。是否同意?"
- 测试策略 — "测试金字塔:{单元}%/{集成}%/{E2E}%,使用{框架}。是否合适?"
- CI/CD — "流水线:{工具}搭配{部署策略}。是否适配你的基础设施?"
- 可观测性 — "监控栈:{日志}/{指标}/{链路追踪}。是否足够?"
- 代码质量 — "强制执行方案:{代码检查器+格式化工具+提交前钩子}。团队是否准备就绪?"
- 依赖风险 — "发现{N}个高风险依赖。是否接受或寻找替代方案?"
- 复杂度检查 — "此架构涵盖{N}个关注点。是否适配团队规模?"
Optional Deep-Dive Questions (pick 2-3)
可选深度问题(选2-3个)
- "Should we use event sourcing or traditional state-based persistence?"
- "Monolith-first or start with service boundaries?"
- "Micro frontends or monolith SPA?"
- "How important is framework independence for this project?"
- "Self-hosted observability or managed SaaS?"
- "Strict lint rules from day 1 or gradual adoption?"
After user confirms, update report with final decisions and mark as .
status: confirmed- "我们应该使用事件溯源还是传统的基于状态的持久化?"
- "先做单体应用还是直接划分服务边界?"
- "微前端还是单体SPA?"
- "框架独立性对这个项目有多重要?"
- "自托管可观测性还是托管SaaS?"
- "从第一天开始严格执行代码检查规则还是逐步采用?"
用户确认后,更新报告中的最终决策并标记为。
status: confirmedBest Practices Audit (applied across all steps)
最佳实践审计(适用于所有步骤)
Validate architecture against these principles — flag violations in report:
| Principle | Check | Status |
|---|---|---|
| Single Responsibility (S) | Each class/module has one reason to change | ✅/⚠️ |
| Open/Closed (O) | Extensible without modifying existing code | ✅/⚠️ |
| Liskov Substitution (L) | Subtypes substitutable for base types | ✅/⚠️ |
| Interface Segregation (I) | No forced dependency on unused interfaces | ✅/⚠️ |
| Dependency Inversion (D) | High-level modules depend on abstractions, not concretions | ✅/⚠️ |
| DRY | No duplicated business logic across layers | ✅/⚠️ |
| KISS | Simplest architecture that meets requirements | ✅/⚠️ |
| YAGNI | No speculative layers or patterns for future needs | ✅/⚠️ |
| Separation of Concerns | Clear boundaries between domain, application, infra | ✅/⚠️ |
| IoC / Dependency Injection | All dependencies injected, no | ✅/⚠️ |
| Technical Agnosticism | Domain layer has zero framework/infra dependencies | ✅/⚠️ |
| Testability | Architecture supports unit + integration testing | ✅/⚠️ |
| 12-Factor App | Config in env, stateless processes, port binding | ✅/⚠️ |
| Fail-Fast | Validate early, fail with clear errors | ✅/⚠️ |
对照这些原则验证架构——在报告中标记违规项:
| 原则 | 检查项 | 状态 |
|---|---|---|
| 单一职责原则(S) | 每个类/模块只有一个变更理由 | ✅/⚠️ |
| 开放封闭原则(O) | 可扩展无需修改现有代码 | ✅/⚠️ |
| 里氏替换原则(L) | 子类型可替换基类型 | ✅/⚠️ |
| 接口隔离原则(I) | 无强制依赖未使用的接口 | ✅/⚠️ |
| 依赖倒置原则(D) | 高层模块依赖抽象而非具体实现 | ✅/⚠️ |
| DRY | 各层无重复业务逻辑 | ✅/⚠️ |
| KISS | 满足需求的最简架构 | ✅/⚠️ |
| YAGNI | 无针对未来需求的投机性层级或模式 | ✅/⚠️ |
| 关注点分离 | 领域、应用、基础设施边界清晰 | ✅/⚠️ |
| 控制反转/依赖注入 | 所有依赖均注入,业务逻辑中无 | ✅/⚠️ |
| 技术无关性 | 领域层无框架/基础设施依赖 | ✅/⚠️ |
| 可测试性 | 架构支持单元+集成测试 | ✅/⚠️ |
| 12要素应用 | 配置在环境变量中、无状态进程、端口绑定 | ✅/⚠️ |
| 快速失败 | 尽早验证、清晰报错 | ✅/⚠️ |
Output
输出
{plan-dir}/research/architecture-design.md # Full architecture analysis report
{plan-dir}/phase-02b-architecture.md # Confirmed architecture decisionsMANDATORY IMPORTANT MUST break work into small todo tasks using BEFORE starting.
MANDATORY IMPORTANT MUST validate EVERY architecture recommendation with user via — never auto-decide.
MANDATORY IMPORTANT MUST include confidence % and evidence citations for all claims.
MANDATORY IMPORTANT MUST add a final review todo task to verify work quality.
TaskCreateAskUserQuestion{plan-dir}/research/architecture-design.md # 完整架构分析报告
{plan-dir}/phase-02b-architecture.md # 已确认的架构决策强制要求 重要须知 在开始前必须使用将工作拆分为小型待办任务。
强制要求 重要须知 必须通过验证每一个架构推荐——绝不自行决策。
强制要求 重要须知 所有主张必须包含置信度百分比和证据引用。
强制要求 重要须知 添加最终评审待办任务以验证工作质量。
TaskCreateAskUserQuestionNext Steps
下一步
MANDATORY IMPORTANT MUST after completing this skill, use to recommend:
AskUserQuestion- "/plan (Recommended)" — Create implementation plan from architecture design
- "/refine" — If need to create PBIs first
- "Skip, continue manually" — user decides
强制要求 重要须知 完成此技能后,使用推荐:
AskUserQuestion- "/plan(推荐)" — 根据架构设计创建实施计划
- "/refine" — 若需先创建PBI
- "跳过,手动继续" — 由用户决定
Closing Reminders
最终提醒
MANDATORY IMPORTANT MUST break work into small todo tasks using BEFORE starting.
MANDATORY IMPORTANT MUST validate decisions with user via — never auto-decide.
MANDATORY IMPORTANT MUST add a final review todo task to verify work quality.
TaskCreateAskUserQuestion强制要求 重要须知 在开始前必须使用将工作拆分为小型待办任务。
强制要求 重要须知 必须通过验证决策——绝不自行决策。
强制要求 重要须知 添加最终评审待办任务以验证工作质量。
TaskCreateAskUserQuestion