bug-fix-brief
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBug Fix Brief (BFB)
Bug Fix Brief (BFB)
Overview
概述
This skill generates a Bug Fix Brief (BFB): a structured document in that uniformly captures every bug fix with root cause, repro steps, fix options, and checklist.
docs/bfb/本技能可生成Bug Fix Brief(BFB):一种存储在目录下的结构化文档,用于统一记录每一项Bug修复的根本原因、复现步骤、修复方案选项及检查清单。
docs/bfb/When to Use
使用场景
- User asks to create a BFB
- User wants to document a bug fix in a structured way
- After identifying the root cause of a bug and before implementing the fix
Trigger: "create BFB", "document bug", "bug fix brief", "document fix"
- 用户要求创建BFB
- 用户希望以结构化方式记录Bug修复过程
- 确定Bug根本原因后、实施修复之前
触发词: "create BFB", "document bug", "bug fix brief", "document fix"
Instructions
操作步骤
Phase 1: Gather Information
阶段1:收集信息
Check existing numbering:
bash
ls docs/bfb/ 2>/dev/null || echo "Directory does not exist"Ask the user for:
- BFB number (or propose next sequential)
- Concise title (3-5 words, kebab-case)
- Issue link (e.g. #1287)
- Environment (Prod/Stg/Dev) + version
- Observed vs expected behavior
- File/function/line of the cause
检查现有编号:
bash
ls docs/bfb/ 2>/dev/null || echo "Directory does not exist"向用户询问以下信息:
- BFB编号(或建议下一个连续编号)
- 简洁标题(3-5个单词,采用kebab-case格式)
- 问题链接(例如 #1287)
- 环境(生产/预发布/开发)+ 版本号
- 实际表现与预期表现
- 问题根源所在的文件/函数/行号
Phase 2: Generate Template
阶段2:生成模板
Complete the full BFB template:
markdown
undefined完成完整的BFB模板:
markdown
undefinedBFB-XXX: [Title]
BFB-XXX: [Title]
Reference: [Issue link]
Environment: [Env]
Date: YYYY-MM-DD
vX.Y.Z参考链接: [Issue link]
环境: [Env]
日期: YYYY-MM-DD
vX.Y.Z1. Bug
1. Bug详情
- Observed: [wrong behavior]
- Expected: [correct behavior]
- 实际表现: [错误行为描述]
- 预期表现: [正确行为描述]
2. Repro
2. 复现步骤
1. ...
2. ...
→ [error/output]1. ...
2. ...
→ [错误信息/输出结果]3. Cause
3. 根本原因
path/file.extfunction()path/file.extfunction()4. Decision
4. 修复决策
| Option | Fix | Choice |
|---|---|---|
| A | [desc] | ✅/❌ |
| B | [desc] | ✅/❌ |
Rationale: [why]
| 选项 | 修复方案 | 选择 |
|---|---|---|
| A | [描述] | ✅/❌ |
| B | [描述] | ✅/❌ |
决策理由: [选择原因]
5. Fix
5. 修复检查清单
- [change 1]
- [test]
- [verify repro]
- [修改内容1]
- [测试项]
- [验证复现步骤]
6. Notes
6. 备注
[recurring patterns, links, warnings]
undefined[重复出现的模式、相关链接、注意事项]
undefinedPhase 3: Ask Confirmation
阶段3:请求确认
Show the generated BFB and ask with AskUserQuestion:
- "Create the BFB"
- "Edit before creating"
- "Cancel"
展示生成的BFB内容,并通过AskUserQuestion询问用户:
- "创建该BFB"
- "编辑后再创建"
- "取消"
Phase 4: Write to Disk
阶段4:写入磁盘
Only after approval:
bash
mkdir -p docs/bfbWrite to
docs/bfb/BFB-XXX-title.md仅在获得用户批准后执行:
bash
mkdir -p docs/bfb将内容写入文件
docs/bfb/BFB-XXX-title.mdExamples
示例
Input: "create BFB for login email null crash"
Final output:
markdown
undefined输入: "create BFB for login email null crash"
最终输出:
markdown
undefinedBFB-042: Login crash with null email
BFB-042: Login crash with null email
Reference: #1287
Environment: Prod
Date: 2026-05-02
v2.4.1参考链接: #1287
环境: Prod
日期: 2026-05-02
v2.4.11. Bug
1. Bug详情
- Observed: App crashes if email field is empty
- Expected: Error message "Email required"
- 实际表现: 若邮箱字段为空,应用程序崩溃
- 预期表现: 显示错误提示"Email required"
2. Repro
2. 复现步骤
1. Open login screen
2. Tap "Login" without entering email
→ NullPointerException @ AuthManager.kt:341. 打开登录界面
2. 未输入邮箱即点击"Login"
→ NullPointerException @ AuthManager.kt:343. Cause
3. 根本原因
AuthManager.ktvalidateEmail()AuthManager.ktvalidateEmail()4. Decision
4. 修复决策
| Option | Fix | Choice |
|---|---|---|
| A | Add safe call | ✅ |
| B | Refactor with Result type | ❌ |
Rationale: Option A is minimal, zero impact.
| 选项 | 修复方案 | 选择 |
|---|---|---|
| A | 添加安全调用 | ✅ |
| B | 使用Result类型重构 | ❌ |
决策理由: 选项A改动最小,无其他影响。
5. Fix
5. 修复检查清单
- Add
email?.trim()?.isNotEmpty() == true - Test
validateEmail_null_returnsFalse() - Verify repro
- 添加
email?.trim()?.isNotEmpty() == true - 测试
validateEmail_null_returnsFalse() - 验证复现步骤
6. Notes
6. 备注
- Check other forms for missing null checks
undefined- 检查其他表单是否存在缺失的空值检查
undefinedBest Practices
最佳实践
- Sequential numbering: BFB-001, BFB-002, no gaps
- Concise title: 3-5 words, kebab-case in filename
- Root cause: exact file, function, line
- 2+ fix options: with pros/cons and rationale
- Verifiable checklist: each item must be testable
- 连续编号:BFB-001、BFB-002,无间隔
- 简洁标题:3-5个单词,文件名采用kebab-case格式
- 根本原因:精确到文件、函数、行号
- 至少2种修复选项:包含优缺点及决策理由
- 可验证的检查清单:每一项都必须可测试
Constraints and Warnings
约束与注意事项
- Confirmation required: Always ask before writing
- Max 3 lines for cause: Stay concise
- Directory : Create if it does not exist
docs/bfb/
- 需确认:写入前必须询问用户
- 根本原因最多3行:保持简洁
- 目录:若不存在则创建
docs/bfb/