togaf-l1

TOGAF AI Prompt Chain (L1→L5): follows TOGAF Phase A methodology, providing a five-layer AI prompt chain for semi-automated requirements analysis and producing structured architecture design documents plus modular draw.io visual diagrams (L2–L4 split into file groups by capability domain/business process/bounded context). Flow: L1 Strategic Anchoring → L2 Capability Map → L3 Process Navigation → L4 Entity Modeling → L5 Specification Refinement. V3.0 includes Diagram-as-Contract (draw.io → D1–D5 contracts) and contract-to-code skeleton generator (D1 state machines / D2 task orchestration / D3 CRUD). Loop control delegated to x-rw-loopengineering-o2 host orchestrator.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "togaf-l1" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-31ededa2f9ef1e365e61153e706b27ebb6fb669ffcb7920a82cf7e768a9cee07. Verify the upstream source and version against https://skillhub.cn/skills/user_c3b6c8ac/x-rw-togaf-l1 before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

TOGAF AI Prompt Chain (L1→L5): follows TOGAF Phase A methodology, providing a five-layer AI prompt chain for semi-automated requirements analysis and producing structured architecture design documents plus modular draw.io visual diagrams (L2–L4 split into file groups by capability domain/business process/bounded context). Flow: L1 Strategic Anchoring → L2 Capability Map → L3 Process Navigation → L4 Entity Modeling → L5 Specification Refinement. V3.0 includes Diagram-as-Contract (draw.io → D1–D5 contracts) and contract-to-code skeleton generator (D1 state machines / D2 task orchestration / D3 CRUD). Loop control delegated to x-rw-loopengineering-o2 host orchestrator.

0 Downloads

Introduction source: third_party · user_c3b6c8ac · 1.5.2 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Inputs and outputs
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: x-rw-togaf-l1
author: rw
version: V1.5
updated: 2026-08-06
description: |
  TOGAF AI Prompt Chain — 五层 AI System Prompt 链(L1→L5),按 TOGAF Phase A 方法论
  半自动化需求分析。产出结构化架构设计文档 + 模块化 draw.io 可视化图示(L2-L4 按能力域/业务流程/限界上下文拆分为文件组)。
  L1 战略锚定→L2 能力地图→L3 流程导航→L4 实体建模→L5 规格精炼。
  V3.0: Diagram-as-Contract(drawio → D1-D5 契约)+ 契约 → 代码骨架生成器(D1 状态机 / D2 任务编排 / D3 CRUD)。
  Loop 控制委托至 x-rw-loopengineering-o2 宿主编排。
depends_on:
  - x-rw-loopengineering-o2
config: none
compatibility: claude-code,workbuddy
tags: [togaf, architecture, prompt-engineering, enterprise-architecture]
user-invocable: true

x-rw-togaf-l1

TOGAF AI Prompt Chain — 五层 AI System Prompt 链,按 TOGAF Phase A 方法论半自动化需求分析。

版本: V1.5 (Prompt) / V1.0.0 (CLI) | 功能状态: 全5层完成 + CLI 自动化工具 + draw.io 模块化图示拆分 + AI 消费子集产出 + Diagram-as-Contract 契约提取(D1-D5)+ 契约 → 代码骨架生成器(D1/D2/D3)

📖 用户指南: 详见 README.md 🤖 AI参考: 详见 references/ 目录

🔄 会话启动行为

本 Skill 为 Prompt Chain 类型,无持久化会话状态。每次调用时:

  1. 加载对应层级的 System Prompt(prompts/L{N}-*.md)
  2. 按 L1→L2→L3→L4→L5 顺序依次执行
  3. 推荐通过 x-rw-loopengineering-o2 编排层调用

📊 logs/ 行为记录

每次执行结束必须执行

  1. 记录执行指标到 logs/executions/{timestamp}.json
  2. 格式参考 logs/README.md 行为记录规约

快速开始

Prompt 方式

按 L1→L2→L3→L4→L5 顺序依次使用:

  1. 将 prompts/L1-战略锚定器-SystemPrompt-V3.0.md 作为 System Prompt
  2. 输入自然语言需求,获取《需求决策书》+ 决策流程图(1 文件)
  3. 将 L1 输出 + L2 Prompt 输入,获取《上下文关系图》+ N 张能力域上下文图
  4. 依此类推至 L5

推荐通过 x-rw-loopengineering-o2 编排层调用,享受自动 Loop 控制和收敛检测。

CLI 方式(V1.0 新增)

togaf init --project=项目名称        # 初始化目录
togaf run L1 --project=项目名称        # 输出 LLM 调用请求
togaf run L2 --project=项目名称        # 输出 LLM 调用请求
togaf status --project=项目名称       # 查看执行进度
togaf check-anchors --project=项目名称  # 锚点链式一致性校验(V3.0)
togaf export-ai-subset --project=项目名称  # 导出 AI 消费子集(V3.0)
togaf config                        # 查看配置

契约 → 代码骨架生成(V3.0 新增)

各层 ingest 自动提取 drawio 契约(*.drawio.contract.json),代码骨架生成器消费契约产出可开发代码:

契约 生成器 产出
D1 状态机(L3) generate_state_machine_skeleton / D1StateMachineGenerator 状态枚举 + 跳转表 + 非法跳转拦截的状态机骨架
D2 流程 DAG(L3) generate_flow_orchestrator_skeleton / D2FlowDagGenerator Kahn 拓扑排序 + 环检测 + 条件/异常分支的任务编排骨架
D3 实体关系(L4) generate_crud_skeleton / D3CrudGenerator model / service / controller CRUD 骨架
from togaf.codegen.generator import generate_state_machine_skeleton
files = generate_state_machine_skeleton(d1_contract)  # {对象名: {"xxx_state_machine.py": "..."}}

排查模板渲染问题:设置 TOGAF_CODEGEN_LOG=DEBUG 环境变量(或 configure_logging("DEBUG")), 输出每次渲染的上下文键、耗时与失败时的模板片段。

功能

# 层级 产出文档 图示产出
1 L1-战略锚定器 《需求决策书》 决策流程图(1 文件)
2 L2-能力地图器 《上下文关系图》 N 张能力域上下文图 + 可选总览图
3 L3-流程导航器 《流程导航图》+《技术架构建议书》 M×(业务流程图+状态机图) + 可选索引图
4 L4-实体建模器 《领域模型》+《API接口规格》 K 张限界上下文 ER 图 + 跨上下文总览图
5 L5-规格精炼器 《技术规格书》+《开发任务清单》+ E1-E7 开发就绪产物 部署总览图 + P 张安全域详图

架构

  • Loop 控制委托至 x-rw-loopengineering-o2(宿主编排)
  • 每层产出文本分析 + 模块化 draw.io XML 可视化图示(L2-L4 按模块拆分为文件组)
  • 层间通过锚点保险箱只读传递(铁律+建议+术语+待定项)
  • 三级门禁(轻微自动修正/严重人工介入/致命回溯)

文件结构

prompts/     — 5层 System Prompt + E1-E7 实现层输出模板(执行指令层:"怎么做")
    ├── L1-战略锚定器-SystemPrompt-V3.0.md
    ├── L2-能力地图器-SystemPrompt-V2.0.md
    ├── L3-流程导航器-SystemPrompt-V2.0.md
    ├── L4-实体建模器-SystemPrompt-V2.0.md
    ├── L5-规格精炼器-SystemPrompt-V3.0.md
    └── 实现层模板/ — E1-E7 输出模板(功能说明书/数据库/API/前端原型/权限/任务清单/测试用例)
src/togaf/   — CLI 源码(V1.0 新增,含 diagram 契约提取 + codegen 骨架生成)
tests/       - pytest 测试套件(191 个用例,门禁 5/5 通过)
scripts/     — 门禁检查脚本 check-gates.py
pyproject.toml — CLI 项目配置
references/  — TOGAF 参考 + drawio 规范 + LoopEngine 集成契约(参考规范层:"按什么标准做")
    ├── diagram_contract_schemas/ — D1-D5 契约 Schema
    ├── database-design/  — 数据库设计子专题(01 命名字段 / 02 表结构索引 / 03 表关系模型 / 04 数据字典 / 05 反冗余 / 06 评审红线 / 07 安全运维 + E2 自检清单)
    ├── prototype-design/ — 原型制作子专题(01 页面结构 / 02 组件交互 / 03 保真视觉 / 04 可访问性 / 05 追溯 / 06 红线评审 / 07 交付自检 + E4 自检清单)
    ├── test-design/      — 测试设计子专题(01 用例方法 / 02 分层金字塔 / 03 契约接口 / 04 非功能 / 05 数据 fixture / 06 覆盖率门禁 / 07 交付自检 + E7 自检清单)
    ├── human-decision-gate.md — 人工决策门禁机制(C1-C5 人工控制点 + O2 建议单前置 + 可追责签名)
    ├── terminology.md — 术语全称映射表(g1→架构门禁 / g2→规划门禁 / g3→执行验收门禁 / C0→中控台 / L1→战略锚定层 等;人类可读场景必须使用全称)
    └── togaf-l1-参考/   — TOGAF Phase A 对齐确认与参考
logs/        — 执行日志

职责分层说明(prompts vs references):

  • prompts/ = 执行指令层:L1-L5 System Prompt 是流水线直接加载执行的指令("怎么做"),E1-E7 模板是 L5 输出实现的格式骨架;变更频率高,随 Prompt 迭代。
  • references/ = 参考规范层:专题集(database/prototype/test-design)、契约 Schema、门禁机制是 L5 Prompt 引用与人工决策查阅的标准("按什么标准做");变更频率低,沉淀稳定规范。
  • 二者不合并:prompts/ 被流水线按文件加载,references/ 被 Prompt 按路径引用(L5 引用 6 处)与 C0 门禁调用(如 suggestion-template.md);合并会导致引用路径全部失效。

关键约束规则

  1. 顺序执行: L1→L2→L3→L4→L5,不可跳过或乱序
  2. 锚点保险箱只读: 下游层加载上游产出物后只读引用,不可修改
  3. 门禁不可跳过: 每层的锚点合规声明必须输出
  4. 图示模块拆分: L2-L4 必须按模块维度拆分,不可合并为单图(详见 references/drawio-conventions.md)
  5. 术语一致性: 全链路必须使用锚点保险箱术语表统一定义
  6. 🔴 Draw.io XML 质量: 生成任何图示前必须先读取 references/drawio-conventions.md §XML质量强制规约;输出后必须通过 6 项自检锚点(①id="0"/"1"存在 ②实体编码 ③style格式 ④perimeter匹配 ⑤顶点先于边 ⑥无XML注释)

异常处理

异常场景 处理方式
上游产出物缺失 提示用户重新运行上游层,不强行继续
锚点冲突(严重/致命) 暂停,生成冲突报告,人工介入
Loop 无法收敛 最多执行该层上限轮次后强制终止,未处理矛盾熔断
模块过多(单图 >25 节点) 按模块维度进一步拆分子图

📖 完整异常处理: 各层 Prompt 文件中的「异常处理汇总」章节

产出契约

输出结构

每层分析必须输出三类产物:

# 产物 格式 消费者
1 层级文档(如《需求决策书》) Markdown 人类干系人
2 机器可读 JSON 块 JSON(嵌在 Markdown 末尾) LoopEngine
3 draw.io XML 图示 XML 人类干系人

V3.0: Diagram-as-Contract

ingest 时从每张 drawio 图示自动提取 JSON 契约(*.drawio.contract.json),供下游消费:

契约 来源层 内容 Schema
D1 状态跳转表 L3 状态 + 合法/非法跳转 + 封闭性检查 references/diagram_contract_schemas/d1-state-machine.schema.json
D2 流程 DAG L3 步骤 + 依赖边 + 异常分支 d2-flow-dag.schema.json
D3 实体关系 L4 实体 + 属性 + 关系 d3-entity-relation.schema.json
D4 上下文 L1/L2 Actor + 系统 + 依赖 d4-context.schema.json
D5 部署拓扑 L5 服务 + 组件 + 连接 d5-deployment.schema.json

契约消费端(代码骨架生成器)见「契约 → 代码骨架生成」章节。

L5 实现层 E1-E7(开发就绪产物)

L5 完成后除层级文档外,必须产出 7 份 E 系列开发就绪产物(可直接驱动开发,可交互原型即验收基线):

编号 产物 内容
E1 功能说明书 模块定位 + 核心功能清单 + 验收基线(唯一权威)
E2 数据库物理设计 表清单 + 表结构 + 索引约束
E3 API 接口详细规格 统一前缀 + 接口清单 + 请求响应示例
E4 前端页面规划与原型说明 页面总览 + 路由权限 + 可交互原型(HTML)即验收基线
E5 权限矩阵与鉴权设计 角色定义 + 功能域×角色矩阵
E6 开发任务清单增强版 任务清单 + 依赖 + 验收标准
E7 测试用例与基础设施 测试策略 + TC 映射 + 测试库

强制约定(P2-1 格式统一):E 系列产物输出为 Markdown(E{n}-名称.md),与 L5 Prompt 模板一致;可选增强为自包含 HTML(E{n}-名称.html,用于 C5 原型验收的可交互原型)。G1 门禁按 Markdown 文件名(E1-~E7-)检查完整性。 (check_output togaf / check_g1 的 E1-E7 完整性检查项已按此约定执行);缺失任一 E 产物将导致 G1 门禁拦截。

P2-4 按需生成 + 清单校验(2026-08-09):E1-E7 按项目实际需要生成——无数据库需求可输出 E2 无(纯前端/无持久化) 占位说明,但清单必须完整;L5 结束时运行 check_output togaf 校验 E1-E7 清单齐全且无孤儿(E 系列完整性由架构门禁拦截)。各 E 产物一致性自检:

  • E1: FR 须有来源 REQ(check_traceability.py REQ→FR 校验)
  • E3: 示例一致性自检(check_e3_consistency.py E3-01~06)
  • E4: 原型制作规范 N1-N6 自检(模板 4.5 清单:零依赖单文件 / 保真度分级 / 主题一致 / 可访问性 / 交互覆盖 / 动效含蓄)
  • E6/E7: FR-GWT→Task→TC 双向闭合(check_traceability.py)

🔴 人工决策门禁:E1-E7 产出后经 C2 架构门禁(G1) O2 审计质询,E4 可交互原型经 C5 原型验收门禁 人工签字后方可作为验收基线。完整 C1-C5 控制点、O2 建议单规范与一页式门禁签核单(references/gate-signoff-template.md)见 references/human-decision-gate.md。

L5 额外产出

L5 完成后额外产出 AI 消费子集(JSON),包含:

  • business_capabilities — 业务能力地图(从 L2 提取)
  • constraint_matrix — 约束矩阵(从 L3-L4 提取)
  • architecture_decisions — 架构决策记录(从 L4 提取)

AI 消费子集的 Schema 见 references/ai_consumption_subset_schema.json。

锚定机制

AI 消费子集生成后,由 scripts/generate_anchor.py 计算 SHA-256 锚定哈希。下游 Loop 消费时必须校验此哈希。

接口契约

TOGAF→Loop 的数据流契约详见 references/togaf-loop-interface-contract.md。

不产出(L1-L4 分析层)

L1-L4 分析层不产出(V3.0 与 L5 实现层区分):

  • 执行计划、时间排期、Gantt 图(E6 开发任务清单由 L5 实现层输出)
  • 技术实现方案、代码、配置(E1-E5/E7 规格由 L5 实现层输出)
  • 资源分配、团队分工

⚡ V3.0 例外:L5 实现层必须产出 E1-E7 开发就绪产物(见上方「L5 实现层 E1-E7」章节),C0 全流程中 L5 未产出 E1-E7 视为交付不完整,G1 门禁拦截。

兼容性

  • 依赖于 x-rw-loopengineering-o2 >= v10.3(编排层)
  • 产出可被 x-rw-loopengineering-o2 的 KDNA 注入阶段消费
  • AI 消费子集可被 x-rw-graphengineering-g3 的 Plan 编译器间接消费(经 Loop 转换)

Current listing version

1.5.2

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value95/100

Highlights

  • 提供 TOGAF 五层 AI Prompt 链,支持从战略锚定到规格精炼的完整架构设计流程
  • 产出结构化文档 + 模块化 draw.io 图示 + 代码骨架生成,形成端到端解决方案
  • 面向企业架构高频刚需场景,显著提升架构设计效率与一致性
Trigger Precision92/100

Areas to improve

  • 触发词可进一步显式化 Reported severity: Minor

    description 内容完整但未使用显式 When to Use 章节引导用户触发场景

    Recommendation: 建议在 SKILL.md 开头增加 'When to Use' 章节,明确列出典型触发场景(如 '需要按 TOGAF Phase A 进行需求分析时')

Highlights

  • description 清晰描述 L1-L5 层级调用逻辑与 CLI 命令,边界明确
  • 覆盖 Prompt 方式与 CLI 方式两种触发路径,用户易理解
Structure and Standards90/100

Areas to improve

  • 文档长度略长 Reported severity: Minor

    SKILL.md 内容详实但超过 500 行,可能影响快速浏览体验

    Recommendation: 建议将部分细节(如 CLI 命令完整参数)移至独立文档并通过链接引用

Highlights

  • Phase/步骤清晰(L1→L5 顺序执行),每层产出物明确
  • 包含端到端 CLI 示例与产出契约说明,结构完整
  • frontmatter 完整,文件结构说明详尽
Execution Reliability88/100

Areas to improve

  • 依赖项版本未显式声明 Reported severity: Minor

    depends_on 中 x-rw-loopengineering-o2 未指定最低版本号(仅正文提及 >= v10.3)

    Recommendation: 建议在 frontmatter 的 depends_on 中显式标注版本要求,如 'x-rw-loopengineering-o2 >= v10.3'

Highlights

  • 异常处理覆盖全面(上游缺失、锚点冲突、Loop 收敛、模块拆分)
  • draw.io XML 质量强制自检锚点(6 项)确保图示可靠性
  • 门禁机制健全(三级门禁 + 人工决策点 C1-C5)
Evidence Verifiability (mean of the first four)91/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.