agentleFS
midFangmidFang/ai-agent-skills-workflow/bugfix-done/SKILL.md

bugfix-done

Skill2 starsChanged 5 months agoMITView on GitHub

在用户确认某个 bug 的待验证 APK 或安装包已人工验证通过后,更新 issues CSV/TASK,合并该 bug 分支到用户明确指定的目标分支;合并成功后自动构建目标分支 APK 并安装到手机等待用户做合并后验证;用户确认合并后集成验证通过时删除对应 worktree。适用于用户说“BUG-xxx 验证通过,合并到 main/develop/release”、或“BUG-xxx 合并后验证通过,可以清理 worktree”。如果用户没有说明目标分支,必须先询问。

  • Deletes or force-pushes

The file

Files
SKILL.md

Bugfix Done

目的

处理 bug 修复流程的后半段:

用户人工验证通过
-> 标记 human_verified
-> 合并到用户指定目标分支
-> 标记 merged
-> 构建并安装目标分支 APK
-> 等用户做合并后/目标分支验证
-> 标记 integration_verified
-> 删除 worktree
-> 标记 worktree_removed

这个 skill 不负责修 bug,不负责构建首次待验证 APK,不负责首次安装。那些由 $bugfix-worktree 完成。本 skill 负责合并成功后的目标分支 APK 构建和安装,供用户做合并后验证。

输入

需要:

  • bug_id,例如 BUG-001
  • issues CSV 路径,或能从业务项目 issues/<版本>/bug_batch.csv 唯一定位
  • 目标分支,仅在“合并”阶段必须提供,例如 main、develop、release/x.y

如果用户说“验证通过,合并”,但没有说目标分支,必须先问:

要把 BUG-xxx 合并到哪个目标分支?

不要猜目标分支。

阶段 A:人工验证通过并合并

触发示例:

$bugfix-done BUG-001 验证通过,合并到 main

步骤:

  1. 读取 issues CSV 中的 bug 行。
  2. 确认 worktree_path、branch、commit、task_file 存在。
  3. 更新 CSV:
    • 状态=human_verified
    • human_verify_result=pass
    • human_verify_note 记录用户确认和时间
  4. 更新 issues/<版本>/tasks/<bug_id>-TASK.md 的“用户人工验证”小节。
  5. 合并前检查:
    • bug worktree 没有未提交改动
    • 目标分支由用户明确给出
    • 执行合并的仓库不能有业务代码/配置类未提交改动
    • issues/**/*.md、issues/**/*.csv、features/**/*.md、features/**/*.csv、features/**/*.json 这类流程文件允许存在改动,不应阻止合并
    • 如果主仓库因为目标分支已 checkout、工作区限制或其它原因不适合直接合并,可以创建干净的临时集成 worktree 来执行合并
  6. 切到目标分支。
  7. 默认执行非 fast-forward merge:
    • merge commit message 使用:Merge <bug_id> fix: <中文问题描述或修复内容>
    • 中文描述优先取 CSV 的 人工确认描述,其次取 标题 或 问题描述,过长时压缩成一句话。
    • 示例:git merge --no-ff -m "Merge BUG-013 fix: 等待接收设备同意超时只显示一个提示弹窗" <bug-branch>
  8. 合并成功后更新 CSV:
    • 状态=merged
    • target_branch
    • 备注 记录 merge commit
  9. 更新 TASK,记录目标分支、merge commit、合并结果。
  10. 在目标分支构建合并后的 APK:
  • 优先使用项目已有 Android 构建命令,例如 ./gradlew :app:assembleDebug 或 ./gradlew assembleDebug
  • 将生成的 APK 复制到 issues/<版本>/apks/<bug_id>-merged.apk
  1. 安装合并后的 APK:
  • 运行 adb devices
  • 如果有多个设备,询问用户选择 serial
  • 执行 adb install -r issues/<版本>/apks/<bug_id>-merged.apk
  • 可做基础 smoke test,例如启动应用、观察进程、查看 logcat 是否有明显崩溃
  1. 更新 CSV/TASK:
  • 备注 记录合并后 APK 路径、安装设备、安装结果和 smoke test 摘要
  • TASK 记录“合并后验证待确认”
  1. 合并后不要删除 worktree。提示用户在目标分支/集成包上再次验证。

如果合并后构建或安装失败:

  • 不要删除 worktree。
  • 不要回滚已经成功的 merge,除非用户明确要求。
  • 保持 状态=merged 或设置 状态=blocked,根据失败是否阻断用户验证判断。
  • blocked_reason=integration_failed 或更具体的 build_failed / device_unavailable。
  • 在 TASK 记录失败命令、错误摘要和下一步。

如果合并冲突:

  • 不要删除 worktree。
  • 设置 状态=blocked。
  • blocked_reason=merge_conflict。
  • 在 TASK 记录冲突文件和下一步。

阶段 B:合并后验证通过并清理

触发示例:

$bugfix-done BUG-001 合并后验证通过,可以清理 worktree

步骤:

  1. 读取 issues CSV 中的 bug 行。
  2. 确认当前状态是 merged,或用户明确说明已经完成目标分支验证。
  3. 更新 CSV:
    • 状态=integration_verified
    • 备注 记录用户合并后验证确认和时间
  4. 更新 TASK 的“用户人工验证”或“合并后验证”记录。
  5. 检查 worktree:
    • worktree_path 存在
    • 没有未提交改动
  6. 删除 worktree:
    • git worktree remove <worktree_path>
  7. 默认尝试安全删除 bug 分支:
    • git branch -d <bug-branch>
    • 如果删除失败,不要强删;记录原因。
  8. 更新 CSV:
    • 状态=worktree_removed
    • 备注 写入 worktree 删除和分支清理结果
  9. 更新 TASK,记录清理结果。

安全规则

  • 没有目标分支,不合并,先问用户。
  • 未经用户确认人工验证通过,不合并,除非用户明确 override。
  • 合并成功后应自动构建并安装目标分支 APK,等待用户做合并后验证。
  • 合并后未经用户确认目标分支验证通过,不删除 worktree。
  • 执行合并的仓库允许存在 issues/**/*.md、issues/**/*.csv、features/**/*.md、features/**/*.csv、features/**/*.json 流程文件改动;其它未提交改动会阻止合并。
  • 删除 bug worktree 前,该 bug worktree 自身必须没有未提交改动。
  • 不使用 git branch -D、git reset --hard 等破坏性命令,除非用户明确要求。

完成回复

简短报告:

  • bug_id
  • 当前状态
  • 目标分支和 merge commit,如有
  • worktree 是否已删除
  • bug 分支是否已安全删除
  • TASK 和 CSV 路径

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.