Loading...
Loading...
Compare original and translation side by side
| Include | Exclude |
|---|---|
| Module and directory structure | Task-level breakdowns |
| Component names and responsibilities | Implementation code |
| File paths (from investigation) | Function bodies |
| Dependencies between components | Step-by-step instructions |
| "Done when" verification criteria | Test code |
interface TokenService {
generate(claims: TokenClaims): Promise<string>;
validate(token: string): Promise<TokenClaims | null>;
}
interface TokenClaims {
sub: string; // service identifier
aud: string[]; // allowed audiences
exp: number; // expiration timestamp
}async function generate(claims: TokenClaims): Promise<string> {
const payload = { ...claims, iat: Date.now() };
return jwt.sign(payload, config.secret, { algorithm: 'RS256' });
}| 包含内容 | 排除内容 |
|---|---|
| 模块和目录结构 | 任务级别的细分 |
| 组件名称和职责 | 实现代码 |
| 文件路径(来自调研结果) | 函数体 |
| 组件之间的依赖关系 | 分步操作说明 |
| “完成标准”验证条件 | 测试代码 |
interface TokenService {
generate(claims: TokenClaims): Promise<string>;
validate(token: string): Promise<TokenClaims | null>;
}
interface TokenClaims {
sub: string; // service identifier
aud: string[]; // allowed audiences
exp: number; // expiration timestamp
}async function generate(claims: TokenClaims): Promise<string> {
const payload = { ...claims, iat: Date.now() };
return jwt.sign(payload, config.secret, { algorithm: 'RS256' });
}docs/design-plans/YYYY-MM-DD-<topic>.mddocs/design-plans/2025-01-18-oauth2-svc-authn.mddocs/design-plans/2025-01-18-user-prof-redesign.mddocs/design-plans/design.mddocs/design-plans/new-feature.mddocs/design-plans/YYYY-MM-DD-<topic>.mddocs/design-plans/2025-01-18-oauth2-svc-authn.mddocs/design-plans/2025-01-18-user-prof-redesign.mddocs/design-plans/design.mddocs/design-plans/new-feature.mdundefinedundefined
**This skill appends the body sections:**
```markdown
**本技能将追加以下主体章节:**
```markdown
**Then this skill:**
1. Generates Acceptance Criteria (inline) and gets human validation
2. Generates Summary and Glossary to replace the placeholders
**之后本技能将:**
1. 生成验收标准(内联)并获取人工验证
2. 生成摘要和术语表以替换占位符| Phase Type | Done When | Examples |
|---|---|---|
| Infrastructure/scaffolding | Operational success | Project installs, builds, runs, deploys |
| Functionality/behavior | Tests pass that verify the ACs this phase covers | Unit tests, integration tests, E2E tests |
oauth2-svc-authn.AC1.1oauth2-svc-authn.AC1.3oauth2-svc-authn.AC1.3<!-- START_PHASE_2 -->| 阶段类型 | 完成标准 | 示例 |
|---|---|---|
| 基础设施/脚手架 | 操作成功 | 项目安装、构建、运行、部署成功 |
| 功能/行为 | 验证本阶段覆盖的验收标准的测试通过 | 单元测试、集成测试、端到端测试 |
oauth2-svc-authn.AC1.1oauth2-svc-authn.AC1.3<!-- START_PHASE_2 -->src/services/auth/src/services/auth/src/types/auth.ts
Bad structure (task-level — this belongs in implementation plans):
Design plans describe WHAT gets built. Implementation plans describe HOW to build it step-by-step.
**Phase count:**
- Target: 5-8 phases (sweet spot for planning)
- Maximum: 8 phases (hard limit for writing-plans skill)
- If >8 phases needed: Note that multiple implementation plans will be required
**Why <=8 phases matters:**
- writing-plans skill has hard limit of 8 phases per implementation plan
- Exceeding 8 phases forces user to scope or split
- This is by design to prevent overwhelming implementation plans
**If design needs >8 phases:**
Add note to Additional Considerations:
```markdownsrc/services/auth/src/services/auth/src/types/auth.ts
不规范结构(任务级——属于实施计划范畴):
设计计划描述**要构建什么**,实施计划描述**如何一步步构建**。
**阶段数量:**
- 目标:5-8个阶段(规划的最佳范围)
- 最大值:8个阶段(writing-plans技能的硬限制)
- 如果需要>8个阶段:需注明需要多个实施计划
**为什么≤8个阶段很重要:**
- writing-plans技能每个实施计划最多支持8个阶段
- 超过8个阶段会迫使用户调整范围或拆分
- 这是有意设计的,以避免实施计划过于复杂
**如果设计需要>8个阶段:**
在“其他考虑事项”中添加说明:
```markdownundefinedundefined<!-- START_PHASE_1 --><!-- START_PHASE_1 -->package.jsontsconfig.jsonsrc/index.tsnpm installnpm run build
**Functionality phase example:**
```markdown
<!-- START_PHASE_2 -->package.jsontsconfig.jsonsrc/index.tsnpm installnpm run build
**功能阶段示例:**
```markdown
<!-- START_PHASE_2 -->src/services/auth/src/services/auth/
Bad Phase definitions:
**Too vague:**
```markdownsrc/services/auth/src/services/auth/
不规范的阶段定义:
**过于模糊:**
```markdown
**Too detailed (task-level):**
```markdown
**过于详细(任务级):**
```markdownsrc/types/token.tssrc/services/auth/token-service.tstests/services/auth/token-service.test.ts
The second example is doing implementation planning's job. Design plans stay at component level.src/types/token.tssrc/services/auth/token-service.tstests/services/auth/token-service.test.ts
第二个示例属于实施计划的工作,设计计划应停留在组件级别。undefinedundefinedsrc/services/auth/src/api/middleware/auth.tssrc/data/token-store.ts
**Example - Bad:**
```markdownsrc/services/auth/src/api/middleware/auth.tssrc/data/token-store.ts
**示例——不规范:**
```markdownundefinedundefinedundefinedundefinedsrc/services/legacy-auth/src/services/<domain>/src/api/middleware/src/data/src/data/session-store.ts
**If no existing patterns:**
```markdownsrc/services/legacy-auth/src/services/<domain>/src/api/middleware/src/data/src/data/session-store.ts
**如果没有现有模式:**
```markdownsrc/services/src/api/middleware/
**If diverging from existing patterns:**
```markdownsrc/services/src/api/middleware/
**如果偏离现有模式:**
```markdownsrc/auth/src/auth/auth.jstoken-service.tsvalidator.tsundefinedsrc/auth/src/auth/auth.jstoken-service.tsvalidator.tsundefinedundefinedundefined
**Edge cases** - if non-obvious:
```markdown
**Edge cases:** Clock skew handled by 5-minute token validation window. Revoked tokens remain in database for 7 days for audit trail.**Future extensibility:** Token claims structure supports adding user metadata (currently unused). Enables future human user authentication without architecture change.
**边缘情况**——如果非显而易见:
```markdown
**边缘情况:** 通过5分钟的Token验证窗口处理时钟偏差。已吊销的令牌在数据库中保留7天用于审计追踪。**未来扩展性:** Token claims结构支持添加用户元数据(当前未使用)。无需更改架构即可支持未来的人类用户认证。{slug}.AC{N}.{M}{slug}YYYY-MM-DD-.md2025-01-18-oauth2-svc-authn.mdoauth2-svc-authnundefined{slug}.AC{N}.{M}{slug}YYYY-MM-DD-.md2025-01-18-oauth2-svc-authn.mdoauth2-svc-authnundefined
**Why scoped:** Multiple plan-and-execute rounds accumulate tests in the same codebase. Scoped identifiers prevent collision—`oauth2-svc-authn.AC2.1` and `user-prof.AC2.1` are unambiguous. Implementation phases, task specs, and test names all use the full scoped identifier.
**带范围的原因:** 多轮规划与执行会在同一代码库中积累测试。带范围的标识符避免冲突——`oauth2-svc-authn.AC2.1`和`user-prof.AC2.1`不会混淆。实施阶段、任务规范和测试名称均使用完整的带范围标识符。undefinedundefined
**Step 2: Dispatch extraction subagent**
Use the Task tool to generate Summary and Glossary:
**Step 3: Review omitted terms with user**
Before inserting the extracted sections, briefly mention the omitted terms to the user:
"Glossary includes [X terms]. Omitted as likely obvious: [list from subagent]. Let me know if any of those should be included."
Don't wait for approval — proceed to insert the sections. The user can hit escape and ask for adjustments if needed.
**Step 4: Replace placeholders**
Replace the Summary and Glossary placeholder comments with the subagent's output. Do not insert the Omitted Terms section — that was for your transparency message only.
**Step 5: Review and adjust**
Briefly review the generated sections for accuracy. The subagent may miss nuance from the conversation — adjust if needed, but prefer the subagent's version when it's accurate (it reflects what the document actually says, not what you remember).
**步骤2:调度提取子代理**
使用Task工具生成摘要和术语表:
**步骤3:与用户确认省略的术语**
在插入提取的章节前,向用户简要提及省略的术语:
"术语表包含[X个术语]。因认为过于明显而省略的术语:[子代理提供的列表]。如果其中有需要包含的,请告知我。"
无需等待确认,继续插入章节。如果需要调整,用户可中断并提出修改请求。
**步骤4:替换占位符**
将摘要和术语表的占位符注释替换为子代理的输出。不要插入“省略的术语”章节——该部分仅用于你的透明度说明。
**步骤5:审阅和调整**
简要审阅生成的章节以确保准确性。子代理可能会遗漏对话中的细微差别——如有需要可调整,但在准确的情况下优先使用子代理的版本(它反映了文档实际内容,而非你的记忆)。git add docs/design-plans/YYYY-MM-DD-<topic>.md
git commit -m "$(cat <<'EOF'
docs: add [feature name] design plan
Completed brainstorming session. Design includes:
- [Key architectural decision 1]
- [Key architectural decision 2]
- [N] implementation phases
EOF
)"docs/design-plans/YYYY-MM-DD-<topic>.mdgit add docs/design-plans/YYYY-MM-DD-<topic>.md
git commit -m "$(cat <<'EOF'
docs: add [feature name] design plan
Completed brainstorming session. Design includes:
- [Key architectural decision 1]
- [Key architectural decision 2]
- [N] implementation phases
EOF
)"docs/design-plans/YYYY-MM-DD-<topic>.md| Excuse | Reality |
|---|---|
| "I'll write the summary first since I know what I'm building" | Write body first. Summarize what you wrote, not what you planned. |
| "I can write Summary and Glossary myself, don't need subagent" | Subagent has fresh context and acts as forcing function. Use it. |
| "Glossary isn't needed, terms are obvious" | Obvious to you after brainstorming. Not to fresh reviewer. Include it. |
| "Design is simple, don't need phases" | Phases make implementation manageable. Always include. |
| "Phases are obvious, don't need detail" | writing-plans needs component descriptions. Provide them. |
| "Can have 10 phases if needed" | Hard limit is 8. Scope or split. |
| "I'll include the code so implementation is easier" | No. Implementation plans generate code fresh from codebase state. Design provides direction only. |
| "Breaking into tasks helps the reader" | Task breakdown is implementation planning's job. Design stays at component level. |
| "I'll just show how the function works" | Implementation code doesn't belong in design. Show contracts/interfaces if needed, not function bodies. |
| "Additional considerations should be comprehensive" | Only include if relevant. YAGNI applies. |
| "Should document all future possibilities" | Document current design only. No hypotheticals. |
| "Existing patterns section can be skipped" | Shows investigation happened. Always include. |
| "Can use generic file paths" | Exact paths from investigation. No handwaving. |
| "Tests can be a separate phase at the end" | No. Tests for functionality belong in the phase that creates that functionality. |
| "We'll add tests after the code works" | Phase isn't done until its tests pass. Tests are deliverables, not afterthoughts. |
| "Infrastructure needs unit tests too" | No. Infrastructure verified operationally. Don't over-engineer. |
| "Phase 3 tests will cover Phase 2 code" | Each phase tests its own deliverables. Later phases may extend tests, but don't defer. |
| "Phase markers are just noise" | Markers enable granular parsing. Implementation planning depends on them. Always include. |
| "Acceptance criteria are just the Definition of Done restated" | Criteria must be specific and verifiable. "System is secure" becomes "API rejects invalid tokens with 401." |
| "User approved DoD, don't need to validate criteria" | Criteria translate DoD into testable items. User must confirm this translation is correct. |
| "I'll skip criteria validation to save time" | Implementation planning depends on validated criteria. Skipping creates downstream confusion. |
| "Criteria are obvious from the phases" | Obvious to you. User must confirm they agree on what 'done' means before proceeding. |
| 借口 | 实际情况 |
|---|---|
| "我先写摘要,因为我知道要构建什么" | 先写主体内容,总结你实际编写的内容,而非计划的内容。 |
| "我自己可以写摘要和术语表,不需要子代理" | 子代理具有全新上下文,起到强制约束作用。请使用它。 |
| "术语表不需要,术语都很明显" | 头脑风暴后对你来说明显,但对新审阅者不然。请包含术语表。 |
| "设计很简单,不需要阶段划分" | 阶段划分使实施更易于管理。始终包含阶段。 |
| "阶段很明显,不需要详细说明" | writing-plans技能需要组件描述。请提供详细信息。 |
| "需要的话可以有10个阶段" | 硬限制是8个阶段。调整范围或拆分。 |
| "我包含代码会让实施更容易" | 不行。实施计划会根据代码库状态重新生成代码。设计仅提供方向。 |
| "拆分成任务有助于读者理解" | 任务拆分是实施计划的工作。设计停留在组件级别。 |
| "我展示函数的工作方式" | 实现代码不属于设计范畴。如有需要,展示契约/接口,而非函数体。 |
| "其他考虑事项应全面" | 仅包含相关内容。YAGNI原则适用。 |
| "应记录所有未来可能性" | 仅记录当前设计。不要包含假设内容。 |
| "现有模式章节可以跳过" | 该章节证明已完成调研。始终包含。 |
| "可以使用通用文件路径" | 使用调研得到的精确路径。不要含糊其辞。 |
| "测试可以放在最后单独的阶段" | 不行。功能对应的测试属于构建该功能的阶段。 |
| "代码运行后再添加测试" | 阶段完成的标准是测试通过。测试是交付成果,而非事后补充。 |
| "基础设施也需要单元测试" | 不需要。基础设施通过操作验证。不要过度设计。 |
| "阶段3的测试会覆盖阶段2的代码" | 每个阶段测试自己的交付成果。后续阶段可能扩展测试,但不要延迟。 |
| "阶段标记只是噪音" | 标记支持细粒度解析。实施计划依赖这些标记。始终包含。 |
| "验收标准只是完成定义的重述" | 标准必须具体、可验证。“系统是安全的”要转化为“API拒绝无效令牌并返回401”。 |
| "用户已确认完成定义,不需要验证标准" | 标准将完成定义转化为可测试的条目。用户必须确认该转化是正确的。 |
| "我跳过标准验证以节省时间" | 实施计划依赖已验证的标准。跳过会导致后续混淆。 |
| "阶段中已明确包含标准" | 对你来说明显,但用户必须确认他们对“完成”的理解一致,然后再继续。 |
Phase 3 (Definition of Done) completes
-> User confirms Definition of Done
-> File created with Title, Summary placeholder, DoD, AC placeholder, Glossary placeholder
-> DoD captured at full fidelity
Brainstorming (Phase 4) completes
-> Validated design exists in conversation
-> User approved incrementally
Writing Design Plans (this skill)
-> Append body: Architecture, Existing Patterns, Implementation Phases, Additional Considerations
-> Add exact paths from investigation
-> Create discrete phases (<=8)
-> Generate Acceptance Criteria inline (success + failure cases for each DoD item)
-> USER VALIDATES Acceptance Criteria
-> Replace AC placeholder with validated criteria
-> Dispatch subagent to generate Summary and Glossary
-> Replace Summary/Glossary placeholders with generated content
-> Commit to git
Writing Implementation Plans (next step)
-> Reads this design document
-> Uses phases as basis for detailed tasks
-> Uses Acceptance Criteria to generate test-requirements.md
-> Expects exact paths and structure第3阶段(完成定义)完成
-> 用户确认完成定义
-> 创建包含标题、摘要占位符、完成定义、验收标准占位符、术语表占位符的文件
-> 完整记录完成定义
头脑风暴(第4阶段)完成
-> 对话中存在已验证的设计
-> 用户已逐步确认
编写设计计划(本技能)
-> 追加主体内容:架构、现有模式、实施阶段、其他考虑事项
-> 添加来自调研的精确路径
-> 划分独立阶段(≤8个)
-> 内联生成验收标准(每个完成定义条目的成功+失败场景)
-> 用户验证验收标准
-> 用已验证的标准替换占位符
-> 调度子代理生成摘要和术语表
-> 用生成的内容替换摘要/术语表占位符
-> 提交到git
编写实施计划(下一步)
-> 读取本设计文档
-> 以阶段为基础生成详细任务
-> 用验收标准生成test-requirements.md
-> 依赖精确的路径和结构