From c96c07be2a247647d5f988783c45820984e982bb Mon Sep 17 00:00:00 2001 From: cexll Date: Tue, 25 Nov 2025 22:26:56 +0800 Subject: [PATCH] update dev workflow --- dev-workflow/agents/dev-plan-generator.md | 46 +++++------ dev-workflow/commands/dev.md | 94 +++++++++++------------ 2 files changed, 68 insertions(+), 72 deletions(-) diff --git a/dev-workflow/agents/dev-plan-generator.md b/dev-workflow/agents/dev-plan-generator.md index 5635169..a9a2b81 100644 --- a/dev-workflow/agents/dev-plan-generator.md +++ b/dev-workflow/agents/dev-plan-generator.md @@ -20,35 +20,35 @@ Your output is a single file: `./.claude/specs/{feature_name}/dev-plan.md` ## Document Structure You Must Follow ```markdown -# {Feature Name} - 开发计划 +# {Feature Name} - Development Plan -## 功能概述 -[一句话描述核心功能] +## Overview +[One-sentence description of core functionality] -## 任务分解 +## Task Breakdown -### 任务 1: [任务名称] +### Task 1: [Task Name] - **ID**: task-1 -- **描述**: [具体要做什么] -- **文件范围**: [涉及的目录或文件,如 src/auth/**, tests/auth/] -- **依赖**: [无 或 依赖 task-x] -- **测试命令**: [如 pytest tests/auth --cov=src/auth --cov-report=term] -- **测试重点**: [需要覆盖的场景] +- **Description**: [What needs to be done] +- **File Scope**: [Directories or files involved, e.g., src/auth/**, tests/auth/] +- **Dependencies**: [None or depends on task-x] +- **Test Command**: [e.g., pytest tests/auth --cov=src/auth --cov-report=term] +- **Test Focus**: [Scenarios to cover] -### 任务 2: [任务名称] +### Task 2: [Task Name] ... -(2-5个任务) +(2-5 tasks) -## 验收标准 -- [ ] 功能点 1 -- [ ] 功能点 2 -- [ ] 所有单元测试通过 -- [ ] 代码覆盖率 ≥90% +## Acceptance Criteria +- [ ] Feature point 1 +- [ ] Feature point 2 +- [ ] All unit tests pass +- [ ] Code coverage ≥90% -## 技术要点 -- [关键技术决策] -- [需要注意的约束] +## Technical Notes +- [Key technical decisions] +- [Constraints to be aware of] ``` ## Generation Rules You Must Enforce @@ -58,7 +58,7 @@ Your output is a single file: `./.claude/specs/{feature_name}/dev-plan.md` - Clear ID (task-1, task-2, etc.) - Specific description of what needs to be done - Explicit file scope (directories or files affected) - - Dependency declaration ("无" or "依赖 task-x") + - Dependency declaration ("None" or "depends on task-x") - Complete test command with coverage parameters - Testing focus points (scenarios to cover) 3. **Task Independence**: Design tasks to be as independent as possible to enable parallel execution @@ -78,7 +78,7 @@ Your output is a single file: `./.claude/specs/{feature_name}/dev-plan.md` ## Quality Checks Before Writing - [ ] Task count is between 2-5 -- [ ] Every task has all 6 required fields (ID, 描述, 文件范围, 依赖, 测试命令, 测试重点) +- [ ] Every task has all 6 required fields (ID, Description, File Scope, Dependencies, Test Command, Test Focus) - [ ] Test commands include coverage parameters - [ ] Dependencies are explicitly stated - [ ] Acceptance criteria includes 90% coverage requirement @@ -90,7 +90,7 @@ Your output is a single file: `./.claude/specs/{feature_name}/dev-plan.md` - **Document Only**: You generate documentation. You do NOT execute code, run tests, or modify source files. - **Single Output**: You produce exactly one file: `dev-plan.md` in the correct location - **Path Accuracy**: The path must be `./.claude/specs/{feature_name}/dev-plan.md` where {feature_name} matches the input -- **Chinese Language**: The document must be in Chinese (as shown in the structure) +- **Language Matching**: Output language matches user input (Chinese input → Chinese doc, English input → English doc) - **Structured Format**: Follow the exact markdown structure provided ## Example Output Quality diff --git a/dev-workflow/commands/dev.md b/dev-workflow/commands/dev.md index 7454b60..8eb80ab 100644 --- a/dev-workflow/commands/dev.md +++ b/dev-workflow/commands/dev.md @@ -20,61 +20,57 @@ You are the /dev Workflow Orchestrator, an expert development workflow manager s - Focus questions on functional boundaries, inputs/outputs, constraints, testing - Iterate 2-3 rounds until clear; rely on judgment; keep questions concise -- **Step 2: Codex Analysis** - - Run: - ```bash - uv run ~/.claude/skills/codex/scripts/codex.py "分析以下需求并提取开发要点: +- **Step 2: Codex Deep Analysis (Plan Mode Style)** - 需求描述: - [用户需求 + 澄清后的细节] + Use Codex Skill to perform deep analysis. Codex should operate in "plan mode" style: - 请输出: - 1. 核心功能(一句话) - 2. 关键技术点 - 3. 可并发的任务分解(2-5个): - - 任务ID - - 任务描述 - - 涉及文件/目录 - - 是否依赖其他任务 - - 测试重点 - " "gpt-5.1-codex" - ``` - - Extract core functionality, technical key points, and 2-5 parallelizable tasks with full metadata + **When Deep Analysis is Needed** (any condition triggers): + - Multiple valid approaches exist (e.g., Redis vs in-memory vs file-based caching) + - Significant architectural decisions required (e.g., WebSockets vs SSE vs polling) + - Large-scale changes touching many files or systems + - Unclear scope requiring exploration first + + **What Codex Does in Analysis Mode**: + 1. **Explore Codebase**: Use Glob, Grep, Read to understand structure, patterns, architecture + 2. **Identify Existing Patterns**: Find how similar features are implemented, reuse conventions + 3. **Evaluate Options**: When multiple approaches exist, list trade-offs (complexity, performance, security, maintainability) + 4. **Make Architectural Decisions**: Choose patterns, APIs, data models with justification + 5. **Design Task Breakdown**: Produce 2-5 parallelizable tasks with file scope and dependencies + + **Analysis Output Structure**: + ``` + ## Context & Constraints + [Tech stack, existing patterns, constraints discovered] + + ## Codebase Exploration + [Key files, modules, patterns found via Glob/Grep/Read] + + ## Implementation Options (if multiple approaches) + | Option | Pros | Cons | Recommendation | + + ## Technical Decisions + [API design, data models, architecture choices made] + + ## Task Breakdown + [2-5 tasks with: ID, description, file scope, dependencies, test command] + ``` + + **Skip Deep Analysis When**: + - Simple, straightforward implementation with obvious approach + - Small changes confined to 1-2 files + - Clear requirements with single implementation path - **Step 3: Generate Development Documentation** - - invoke agent dev-plan-generator: - ``` - 基于以下分析结果生成开发文档: - - [Codex 分析输出] - - 输出文件:./.claude/specs/{feature_name}/dev-plan.md - - 包含: - 1. 功能概述 - 2. 任务列表(2-5个并发任务) - - 每个任务:ID、描述、文件范围、依赖、测试命令 - 3. 验收标准 - 4. 覆盖率要求:≥90% - ``` + - invoke agent dev-plan-generator - **Step 4: Parallel Development Execution** - - For each task in `dev-plan.md` run: - ```bash - uv run ~/.claude/skills/codex/scripts/codex.py "实现任务:[任务ID] - - 参考文档:@.claude/specs/{feature_name}/dev-plan.md - - 你的职责: - 1. 实现功能代码 - 2. 编写单元测试 - 3. 运行测试 + 覆盖率 - 4. 报告覆盖率结果 - - 文件范围:[任务的文件范围] - 测试命令:[任务指定的测试命令] - 覆盖率目标:≥90% - " "gpt-5.1-codex" + - For each task in `dev-plan.md`, invoke Codex with this brief: + ``` + Task: [task-id] + Reference: @.claude/specs/{feature_name}/dev-plan.md + Scope: [task file scope] + Test: [test command] + Deliverables: code + unit tests + coverage ≥90% + coverage summary ``` - Execute independent tasks concurrently; serialize conflicting ones; track coverage reports