ワンクリックで
define-architecture
在全局层面定义系统 architecture。在启动新项目、architecture.md 缺失或过时、或系统结构发生重大变化时使用。产出 docs/architecture.md,作为系统的结构地图。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
在全局层面定义系统 architecture。在启动新项目、architecture.md 缺失或过时、或系统结构发生重大变化时使用。产出 docs/architecture.md,作为系统的结构地图。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
FDD 主流程 step 1(规划与拆解)。覆盖两段——plan(与用户弄清需求、经 investigator 调查代码库、定出 milestone、写出 plan.md 并呈现)与 features(把 milestone 拆成 features.json 并过 coverage 闸)。中间的 contract 段交给 harness-stack:fdd-validation-contract。由 harness-stack:fdd 调用。
构建新特性的主流程编排器。契约优先的多 agent 架构——捕获一个 plan,定义可测试的断言,拆解为多个 feature,再用全新上下文的 implementer/reviewer/validator subagent 驱动一个里程碑设闸的执行循环。当一处改动触及多个文件、有多条验收标准、或跨越多个 feature 时使用。主流程分三步,分发给 fdd-planning(含 fdd-validation-contract)/ fdd-execution / fdd-validate。
为一个 plan 撰写 validation contract——把 definition of done 落成一组可测试、用户可观测的 assertion(VAL-<AREA>-NNN),带 persona 与声明的 Evidence。它是 fdd step 1(规划)里的 contract 阶段。契约通过逐 area 的 investigation subagent 与若干轮 adversarial review 构建,而非一人独写。产出 .harness-runtime/plans/<slug>/validation-contract.md,并经由 fdd init-state 播种 validation-state.json。在项目内首次使用时,还会 bootstrap 项目级约定文档 docs/user-test-patterns.md。
规范 git 工作流实践。任何代码改动都适用。在提交、开分支、解决冲突,或需要把多条并行工作线组织起来时使用。
harness-stack 框架的引导纲要(bootstrap doctrine)。在会话开始时自动加载,用以介绍 lifecycle map、golden rules,以及如何挑选正确的 harness-stack:* skill。在一次会话中首次调用任何 harness-stack:* skill 之前,先读它。
复盘一次 harness-stack 使用,把值得上报的摩擦、缺陷或建议提成 GitHub Issue 反馈给上游。在完成一项任务、用完某个 skill 后有意见或改进想法,或想为框架本身留下改进线索时使用。
| name | define-architecture |
| description | 在全局层面定义系统 architecture。在启动新项目、architecture.md 缺失或过时、或系统结构发生重大变化时使用。产出 docs/architecture.md,作为系统的结构地图。 |
在全局层面定义系统 architecture。docs/architecture.md 是整个系统的结构地图——它描述各 domain、各 layer、依赖方向、cross-cutting concerns 以及关键技术选型。读这份文件的 agent 或工程师,应当不必通读每个文件就理解代码库是如何组织的。
这不是某个具体 feature 的 design 文档。feature 级的技术设计放在 docs/design-docs/。本文档定义系统的总体结构——所有组件存在于其中的骨架。
灵感来自 matklad 的 ARCHITECTURE.md。
docs/architecture.mdWhen NOT to use: 单文件脚本、一次性原型、或 README 已覆盖结构的项目。需要 feature 级技术设计时,用 /harness-stack:design。
你是 architect,不是文档抄写员。你的职责是做出能比任何单个 feature 活得更久的结构性决策。
UNDERSTAND ──→ ANALYZE ──→ DEFINE ──→ APPROVE
│ │ │ │
▼ ▼ ▼ ▼
Read product Design or Write Human
Determine evaluate architecture confirms
mode structure .md
读 product spec:
docs/product-spec.md 是首要输入——architecture 服务于产品,而非相反判定模式,方法是检查 docs/architecture.md 是否存在:
没有 architecture.md → 新项目。 从零设计 architecture。
已有 architecture.md → 推断意图。 读现有文档,再从用户请求与上下文中推断他们想要什么:
docs/design-docs/ 中的 design 文档在往下走之前,与用户确认你的理解。
理解约束:
docs/product-spec.md)把假设摆出来:
ASSUMPTIONS I'M MAKING:
1. The system is deployed as a single service (not microservices)
2. PostgreSQL is the primary data store based on existing schema
3. The team has strong TypeScript experience
→ Correct me now or I'll proceed with these.
新项目——设计结构:
依据 product spec 与约束,提出 architecture:
带着取舍呈现建议:
PROPOSED ARCHITECTURE:
1. Three domains: auth, tasks, billing — boundaries follow product capabilities
2. Four layers: Types → Repo → Service → Runtime — strict left-to-right dependency
3. PostgreSQL — ACID compliance, relational model fits domain
→ Feedback before I write the doc?
已有项目——评估结构:
把实际存在的与应当如此的相互对照:
质询结构性决策:
呈现结构性疑虑:
STRUCTURAL CONCERNS:
1. Domain [X] and [Y] have high coupling — 12 shared types, 8 cross-domain calls. Should they merge?
2. The "service" layer has both HTTP handlers and business logic. That's two responsibilities.
3. There's no clear boundary between config and runtime — config is loaded lazily throughout.
→ How do you want to address these?
写 architecture 文档。保存到 docs/architecture.md。
选用与项目结构匹配的模板,读它,并照着做:
| Project Type | Template |
|---|---|
| Single-package | references/single-package-template.md |
| Monorepo | references/monorepo-template.md |
monorepo 模板只覆盖 workspace 层级 的事项(codemap、依赖方向、invariants)。每个 package 的内部细节归 docs/design-docs/。
写作原则:
docs/design-docs/。把 architecture 定义呈交人工评审。
ARCHITECTURE DEFINITION READY FOR REVIEW:
- Domains: [count] with boundaries defined
- Layers: [count] with dependency direction rules
- Key technology choices: [count] with rationale
- Cross-cutting concerns: [list]
→ This is the structural foundation for all implementation.
Approve, or tell me what to change.
architecture 文档会与现实漂移。当漂移变得显著时:
docs/product-spec.md——architecture 服务于产品docs/architecture.md——结构地图docs/design-docs/<name>.md——讲 为什么 某个决策这么做| 借口 | 现实 |
|---|---|
| 「代码就是 architecture。」 | 代码展示存在什么。它不展示规则——哪些依赖被允许、哪些是违例、边界在哪里。 |
| 「architecture 会自然涌现。」 | 涌现式 architecture 是「意外复杂度」的别名。显式的结构才能避免一团烂泥。 |
| 「等规模上来再做架构。」 | 架构级重构比一开始就把边界做对贵 10 倍。哪怕小项目也受益于清晰的依赖方向。 |
| 「沿用上次用的就行。」 | 上下文很重要。每个技术选型都应针对当前问题来评估,而非上一个问题。 |
| 「以后再重构。」 | 你能。但你不会。而当你真去做时,会难上 10 倍。 |
docs/design-docs/docs/architecture.mddocs/design-docs/