Skip to content

northseadl/norix-skills / agent-task-orchestration

agent-task-orchestration

Verified

Task decomposition and multi-agent orchestration with retry, checkpoint recovery, and real-time monitoring. Mixed Codex/Claude Code engine. Parallel/sequential execution.

references/task-decomposition.md

View on GitHub
# 任务拆解方法论

## 核心公理

> 一个好的 Codex 任务 = 一个可独立编译、可独立测试、可独立合并的变更集。

## 从需求到 Task 的拆解路径

### Step 1: 需求分类

| 类型 | 特征 | 拆解策略 |
|:---|:---|:---|
| **新功能** | 从零构建完整 Feature | 垂直切片: Screen → ViewModel → Repository → API |
| **跨端移植** | A 平台已完成,B 平台对齐 | 参照源端实现,逐 Feature 移植 |
| **契约修复** | 后端 API 缺失或字段不全 | 契约先行: Schema → Resolver → Test → 端对接 |
| **基础设施** | 项目骨架、CI/CD、监控 | 水平分层: 按工具链职责切分 |
| **Bug 修复** | 定位 → 修复 → 回归 | 问题域隔离: 缩小到最小复现路径 |

### Step 2: 粒度检查清单

每个拆解后的任务必须通过以下全部检查:

- [ ] **文件变更 ≤8**: 超过8个文件可能说明职责混杂
- [ ] **新增/修改 ≤500行**: 超过500行应考虑进一步拆分
- [ ] **验收条件 ≤3 个**: 太多验收条件说明功能范围过大
- [ ] **任务描述 ≤200字**: 描述不清楚说明任务边界模糊
- [ ] **可独立编译**: 不需要其他未完成任务的产出即可编译
- [ ] **可独立验证**: 有至少一个自动化验证手段(构建/测试/lint)

### Step 3: 依赖建模

使用三级依赖分类:

| 级别 | 含义 | 处理方式 |
|:---|:---|:---|
| **硬依赖** | 没有它完全无法开始 | 必须等待,标记 `← T{N}` |
| **软依赖** | 可以先用 stub/mock 开始 | 可并行,标记 `← T{N} (可 mock)` |
| **无依赖** | 完全独立 | 立即启动 |

### Step 4: 并行度最大化

拆解完成后,检查依赖图,确保:
1. **关键路径最短**: 串行链上的任务尽量拆小
2. **并行度最高**: 无依赖的任务尽量多
3. **无环形依赖**: DAG 必须是有向无环图

## 常见拆解模式

### 模式 A: Feature 垂直切片 (最常用)

```
T1: 数据层 (Model + Repository + API)
T2: 业务层 (ViewModel + UseCase)     ← T1
T3: UI 层  (Screen + Components)      ← T2
T4: 测试   (Unit + UI Test)           ← T3
```

### 模式 B: 跨端移植 (当前项目主要模式)

```
T1: 基础设施 (项目骨架 + 设计系统 + 网络层)
T2: P0 Feature 批量移植               ← T1
T3: P1 Feature 批量移植               ← T1
T4: 集成测试 + 发布准备               ← T2, T3
```

### 模式 C: 契约先行

```
T1: Schema 定义 + Resolver 实现 + 契约测试
T2a: Android 端对接                   ← T1
T2b: iOS 端对接                       ← T1
T3: 端到端测试                        ← T2a, T2b
```

## 反模式

| 反模式 | 问题 | 正确做法 |
|:---|:---|:---|
| 一个任务包含多个 Feature | Codex 容易偏离焦点 | 一个任务只做一个 Feature |
| 任务描述只有标题没有规格 | Codex 会自行猜测 | 提供精确的文件路径和验收条件 |
| 验收条件全是主观描述 | 无法自动验证 | 至少包含一个可执行的命令 |
| 不提供代码参照 | Codex 风格不一致 | 指定参考文件路径 |
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall