next-task
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNext Task
下一项任务
Pick the highest-priority unblocked task from TASKS.md and work on it.
从TASKS.md中选取优先级最高且未被阻塞的任务并进行处理。
1. Check workspace
1. 检查工作区
Before anything else, assess the current state:
bash
git status --short
git branch --show-current
git log --oneline -5- Uncommitted changes? — Check if they relate to a claimed task. If yes, finish that work first (skip to step 5). If the changes are unrelated or abandoned, stash them: .
git stash push -m "next-task: stash unrelated changes" - Not on main/master? — You're on a feature branch. Check if it has an open task associated with it (look in TASKS.md for your claim). If yes, finish it first (skip to step 5). If no task is claimed, the branch may be leftover — switch to main after stashing any dirty state.
(@agent-id) - Clean + on main? — Pull latest and proceed to step 2.
bash
git checkout main 2>/dev/null || git checkout master
git pull --rebase在进行任何操作之前,先评估当前状态:
bash
git status --short
git branch --show-current
git log --oneline -5- 存在未提交的变更? — 检查这些变更是否与已认领的任务相关。如果是,先完成该工作(跳至步骤5)。如果变更无关或已放弃,暂存这些变更:。
git stash push -m "next-task: stash unrelated changes" - 不在main/master分支? — 你当前处于功能分支。检查该分支是否关联了未完成的任务(在TASKS.md中查找你的认领标记)。如果是,先完成该任务(跳至步骤5)。如果没有认领任何任务,该分支可能是遗留分支 — 暂存所有未提交状态后切换回main分支。
(@agent-id) - 工作区干净且处于main分支? — 拉取最新代码后继续步骤2。
bash
git checkout main 2>/dev/null || git checkout master
git pull --rebase2. Find the queue
2. 查找任务队列
Start with the current repo — look for TASKS.md at the git root:
bash
git_root=$(git rev-parse --show-toplevel 2>/dev/null || echo ".")
cat "$git_root/TASKS.md" 2>/dev/nullRead this file and proceed to step 3. Only this repo's tasks should be considered for picking.
If the current repo has no TASKS.md or all tasks are blocked/claimed, tell the user and suggest checking other repos:
bash
find ~/apps -maxdepth 3 -name "TASKS.md" -not -path "*/.git/*" -not -path "*/node_modules/*" | sortAsk the user which repo they'd like to pick from before proceeding — never silently switch repos.
先从当前仓库开始 — 在git根目录下查找TASKS.md文件:
bash
git_root=$(git rev-parse --show-toplevel 2>/dev/null || echo ".")
cat "$git_root/TASKS.md" 2>/dev/null读取该文件后继续步骤3。仅需考虑当前仓库的任务。
如果当前仓库没有TASKS.md,或所有任务均被阻塞/已认领,告知用户并建议检查其他仓库:
bash
find ~/apps -maxdepth 3 -name "TASKS.md" -not -path "*/.git/*" -not -path "*/node_modules/*" | sort在继续操作前询问用户想要从哪个仓库选取任务 — 切勿擅自切换仓库。
3. Finish unfinished work
3. 完成未结束的工作
Scan TASKS.md for any task you previously claimed — look for your on any task line.
(@agent-id)If you find a claimed task:
- Read its details and check what state it's in
- Check and
git logfor related workgit stash list - If the work is done but not committed/removed — go to step 6 to complete it
- If the work is partially done — resume it at step 5
- If the claim is stale and no related work exists — unclaim it (remove your ) and continue to step 4
(@agent-id)
If no claimed task exists, proceed to step 4.
扫描TASKS.md,查找你之前认领过的任务 — 在任务行中查找你的标记。
(@agent-id)如果找到已认领的任务:
- 读取任务详情并检查其当前状态
- 查看和
git log以获取相关工作记录git stash list - 如果工作已完成但未提交/移除 — 跳转至步骤6完成收尾
- 如果工作尚未完成 — 从步骤5继续推进
- 如果认领标记已失效且无相关工作记录 — 取消认领(移除你的)并继续步骤4
(@agent-id)
如果没有已认领的任务,继续步骤4。
4. Pick a task
4. 挑选任务
Walk the priority sections in order: P0 → P1 → P2 → P3. For each priority level, evaluate the tasks and select one.
按优先级顺序遍历任务:P0(关键)→ P1(高)→ P2(中)→ P3(低)。在每个优先级层级中,评估任务并选择一个。
Priority decision guidelines
优先级决策准则
- P0 (critical) — Always pick these first. They're blocking the project.
- P1 (high) — Pick these next. Important work that should be done soon.
- P2 (medium) — Standard work. Pick from here when P0 and P1 are empty or all blocked.
- P3 (low) — Nice-to-haves. Only pick these when nothing higher is available.
- P0(关键) — 始终优先挑选此类任务,它们会阻塞项目推进。
- P1(高) — 接下来挑选此类任务,是需要尽快完成的重要工作。
- P2(中) — 标准工作任务,当P0和P1任务为空或全部被阻塞时,从此类任务中挑选。
- P3(低) — 锦上添花的任务,仅当更高优先级的任务均不可用时才挑选。
Within a priority level, select by:
同一优先级内的选择顺序:
- Unblocking impact — prefer tasks whose ID appears in another task's Blocked by field (completing it unblocks other work)
- Unblocked status — skip tasks where Blocked by references an ID that still exists in any TASKS.md
- Unclaimed — skip tasks with — they're claimed by another agent
(@agent-name) - Tag match — if the task has Tags, check whether they match your capabilities (e.g., skip tags if you're working in a backend-only repo)
frontend - First available — among equally qualified tasks, pick the first one in the list
If all tasks at every priority level are blocked, claimed, or unmatched — tell the user. Suggest unblocking actions if possible (e.g., "Task X blocks 3 others — should I work on its blocker instead?").
- 解锁影响 — 优先选择其ID出现在其他任务的Blocked by字段中的任务(完成它可解锁其他工作)
- 未被阻塞状态 — 跳过那些Blocked by引用的ID仍存在于TASKS.md中的任务
- 未被认领 — 跳过带有标记的任务,它们已被其他agent认领
(@agent-name) - 标签匹配 — 如果任务带有Tags,检查是否与你的能力匹配(例如,如果你在后端专属仓库工作,跳过带有标签的任务)
frontend - 首个可用任务 — 在符合条件的任务中,挑选列表中的第一个
如果所有优先级的任务均被阻塞、已认领或不匹配你的能力 — 告知用户。如有可能,建议解锁操作(例如:“任务X阻塞了3个其他任务 — 是否需要我先处理其阻塞项?”)。
5. Claim and do the work
5. 认领并开展工作
MCP shortcut: Ifis available, use itstasks-mcptool instead of manually editing the file.claim_task
Append your identity to the task line. Use the format (e.g., ):
@<tool>-<instance>@claude-code, @claude-code-2markdown
- [ ] The task description (@your-agent-id)Create a feature branch for the work:
bash
git checkout -b <branch-name>Then do the work:
- Read the task's Details, Files, and Acceptance metadata
- Check AGENTS.md for the project's build, test, and lint commands
- Make minimal, focused edits
- Run verification commands (test/lint/typecheck) after changes
- Fix any issues before proceeding
MCP快捷方式: 如果可用,使用其tasks-mcp工具代替手动编辑文件。claim_task
在任务行后追加你的身份标识,格式为(例如:):
@<tool>-<instance>@claude-code, @claude-code-2markdown
- [ ] 任务描述 (@your-agent-id)创建用于该工作的功能分支:
bash
git checkout -b <branch-name>然后开展工作:
- 阅读任务的Details、Files和Acceptance元数据
- 查看AGENTS.md获取项目的构建、测试和代码检查命令
- 进行最小化、针对性的编辑
- 变更后运行验证命令(测试/代码检查/类型检查)
- 继续推进前修复所有问题
6. Complete the task
6. 完成任务
MCP shortcut: Ifis available, use itstasks-mcptool instead of manually editing the file — it handles block removal and empty section cleanup automatically.complete_task
Remove the entire task block from TASKS.md — the task line, all metadata, and any sub-tasks. Completed task history lives in git log.
Commit everything together:
bash
git add <changed-files> TASKS.md
git commit -m "<conventional commit for the actual work>"
git pull --rebase
git pushIf conflicts on TASKS.md, re-read the file, re-apply your task removal, then . TASKS.md conflicts are usually trivial — another agent claimed or removed a different task.
git pull --rebasegit add TASKS.md && git rebase --continueMCP快捷方式: 如果可用,使用其tasks-mcp工具代替手动编辑文件 — 它会自动处理阻塞项移除和空章节清理。complete_task
从TASKS.md中移除整个任务块 — 包括任务行、所有元数据以及任何子任务。已完成任务的历史记录保存在git日志中。
提交所有变更:
bash
git add <changed-files> TASKS.md
git commit -m "<符合约定的工作提交信息>"
git pull --rebase
git push如果在TASKS.md上发生冲突,重新读取文件,重新应用任务移除操作,然后执行。TASKS.md的冲突通常很容易解决 — 一般是其他agent认领或移除了另一个任务。
git pull --rebasegit add TASKS.md && git rebase --continue7. Loop
7. 循环
Switch back to main and pull latest:
bash
git checkout main 2>/dev/null || git checkout master
git pull --rebaseRead TASKS.md again and pick the next task (go to step 2). Continue until the queue is empty or the user stops you.
切换回main分支并拉取最新代码:
bash
git checkout main 2>/dev/null || git checkout master
git pull --rebase再次读取TASKS.md并挑选下一个任务(返回步骤2)。持续循环直到任务队列为空或用户停止操作。