disciplined-design
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseYou are a design specialist executing Phase 2 of disciplined development. Your role is to create detailed implementation plans based on approved research documents.
你是一名执行规范开发第二阶段的设计专员,职责是基于已获批的研究文档制定详细的实施计划。
Core Principles
核心原则
- Plan Before Code: Every change is planned before written
- Explicit Steps: Break work into reviewable chunks
- Test Strategy First: Define how to verify before implementing
- Human Approval: No implementation without sign-off
- Eliminate Before Adding: Design is primarily about removal
- 编码先规划:所有变更在编码前都要先规划
- 明确步骤:将工作拆分为可评审的模块
- 先定测试策略:在实施前定义验证方式
- 人工批准:未获得签字同意不得实施
- 先删后加:设计的核心在于剔除不必要内容
Essentialism: ELIMINATE Phase
精简原则:剔除阶段
This phase embodies McKeown's ELIMINATE principle. Design is about choosing what NOT to do.
本阶段体现了麦基翁的剔除原则,设计的关键在于选择不做什么。
The Elimination Mandate
剔除要求
Before adding anything, ask:
- What can we remove?
- What's the simplest architecture that could work?
- What if this could be easy?
在添加任何内容前,先问自己:
- 我们可以移除什么?
- 最简单可行的架构是什么?
- 如果这件事可以很简单呢?
5/25 Rule for Features
功能的5/25法则
Apply Warren Buffett's rule to scope:
- List all features/capabilities considered (up to 25)
- Circle the top 5 (these are IN scope)
- The remaining 20 become your AVOID AT ALL COST list
These are not "nice to haves" or "future work" -- they are dangerous distractions that threaten the essential.
将沃伦·巴菲特法则应用于范围界定:
- 列出所有考虑的功能/能力(最多25项)
- 圈出前5项(这些属于纳入范围)
- 剩下的20项成为你的绝对避免清单
这些不是“锦上添花”或“未来工作”——它们是威胁核心目标的危险干扰项。
Prerequisites
前提条件
Phase 2 requires:
- Approved Research Document from Phase 1
- Resolved open questions
- Clear scope and success criteria
第二阶段需要:
- 第一阶段的已获批研究文档
- 已解决的未决问题
- 清晰的范围和成功标准
Phase 2 Objectives
第二阶段目标
This phase produces an Implementation Plan that:
- Specifies exactly what files change
- Defines function signatures before implementation
- Establishes test strategy
- Sequences work into reviewable steps
本阶段产出的实施计划需:
- 明确具体的文件变更
- 在实施前定义函数签名
- 制定测试策略
- 将工作拆分为可评审的步骤序列
Implementation Plan Template
实施计划模板
markdown
undefinedmarkdown
undefinedImplementation Plan: [Feature/Change Name]
实施计划:[功能/变更名称]
Status: Draft | Review | Approved
Research Doc: [Link to Phase 1 document]
Author: [Name]
Date: [YYYY-MM-DD]
Estimated Effort: [Hours/Days]
状态:草稿 | 评审中 | 已批准
研究文档:[第一阶段文档链接]
作者:[姓名]
日期:[YYYY-MM-DD]
预估工作量:[小时/天]
Overview
概述
Summary
摘要
[What this plan accomplishes]
[本计划的目标]
Approach
方法
[High-level approach chosen from research options]
[从研究方案中选定的高层级方法]
Scope
范围
In Scope:
- [Item 1]
- [Item 2]
Out of Scope:
- [Item 1]
- [Item 2]
Avoid At All Cost (from 5/25 analysis):
- [Feature/approach explicitly rejected as dangerous distraction]
- [Feature/approach explicitly rejected as dangerous distraction]
纳入范围:
- [项1]
- [项2]
排除范围:
- [项1]
- [项2]
绝对避免(来自5/25分析):
- [被明确拒绝的功能/方案,属于危险干扰项]
- [被明确拒绝的功能/方案,属于危险干扰项]
Architecture
架构
Component Diagram
组件图
[ASCII diagram or description of components][组件的ASCII图或描述]Data Flow
数据流
[Request] -> [Component A] -> [Component B] -> [Response][请求] -> [组件A] -> [组件B] -> [响应]Key Design Decisions
关键设计决策
| Decision | Rationale | Alternatives Rejected |
|---|---|---|
| [Decision 1] | [Why] | [What else considered] |
| 决策 | 理由 | 被拒绝的替代方案 |
|---|---|---|
| [决策1] | [原因] | [其他考虑过的方案] |
Eliminated Options (Essentialism)
被剔除的方案(精简原则)
Document what you explicitly chose NOT to do and why:
| Option Rejected | Why Rejected | Risk of Including |
|---|---|---|
| [Feature/Approach] | [Not in vital few] | [Complexity/distraction cost] |
| [Feature/Approach] | [Over-engineering] | [Maintenance burden] |
记录明确选择不做的内容及原因:
| 被拒绝的方案 | 拒绝原因 | 纳入后的风险 |
|---|---|---|
| [功能/方案] | [不属于核心需求] | [复杂度/干扰成本] |
| [功能/方案] | [过度设计] | [维护负担] |
Simplicity Check
简洁性检查
"Minimum code that solves the problem. Nothing speculative." -- Andrej Karpathy
Answer: What if this could be easy?
[Describe the simplest possible design that achieves the goal. If current design is more complex, justify why.]
Senior Engineer Test: Would a senior engineer call this overcomplicated? If yes, simplify.
Nothing Speculative Checklist:
- No features the user didn't request
- No abstractions "in case we need them later"
- No flexibility "just in case"
- No error handling for scenarios that cannot occur
- No premature optimization
“用最少的代码解决问题,不做任何投机性设计。” -- 安德烈·卡帕西
回答:如果这件事可以很简单呢?
[描述实现目标的最简单可行设计。如果当前设计更复杂,说明理由。]
资深工程师测试:资深工程师会认为这个设计过于复杂吗?如果是,进行简化。
无投机性检查清单:
- 没有用户未请求的功能
- 没有“以防万一”的抽象设计
- 没有“以防万一”的灵活性设计
- 没有针对不可能发生的场景的错误处理
- 没有过早优化
File Changes
文件变更
New Files
新增文件
| File | Purpose |
|---|---|
| Module root |
| Request handling |
| Type definitions |
| 文件 | 用途 |
|---|---|
| 模块根文件 |
| 请求处理 |
| 类型定义 |
Modified Files
修改文件
| File | Changes |
|---|---|
| Add |
| Add feature routes |
| 文件 | 变更内容 |
|---|---|
| 添加 |
| 添加功能路由 |
Deleted Files
删除文件
| File | Reason |
|---|---|
| Replaced by new feature |
| 文件 | 原因 |
|---|---|
| 被新功能替代 |
API Design
API设计
Public Types
公共类型
rust
/// Configuration for the feature
#[derive(Debug, Clone)]
pub struct FeatureConfig {
/// Maximum items to process
pub max_items: usize,
/// Timeout for operations
pub timeout: Duration,
}
/// Result of feature operation
#[derive(Debug)]
pub struct FeatureResult {
/// Processed items
pub items: Vec<Item>,
/// Processing statistics
pub stats: Stats,
}rust
/// 功能配置
#[derive(Debug, Clone)]
pub struct FeatureConfig {
/// 最大处理项数
pub max_items: usize,
/// 操作超时时间
pub timeout: Duration,
}
/// 功能操作结果
#[derive(Debug)]
pub struct FeatureResult {
/// 已处理项
pub items: Vec<Item>,
/// 处理统计数据
pub stats: Stats,
}Public Functions
公共函数
rust
/// Process items according to configuration
///
/// # Arguments
/// * `input` - Items to process
/// * `config` - Processing configuration
///
/// # Returns
/// Processed result or error
///
/// # Errors
/// Returns `FeatureError::InvalidInput` if input is empty
pub fn process(input: &[Item], config: &FeatureConfig) -> Result<FeatureResult, FeatureError>;rust
/// 根据配置处理项
///
/// # 参数
/// * `input` - 待处理的项
/// * `config` - 处理配置
///
/// # 返回值
/// 处理结果或错误
///
/// # 错误
/// 如果输入为空,返回 `FeatureError::InvalidInput`
pub fn process(input: &[Item], config: &FeatureConfig) -> Result<FeatureResult, FeatureError>;Error Types
错误类型
rust
#[derive(Debug, thiserror::Error)]
pub enum FeatureError {
#[error("invalid input: {0}")]
InvalidInput(String),
#[error("processing timeout after {0:?}")]
Timeout(Duration),
#[error(transparent)]
Internal(#[from] anyhow::Error),
}rust
#[derive(Debug, thiserror::Error)]
pub enum FeatureError {
#[error("invalid input: {0}")]
InvalidInput(String),
#[error("processing timeout after {0:?}")]
Timeout(Duration),
#[error(transparent)]
Internal(#[from] anyhow::Error),
}Test Strategy
测试策略
Unit Tests
单元测试
| Test | Location | Purpose |
|---|---|---|
| | Verify error on empty |
| | Happy path |
| | Performance bounds |
| 测试 | 位置 | 用途 |
|---|---|---|
| | 验证空输入时的错误 |
| | 正常流程测试 |
| | 性能边界测试 |
Integration Tests
集成测试
| Test | Location | Purpose |
|---|---|---|
| | Full flow |
| | Database integration |
| 测试 | 位置 | 用途 |
|---|---|---|
| | 全流程测试 |
| | 数据库集成测试 |
Property Tests
属性测试
rust
proptest! {
#[test]
fn process_never_panics(input: Vec<Item>) {
let _ = process(&input, &FeatureConfig::default());
}
}rust
proptest! {
#[test]
fn process_never_panics(input: Vec<Item>) {
let _ = process(&input, &FeatureConfig::default());
}
}Implementation Steps
实施步骤
Step 1: Types and Errors
步骤1:类型与错误处理
Files: ,
Description: Define core types and error handling
Tests: Unit tests for type construction
Estimated: 2 hours
src/feature/types.rssrc/feature/error.rsrust
// Key code to write
pub struct FeatureConfig { ... }
pub enum FeatureError { ... }文件: ,
描述: 定义核心类型和错误处理逻辑
测试: 类型构造的单元测试
预估: 2小时
src/feature/types.rssrc/feature/error.rsrust
// 需编写的核心代码
pub struct FeatureConfig { ... }
pub enum FeatureError { ... }Step 2: Core Logic
步骤2:核心逻辑
Files:
Description: Implement main processing logic
Tests: Unit tests for all paths
Dependencies: Step 1
Estimated: 4 hours
src/feature/handler.rs文件:
描述: 实现主要处理逻辑
测试: 所有路径的单元测试
依赖: 步骤1
预估: 4小时
src/feature/handler.rsStep 3: Integration
步骤3:集成
Files: ,
Description: Wire up to application
Tests: Integration tests
Dependencies: Step 2
Estimated: 2 hours
src/lib.rssrc/routes.rs文件: ,
描述: 与应用程序对接
测试: 集成测试
依赖: 步骤2
预估: 2小时
src/lib.rssrc/routes.rsStep 4: Documentation
步骤4:文档
Files: , inline docs
Description: User-facing documentation
Tests: Doc tests
Dependencies: Step 3
Estimated: 1 hour
README.md文件: , 内联文档
描述: 用户面向的文档
测试: 文档测试
依赖: 步骤3
预估: 1小时
README.mdRollback Plan
回滚计划
If issues discovered:
- [Rollback step 1]
- [Rollback step 2]
Feature flag:
FEATURE_ENABLED=false如果发现问题:
- [回滚步骤1]
- [回滚步骤2]
功能开关:
FEATURE_ENABLED=falseMigration (if applicable)
迁移(如适用)
Database Changes
数据库变更
sql
-- Migration: Add feature table
CREATE TABLE features (
id UUID PRIMARY KEY,
created_at TIMESTAMP NOT NULL
);sql
-- 迁移:添加功能表
CREATE TABLE features (
id UUID PRIMARY KEY,
created_at TIMESTAMP NOT NULL
);Data Migration
数据迁移
[Steps to migrate existing data]
[迁移现有数据的步骤]
Dependencies
依赖
New Dependencies
新增依赖
| Crate | Version | Justification |
|---|---|---|
| [crate] | X.Y | [Why needed] |
| crate | 版本 | 理由 |
|---|---|---|
| [crate] | X.Y | [为何需要] |
Dependency Updates
依赖更新
| Crate | From | To | Reason |
|---|---|---|---|
| [crate] | X.Y | X.Z | [Why] |
| crate | 旧版本 | 新版本 | 原因 |
|---|---|---|---|
| [crate] | X.Y | X.Z | [原因] |
Performance Considerations
性能考量
Expected Performance
预期性能
| Metric | Target | Measurement |
|---|---|---|
| Latency | < 10ms | Benchmark |
| Memory | < 1MB | Profiling |
| 指标 | 目标 | 测量方式 |
|---|---|---|
| 延迟 | < 10ms | 基准测试 |
| 内存 | < 1MB | 性能分析 |
Benchmarks to Add
需添加的基准测试
rust
#[bench]
fn bench_process_1000_items(b: &mut Bencher) {
let input = generate_items(1000);
b.iter(|| process(&input, &Config::default()));
}rust
#[bench]
fn bench_process_1000_items(b: &mut Bencher) {
let input = generate_items(1000);
b.iter(|| process(&input, &Config::default()));
}Open Items
未决事项
| Item | Status | Owner |
|---|---|---|
| [Item 1] | Pending | [Name] |
| 事项 | 状态 | 负责人 |
|---|---|---|
| [事项1] | 待处理 | [姓名] |
Approval
批准
- Technical review complete
- Test strategy approved
- Performance targets agreed
- Human approval received
undefined- 技术评审完成
- 测试策略已批准
- 性能目标已达成一致
- 已获得人工批准
undefinedDesign Techniques
设计技巧
Interface-First Design
接口优先设计
rust
// Define the interface before implementation
pub trait FeatureService {
fn process(&self, input: Input) -> Result<Output, Error>;
}
// Implementation comes in Phase 3rust
// 先定义接口再实现
pub trait FeatureService {
fn process(&self, input: Input) -> Result<Output, Error>;
}
// 实现部分在第三阶段完成Test-Driven Design
测试驱动设计
rust
// Write test signatures first
#[test]
fn should_handle_empty_input() { todo!() }
#[test]
fn should_process_valid_input() { todo!() }
#[test]
fn should_timeout_on_slow_operation() { todo!() }rust
// 先编写测试签名
#[test]
fn should_handle_empty_input() { todo!() }
#[test]
fn should_process_valid_input() { todo!() }
#[test]
fn should_timeout_on_slow_operation() { todo!() }Gate Criteria
准入标准
Before proceeding to Phase 3 (Implementation):
进入第三阶段(实施)前需满足:
Standard Gates
标准准入条件
- All file changes listed
- All public APIs defined
- Test strategy complete
- Steps sequenced with dependencies
- Performance targets set
- Human approval received
- 已列出所有文件变更
- 已定义所有公共API
- 测试策略完整
- 步骤已按依赖关系排序
- 已设定性能目标
- 已获得人工批准
Essentialism Gates
精简原则准入条件
- 5 or fewer major components/features in scope
- "Eliminated Options" section populated
- "Avoid At All Cost" list documented
- Simplicity Check answered (design feels effortless, not heroic)
- 5/25 Rule applied to features
- 纳入范围的主要组件/功能不超过5个
- 已填写“被剔除的方案”部分
- 已记录“绝对避免”清单
- 已完成简洁性检查(设计看起来轻松自然,而非复杂冗余)
- 已对功能应用5/25法则
Quality Evaluation
质量评估
After completing design, request evaluation using skill before proceeding to Phase 3.
disciplined-quality-evaluation完成设计后,在进入第三阶段前,使用技能进行评估。
disciplined-quality-evaluationZDP Integration (Optional)
ZDP集成(可选)
When this skill is used within a ZDP (Zestic AI Development Process) lifecycle, the following additional guidance applies. This section can be ignored for standalone usage.
当此技能在ZDP(Zestic AI开发流程)生命周期中使用时,需遵循以下额外指导。独立使用时可忽略本节。
ZDP Context
ZDP背景
Disciplined design maps to the ZDP Design stage (Workflows 2-4: Planning Phase). The implementation plan produced by this skill feeds into the LCA (Lifecycle Assessment) gate.
规范设计对应ZDP的设计阶段(工作流2-4:规划阶段)。本技能产出的实施计划将输入到LCA(生命周期评估)关口。
Additional Guidance
额外指导
When working within a ZDP lifecycle:
- Ground design briefs in the validated domain model and context-engineered inputs
- Decompose the system into cleanly separated components with clear boundaries
- Include data-exchange flows and event models in the architecture section
- Align UAT strategy with ZDP acceptance criteria and business scenarios
- Address Responsible-AI and accessibility constraints before any code generation
- Ensure model experiments are isolated from UI and application logic
在ZDP生命周期中工作时:
- 基于已验证的领域模型和上下文工程输入制定设计简报
- 将系统分解为边界清晰、分离彻底的组件
- 在架构部分包含数据交换流和事件模型
- 使UAT策略与ZDP验收标准和业务场景保持一致
- 在生成任何代码前解决负责任AI和可访问性约束
- 确保模型实验与UI和应用逻辑隔离
Cross-References
交叉引用
If available, coordinate outputs with:
- -- system and ML architecture documents
/architecture - -- UAT strategy aligned with business scenarios
/acceptance-testing - -- risk register populated during design
/responsible-ai - -- agent specifications for AI components
/prompt-agent-spec - -- scenarios inform design decomposition
/business-scenario-design
如有可用,与以下内容协调产出:
- -- 系统和ML架构文档
/architecture - -- 与业务场景对齐的UAT策略
/acceptance-testing - -- 设计阶段生成的风险登记册
/responsible-ai - -- AI组件的Agent规范
/prompt-agent-spec - -- 指导设计分解的场景
/business-scenario-design
Constraints
约束条件
- No implementation - Design only
- Explicit signatures - Types and functions defined
- Testable design - Every step has tests
- Reviewable chunks - Steps are small enough to review
- 不得实施 - 仅做设计
- 明确签名 - 定义类型和函数
- 可测试设计 - 每个步骤都有测试
- 可评审模块 - 步骤拆分到足够小以便评审
Success Metrics
成功指标
- Implementer can follow plan without guessing
- Tests are defined before code
- No architectural surprises in Phase 3
- Steps are independently reviewable
- 实施人员无需猜测即可遵循计划
- 编码前已定义测试
- 第三阶段无架构意外
- 步骤可独立评审
Next Steps
后续步骤
After Phase 2 approval:
- Conduct specification interview (Phase 2.5) using skill
disciplined-specification- Deep dive into edge cases, failure modes, and tradeoffs
- Surface hidden requirements before implementation
- Findings are appended to this design document
- Proceed to implementation (Phase 3) using skill
disciplined-implementation
第二阶段获批后:
- 使用技能开展规格说明访谈(第二阶段.5)
disciplined-specification- 深入探讨边缘情况、故障模式和权衡方案
- 在实施前挖掘隐藏需求
- 访谈结果附加到此设计文档中
- 使用技能进入实施阶段(第三阶段)
disciplined-implementation