{"slug":"pdlc-code-gen","title":"pdlc-code-gen","summary":"代码脚手架生成","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-09-23T18:54:22.400046Z","repo":{"url":"https://github.com/kanfu-panda/pdlc-skills","stars":15,"forks":2,"license":"MIT","updatedAt":"2026-09-23T15:59:31Z"},"bodyHtml":"<hr>\n<h2>name: pdlc-code-gen\ndescription: 代码脚手架生成\nargument-hint: &lt;模板类型 | 目标目录&gt;\nallowed-tools: Read, Write, Edit, Glob, Grep, Bash\nlayer: 3\nstage: engineering\nproduces: []\nrequires: []\nnext_step: null\nterminal_state: null</h2>\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<ol>\n<li><strong>阅读设计文档</strong>: 阅读 <code>docs/02_design/api/</code> 和 <code>docs/02_design/database/</code> 下的设计文档</li>\n<li><strong>确定目标服务</strong>: 确认代码生成到哪个服务或应用</li>\n<li><strong>生成代码骨架</strong>: 按技术栈生成对应的代码文件</li>\n</ol>\n<h2>后端生成内容（按分层架构）</h2>\n<h3>Java/Spring Boot</h3>\n<ul>\n<li>Controller（控制器层）: 路由、参数校验、响应封装</li>\n<li>Service（服务层）: 业务逻辑接口和实现</li>\n<li>Repository（数据层）: 数据访问接口</li>\n<li>DTO/VO/Entity: 数据传输对象、视图对象、实体类</li>\n<li>单元测试骨架</li>\n</ul>\n<h3>Go</h3>\n<ul>\n<li>Handler（处理器层）: HTTP 路由处理</li>\n<li>Service（服务层）: 业务逻辑</li>\n<li>Repository（仓储层）: 数据访问</li>\n<li>Model（模型层）: 数据结构定义</li>\n<li>单元测试骨架</li>\n</ul>\n<h3>Python/FastAPI</h3>\n<ul>\n<li>Router（路由层）: API 路由定义</li>\n<li>Service（服务层）: 业务逻辑</li>\n<li>Repository（仓储层）: 数据访问</li>\n<li>Schema/Model: Pydantic 模型、ORM 模型</li>\n<li>单元测试骨架</li>\n</ul>\n<h3>Node.js</h3>\n<ul>\n<li>Controller（控制器层）: 路由处理</li>\n<li>Service（服务层）: 业务逻辑</li>\n<li>Model（模型层）: 数据模型</li>\n<li>Middleware（中间件）: 通用中间件</li>\n<li>单元测试骨架</li>\n</ul>\n<h2>前端生成内容</h2>\n<ul>\n<li>页面组件骨架</li>\n<li>API 请求服务层</li>\n<li>类型定义（TypeScript）</li>\n<li>状态管理模块</li>\n<li>单元测试骨架</li>\n</ul>\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>生成的代码要遵循 <code>docs/00_standards/coding-standards.md</code> 规范（未命中 → 提示 <code>consider /pdlc-standard add coding/&lt;topic&gt;</code>）</li>\n<li>方法体用 <code>// TODO: 待实现</code> 占位</li>\n<li>测试用例用 <code>// TODO: 补充测试逻辑</code> 占位</li>\n<li>生成后提示用户先运行 <code>/tdd</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>✅ 代码脚手架 完成\n\uD83D\uDCE6 产出：（生成到目标服务/应用目录）\n\uD83D\uDC49 下一步：（本次流程结束，无后续）\n</code></pre>\n","files":[{"path":"SKILL.md","sizeBytes":6067,"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:28.039161Z","sha256":"082CE791EDE492BC2A7333A618D6086DA38099A9C357503E2BFC3B780F35D9BC","sizeBytes":3410},"review":null,"source":{"repositoryUrl":"https://github.com/kanfu-panda/pdlc-skills","path":"skills/pdlc-code-gen","license":"MIT","commit":"3cd2f02ab45cb1cd48962e0f298ae4dad9fb442f","subtreeSha":"98DFCF9C60969A1F5EF8C842A4FA17F803B6B61BA29DE8E8E1348DED9FE25687","lastSyncedAt":"2026-09-23T18:54:21.123477Z"},"reviewedAt":"2026-09-23T18:55:10.02764Z","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-code-gen"},{"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"}]}