{"slug":"pdlc-arch","title":"pdlc-arch","summary":"架构分析（生成/更新 docs/ARCHITECTURE.md 系统架构总览 · surface 型）","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-09-23T18:54:21.905213Z","repo":{"url":"https://github.com/kanfu-panda/pdlc-skills","stars":15,"forks":2,"license":"MIT","updatedAt":"2026-09-23T15:59:31Z"},"bodyHtml":"<hr>\n<p>name: pdlc-arch\ndescription: 架构分析（生成/更新 docs/ARCHITECTURE.md 系统架构总览 · surface 型）\nargument-hint: &lt;项目 | 模块范围&gt;\nallowed-tools: Read, Write, Edit, Glob, Grep, Bash\nlayer: 3\nstage: design\nartifact_type: surface\nproduces:</p>\n<ul>\n<li>docs/ARCHITECTURE.md\nrequires: []\nnext_step: null\nterminal_state: null</li>\n</ul>\n<hr>\n<h1>架构分析</h1>\n\n<p>⛔ <strong>IRON LAW · 不可违反的硬门禁</strong></p>\n<p>以下规则为<strong>不可协商</strong>的执行约束：</p>\n<ol>\n<li><strong>文件必须落盘</strong>：所有带编号（功能ID / 缺陷ID）的文档，必须作为实际文件写入磁盘，不可仅在对话中输出。</li>\n<li><strong>阶段必须落章</strong>：每个阶段完成后必须在状态机 <code>docs/.pdlc-state/&lt;feature-id&gt;.json</code> 追加 history，不可跳过。</li>\n<li><strong>测试必须存在</strong>：进入 <code>/pdlc-implement</code> 前，对应测试必须存在且处于红灯状态。违反则中止。</li>\n<li><strong>自检必须执行</strong>：段二自检为强制步骤，不得以\"已经很好了\"为由跳过。</li>\n<li><strong>防循环</strong>：段三修复为单次，不递归。无法自动修复的问题记录到报告，继续往下走。</li>\n<li><strong>状态必推进</strong>：成功执行某 phase 后 <code>current_stage</code> 必须变更。收尾时若发现 <code>current_stage</code> 未推进，视为失败并报错，<strong>不得静默返回</strong>（防止外层循环拿滞后的状态空转烧额度）。唯一例外：命中人工点主动 block 时，<code>current_stage</code> 保持不变但必须写 <code>last_phase_result.ok=false</code> + <code>blocked_reason</code>。</li>\n</ol>\n<p><strong>违反任一条 = 立即中止当前命令，输出违规详情，等待人工介入。</strong></p>\n\n<p>对当前项目架构进行全面分析，输出架构评估报告。</p>\n<h2>分析维度</h2>\n<h3>1. 服务拆分合理性</h3>\n<ul>\n<li>各微服务的职责边界是否清晰</li>\n<li>是否存在循环依赖</li>\n<li>服务粒度是否合适（过大/过小）</li>\n<li>数据归属是否明确</li>\n</ul>\n<h3>2. 通信机制</h3>\n<ul>\n<li>服务间通信方式（同步REST/gRPC、异步消息队列）</li>\n<li>是否存在分布式事务问题</li>\n<li>接口版本管理策略</li>\n<li>错误传播和容错机制</li>\n</ul>\n<h3>3. 数据架构</h3>\n<ul>\n<li>数据库拆分策略（每服务独立数据库 vs 共享）</li>\n<li>数据一致性方案</li>\n<li>缓存策略</li>\n<li>数据备份与恢复</li>\n</ul>\n<h3>4. 可观测性</h3>\n<ul>\n<li>日志规范（结构化日志、链路追踪ID）</li>\n<li>监控指标（RED指标：Rate/Errors/Duration）</li>\n<li>告警策略</li>\n<li>分布式追踪</li>\n</ul>\n<h3>5. 可扩展性</h3>\n<ul>\n<li>水平扩展能力</li>\n<li>负载均衡策略</li>\n<li>容量规划</li>\n</ul>\n<h2>工作流程</h2>\n<blockquote>\n<p><strong>架构总览是 surface 型产物</strong>：<code>docs/ARCHITECTURE.md</code> 描述\"系统当前长什么样\"，<strong>就地覆盖更新</strong>，不按日期累积多份文件。演进历史靠 <code>git log docs/ARCHITECTURE.md</code> 追溯。这与 per-feature 的 <code>docs/02_design/architecture/F-xxx-arch.md</code>（ledger 型，记录\"为某个 feature 为什么改架构\"）分工互补。</p>\n</blockquote>\n<ol>\n<li>扫描 <code>backend/</code> 和 <code>frontend/</code> 下的所有服务和应用</li>\n<li>阅读 <code>docs/02_design/architecture/</code> 下的 per-feature 架构 ledger（若有）</li>\n<li>分析代码中的依赖关系和调用链路</li>\n<li><strong>遗留检测</strong>：若发现旧版按日期命名的 <code>*-arch-analysis.md</code>（散落在 <code>docs/02_design/architecture/</code> 或旧 review 目录，即 v1.0 的 v1..v5 累积模式），提示并移到 <code>docs/.archive/architecture/</code>，以最新一份作为 <code>ARCHITECTURE.md</code> 的起点</li>\n<li><strong>【必须创建/更新文件】</strong> 就地生成/覆盖 <code>docs/ARCHITECTURE.md</code>（参考 本 skill 目录下的 <code>assets/architecture-overview-template.md</code>）</li>\n</ol>\n<blockquote>\n<p>⚠️ <strong>必须写入磁盘，不可仅在对话中输出。</strong></p>\n</blockquote>\n<h2>输出格式</h2>\n<p>文件路径：<code>docs/ARCHITECTURE.md</code>（固定，就地覆盖）</p>\n<p><strong>文档顶部包含 PDLC 追溯头 + surface 标记</strong>：</p>\n<pre><code>&lt;!-- artifact_type: surface --&gt;\n&lt;!-- PDLC-TRACE --&gt;\n&lt;!-- 功能名称: 架构总览 --&gt;\n&lt;!-- 阶段: design --&gt;\n&lt;!-- 创建时间: &lt;执行时的实际 ISO 8601 时间戳&gt; --&gt;\n</code></pre>\n<p><strong>报告内容</strong>：</p>\n<ul>\n<li>架构全景图（文本描述 / mermaid）</li>\n<li>服务拆分 / 通信 / 数据 / 可观测性 / 可扩展性 各维度评分（1-5）</li>\n<li>问题清单与改进建议</li>\n</ul>\n<p><strong>创建后验证</strong>：确认 <code>docs/ARCHITECTURE.md</code> 已存在且为本次内容</p>\n<h2>要求</h2>\n\n<p>\uD83C\uDF10 <strong>Output language for generated artifacts</strong></p>\n<p>All generated artifacts (PRDs, design docs, code comments, review reports,\ntest plans, deployment manuals, changelog entries, etc.) follow this policy:</p>\n<ol>\n<li><p><strong>Default — match the conversation language exactly</strong>:</p>\n<ul>\n<li>用户用中文与 Claude 对话 → 产中文文档、中文代码注释、中文报告</li>\n<li>User talks to Claude in English → produce English artifacts</li>\n<li>User talks in another language → produce artifacts in that language</li>\n<li><strong>Never silently default to a fixed language regardless of the user's input.</strong></li>\n</ul>\n</li>\n<li><p><strong>Explicit override always wins</strong>: when the user specifies a language for\nan artifact (e.g. \"write the PRD in English\", \"用英文写 API 设计文档\",\n\"output the deploy doc in Japanese\"), use that language for that artifact,\nregardless of conversation language.</p>\n</li>\n<li><p><strong>Mixed-language requirements</strong>: if the user wants some artifacts in one\nlanguage and others in a different language (common: Chinese PRD + English\nAPI docs for partners), honour each per-artifact instruction.</p>\n</li>\n<li><p><strong>Uncertain</strong>: if you cannot reliably detect the conversation language,\nask once before producing the first artifact.</p>\n</li>\n</ol>\n<p>This policy applies to <strong>content</strong> (prose, comments, headings). It does\n<strong>not</strong> override technical conventions like English variable names, English\ngit commit subjects, or English error codes when the project's conventions\nrequire them.</p>\n\n<ul>\n<li>评价要客观，给出依据</li>\n<li>建议要可操作，标注优先级</li>\n<li>surface 铁律：不创建带日期/版本号的架构文件，永远就地覆盖 <code>ARCHITECTURE.md</code></li>\n</ul>\n<p>$ARGUMENTS</p>\n\n<h2>段四：交接（Handoff）</h2>\n<p>命令完成后必须输出以下格式的最终消息：</p>\n<pre><code>✅ &lt;阶段名&gt; 完成：&lt;主要产出物路径&gt;\n\uD83D\uDCCA 自检：&lt;通过数&gt;/&lt;总数&gt; 通过（若有未通过，附要点）\n\uD83D\uDCE6 状态快照：docs/.pdlc-state/&lt;feature-id&gt;.json\n\uD83D\uDC49 下一步：/pdlc-&lt;next_step&gt;\n   （如果有分叉）或 /pdlc-&lt;alt&gt;（条件：&lt;选择依据&gt;）\n</code></pre>\n<p><strong>规则：</strong></p>\n<ul>\n<li>主流程命令（写状态机的命令；下一跳见正文里「本命令的状态机取值」）必须显式输出\"下一步\"，不可省略</li>\n<li>工具型命令（Layer 3）可以没有 <code>next_step</code>，此时输出 <code>\uD83D\uDC49 下一步：（本次流程结束，无后续）</code></li>\n<li>分叉场景必须说明<strong>选择条件</strong>，例如\"若需补充测试用例 → <code>/pdlc-tdd</code>；若测试已齐 → <code>/pdlc-review</code>\"</li>\n</ul>\n\n<p><strong>本命令的 handoff 输出：</strong></p>\n<pre><code>✅ 架构总览已更新：docs/ARCHITECTURE.md\n\uD83D\uDCE6 surface 型就地覆盖（历史见 git log docs/ARCHITECTURE.md）\n\uD83D\uDC49 下一步：（本次流程结束，无后续）\n</code></pre>\n","files":[{"path":"assets/architecture-overview-template.md","sizeBytes":1533,"isText":true},{"path":"SKILL.md","sizeBytes":7154,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-23T18:54:26.867026Z","sha256":"E3DD6D9797C1BF7293EE94C0738746E96CEAB8CB272ED79D4C7EA4C2FE381628","sizeBytes":5230},"review":null,"source":{"repositoryUrl":"https://github.com/kanfu-panda/pdlc-skills","path":"skills/pdlc-arch","license":"MIT","commit":"3cd2f02ab45cb1cd48962e0f298ae4dad9fb442f","subtreeSha":"2436457C7D332C5B629E2C935DAF08FE0B298C49273086E1569E8FA9D77E67CC","lastSyncedAt":"2026-09-23T18:54:21.123477Z"},"reviewedAt":"2026-09-23T18:54:50.529864Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/kanfu-panda/pdlc-skills/tree/main/skills/pdlc-arch"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install kanfu-panda-pdlc-skills@llmmart"},{"target":"git","command":"git clone https://github.com/kanfu-panda/pdlc-skills.git"}]}