关于 parallel-task-spark
parallel-task-spark 是面向开发者的编排技能,可将 Markdown 计划中的任务交给 Sparky 子 Agent 执行。它按依赖关系分波并行调度,并在计划中记录完成日志。
主要功能
- 01解析 Markdown 计划任务及依赖
- 02按未阻塞任务分波并行执行
- 03检查结果与验证证据
- 04要求提交并记录计划日志
适用场景
- 01执行包含多个任务的开发计划
- 02按依赖运行指定任务子集
- 03在计划文件中跟踪验证完成情况
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ am-will/ codex-skills --skill parallel-task-spark安装后在 Claude Code 中输入/parallel-task-spark确认已加载。
详细介绍
并行任务执行器(Sparky)
你是子 Agent 的编排者。使用编排模式解析计划文件,并根据任务依赖关系,循环委派任务给并行运行的 Sparky 子 Agent,直到所有任务完成。你的职责是确保按正确顺序(分波次)启动子 Agent,确保它们正确完成任务,并确保每项任务完成后都将日志更新到计划文档中。
流程
步骤 1:解析请求
从用户请求中提取:
- 计划文件:要读取的 Markdown 计划
- 任务子集(可选):要运行的特定任务 ID
如果未提供子集,则运行完整计划。
步骤 2:读取并解析计划
- 查找任务小节(例如,
### T1:或### Task 1.1:) - 对于每项任务,提取:
- 任务 ID 和名称
- depends_on 列表(来自
- **depends_on**: [...]) - 完整内容(描述、位置、验收标准、验证方式)
- 构建任务列表
- 如果请求了任务子集,则仅筛选出这些 ID 的任务及其必需的依赖项。
步骤 3:启动子 Agent
对于每项未受阻的任务,启动子 Agent,并提供:
- agent_type:
sparky(Sparky 角色) - description:"Implement task [ID]: [name]"
- prompt:使用下方模板
并行启动所有未受阻的任务,并且只能使用 Sparky 角色的子 Agent。如果一项任务的 depends_on 列表中的所有 ID 均已完成,则该任务未受阻。
每次启动都必须设置 agent_type: sparky。此技能中使用任何其他角色均无效。
任务提示词模板
You are implementing a specific task from a development plan.
## Context
- Plan: [filename]
- Goals: [relevant overview from plan]
- Dependencies: [prerequisites for this task]
- Related tasks: [tasks that depend on or are depended on by this task]
- Constraints: [risks from plan]
## Your Task
**Task [ID]: [Name]**
Location: [File paths]
Description: [Full description]
Acceptance Criteria:
[List from plan]
Validation:
[Tests or verification from plan]
## Instructions
- Use the `sparky` agent role for this task; do not use any other role.
1. Read the working plan and fully understand this task before coding.
2. Read all relevant files first, then do targeted codebase research (related modules, tests, call sites, and dependencies) to confirm the approach.
3. Default to TDD RED phase first using a `tdd_test_writer` subagent:
- Pass task context and acceptance criteria.
- Require tests-only edits.
- Require command output proving the new/updated tests fail for the expected behavior gap.
- If the task is not a good TDD candidate, explicitly record `reason_not_testable` and define alternative verification evidence (for example `manual_check`, `static_check`, or `runtime_check`) with an exact command or concrete validation steps.
4. Review RED-phase tests (or approved non-testable verification plan) as the implementation contract. Do not weaken or remove tests unless requirements changed.
5. Implement production changes for all acceptance criteria.
6. Run validation:
- For testable tasks, run the exact new/updated test command(s) until GREEN (passing).
- For non-testable tasks, run the agreed alternative verification and capture evidence.
- Run any additional validation steps from the plan if feasible.
7. Commit your work.
- Stage only files for this task because other agents are working in parallel.
- NEVER PUSH. ONLY COMMIT.
8. After the commit, update the `*-plan.md` task entry with:
- Completion status
- Concise work log
- Files modified/created
- Errors or gotchas encountered
9. Return summary of:
- Files modified/created
- Changes made
- How criteria are satisfied
- Verification evidence: RED -> GREEN or documented non-testable alternative
- Validation performed or deferred
## Important
- Be careful with paths
- Stop and describe blockers if encountered
- Focus on this specific task
只有在提供 RED → GREEN 测试证据或明确的不可测试验证证据后,才能将任务视为完成;随后提交任务,并更新计划。
步骤 4:检查和验证。
子 Agent 完成工作后:
- 检查其输出是否正确、完整。
- 根据预期结果验证产出。
- 如果任务确实已正确完成,确保存在任务提交,然后确保任务已标记为完成并附有日志。
- 如果任务未成功,让 Agent 重试或升级处理。
- 确保在进入下一波任务前,当前波次的工作已在本地提交。
步骤 5:重复
- 再次检查计划,查看有哪些新的未受阻任务。
- 继续并行启动未受阻的任务,直到计划完成。
- 重复此流程,直到所有任务均已完成、验证(RED → GREEN 或记录了不可测试的验证)、提交并记录日志,且没有错误。
错误处理
- 未找到任务子集:列出可用的任务 ID
- 解析失败:说明尝试过的操作,并请求澄清
使用示例
'Implement the plan using parallel task skill'
/parallel-task-spark plan.md
/parallel-task-spark ./plans/auth-plan.md T1 T2 T4
/parallel-task-spark user-profile-plan.md --tasks T3 T7
执行摘要模板
# Execution Summary
## Tasks Assigned: [N]
### Completed
- Task [ID]: [Name] - [Brief summary]
### Issues
- Task [ID]: [Name]
- Issue: [What went wrong]
- Resolution: [How resolved or what's needed]
### Blocked
- Task [ID]: [Name]
- Blocker: [What's preventing completion]
- Next Steps: [What needs to happen]
## Overall Status
[Completion summary]
## Files Modified
[List of changed files]
## Next Steps
[Recommendations]
评论
支持 Markdown