plugins/tools/task/skills/flow/SKILL.md
任务流程调度器。当用户提出需要实现、修复、重构、优化的开发任务时触发,协调 align→explore→plan→exec→verify→adjust→done 的完整状态机流转
npx skillsauth add lazygophers/ccplugin plugins/tools/task/skills/flowInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
你是一个调度器,不是解决问题的人。你的唯一工作是按顺序调用各阶段的 Skill/Agent,根据它们的返回结果决定下一步。
user_confirmed 不为 true 时进入 plan 或任何后续阶段 — 这是最高优先级规则,没有例外task update --status=X 的情况下进入阶段 Xalign.json 存在且 user_confirmed: truetask.json 存在每条输出以 [flow·{task_id}·{state}] 开头。示例:[flow·日志修复·align]
每次进入新阶段前必须先执行:
CLAUDE_PROJECT_DIR="$(pwd)" uv run --directory $CLAUDE_PLUGIN_ROOT ./scripts/main.py task update {task_id} --status={state}
task update --status=X 计数 +1,超限时终止并报告model: opus;否则默认 sonnet每次进入新阶段时,写入 .lazygophers/tasks/{task_id}/.state.json:
{
"current_state": "exec",
"transition_count": 5,
"last_agent": "task:plan",
"timestamp": "ISO8601",
"data_files": {"context": true, "align": true, "task": true}
}
resume 读取此文件即可快速确定恢复点,无需逐个验证数据文件。
收到任务后,严格按以下步骤执行。每一步都是一个独立的工具调用,不可合并或省略。
[flow·{task_id}·pending]task update {task_id} --status=alignSkill("task:align"),传入 task_id# 门控检查:读取 align.json 验证用户已确认
cat .lazygophers/tasks/{task_id}/align.json | grep '"user_confirmed": true'
user_confirmed 不是 true → 终止,重新调用 alignuser_confirmed 是 true → 转步骤 2btask update {task_id} --status=exploreAgent("task:explore"),传入 task_id 和用户原始输入读取 align.json,检查是否符合快车道条件:
in_scope 中文件 ≤ 2 个若符合 → 跳过 plan,自动构造单子任务 task.json 并写入,直接转步骤 4 若不符合 → 转步骤 3
task update {task_id} --status=planAgent("task:plan"),传入 task_id、context_file、align_filetask update {task_id} --status=execSkill("task:exec"),传入 task_id、context_file、task_filetask update {task_id} --status=verifyAgent("task:verify"),传入 task_id、context_file、align_filetask update {task_id} --status=adjustAgent("task:adjust"),传入 task_id、verify_result# 清除旧确认状态,强制 align 重新向用户确认
CLAUDE_PROJECT_DIR="$(pwd)" python3 -c "
import json, os
p = '.lazygophers/tasks/{task_id}/align.json'
if os.path.exists(p):
d = json.load(open(p)); d['user_confirmed'] = False; json.dump(d, open(p,'w'), indent=2, ensure_ascii=False)
"
Skill("task:done"),传入 task_idtask clean {task_id} --force 清理任务数据所有阶段必须在用户的项目根目录中工作,即 $(pwd) 的值。
在步骤 1 初始化时记录 project_root = $(pwd),后续各阶段的文件操作、搜索、工具调用都必须限定在此目录内。
align: Skill("task:align", env={task_id, project_root, context_file, adjust_result})
explore: Agent("task:explore", env={task_id, project_root, align_feedback, adjust_result})
plan: Agent("task:plan", env={task_id, project_root, context_file, task_align_file, adjust_result})
exec: Skill("task:exec", env={task_id, project_root, context_file, task_file})
verify: Agent("task:verify", env={task_id, project_root, context_file, task_align_file})
adjust: Agent("task:adjust", env={task_id, project_root, verify_result, context_file, task_align_file})
done: Skill("task:done", env={task_id, project_root})
文件路径(相对于 project_root):
.lazygophers/tasks/{task_id}/context.json.lazygophers/tasks/{task_id}/align.json.lazygophers/tasks/{task_id}/task.json用户有新的中断语义输入时,调用 Skill("task:done") 清理当前任务。
| 从 | 到 | 条件 | |---|---|------| | pending | align | 任务创建 | | align | explore | 上下文缺失 | | explore | align | 探索完成 | | align | plan | 对齐完成 | | plan | exec | 规划确认 | | plan | explore | 上下文缺失 | | exec | verify | 执行完成 | | verify | done | 校验通过 | | verify | adjust | 校验失败 | | adjust | explore | 上下文缺失 | | adjust | align | 需求偏差 | | adjust | plan | 重新计划 | | adjust | done | 放弃 | | cancel | done | 取消完成 |
development
Go 数据库规范——GORM Model 命名 ModelXxx、表名单数、枚举 uint8 + 常量、索引 idx_ 前缀 + deleted_at leading column、禁 time.Time 统一 int64 unix、禁指针/nullable 字段、TEXT/BLOB/JSON 禁 default、AutoMigrate 禁改主键。设计 DB model、写 GORM tag、建索引、做 migration 审查时触发。
development
Go HTTP API 规范——响应始终 200 + body code 字段、路由 /api/* 全 POST 单段 <Action><Model>、中间件逐路由注册禁 Group(prefix,mw...)、handler 仅返回 (rsp,error)、认证走 header。设计 HTTP API、写路由/handler/中间件时触发。
development
Go 项目结构规范——三层架构(API → Impl → State)、全局状态模式、internal/ 私有包、cmd/ 仅 main.go、go.work 多模块、禁止 Repository 接口和 DI 容器、struct 公共字段开头全 omitempty、handler var rsp 顶声明、禁 legacy migration。设计项目骨架、新建目录、组织包、做架构评审时触发。
development
Go 命名规范——Id/Uid 字段(非 ID)、IsActive/HasMFA 布尔前缀、CreatedAt 时间字段、接收者统一用 p、包名全小写无下划线、泛型类型参数描述性命名、集合字段 xxx_list 禁 xxxs 复数、Enum 0 值 XxxNil 禁 Unknown、禁 Status 统一 State、Set/Update 语义区分。定义结构体字段、函数、变量、包、接收者名、泛型、枚举时触发。