executar-bugfix
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBug Fix Execution
缺陷修复执行
Procedures
执行流程
Step 1: Context Analysis (Mandatory)
- Read the bugs file at and extract ALL documented bugs.
./tasks/prd-[feature-slug]/bugs.md - Read the PRD at to understand affected requirements.
./tasks/prd-[feature-slug]/prd.md - Read the Tech Spec at to understand relevant technical decisions.
./tasks/prd-[feature-slug]/techspec.md - Review project rules for compliance in fixes.
- Do NOT skip this step — full context understanding is fundamental for quality fixes.
Step 2: Plan Fixes (Mandatory)
- For each bug, generate a planning summary:
- Bug ID, Severity (High/Medium/Low), Affected Component.
- Root Cause analysis.
- Files to modify.
- Fix strategy description.
- Planned regression tests (unit, integration, E2E).
- Use Context7 MCP to analyze documentation of involved languages, frameworks, and libraries.
Step 3: Implement Fixes (Mandatory)
- Fix bugs in severity order: High first, then Medium, then Low.
- For each bug follow this sequence:
a. Locate and read the affected code.
b. Reason about the flow causing the bug.
c. Implement the root-cause fix — no superficial workarounds.
d. Run after each fix. e. Run existing tests to ensure no regressions.
bun run typecheck
Step 4: Create Regression Tests (Mandatory)
- For each fixed bug, create tests that:
- Simulate the original bug scenario (test must fail if the fix is reverted).
- Validate the correct behavior with the fix applied.
- Cover related edge cases.
- Choose test type based on bug nature:
- Unit test: Bug in isolated function/method logic.
- Integration test: Bug in module communication (e.g., controller + service).
- E2E test: Bug visible in the UI or full flow.
Step 5: Visual Validation with Playwright MCP (Mandatory for frontend bugs)
- For bugs affecting the UI:
a. Use to access the application. b. Use
browser_navigateto verify page state. c. Reproduce the flow that caused the bug. d. Usebrowser_snapshotto capture evidence of the fix.browser_take_screenshot
Step 6: Final Test Execution (Mandatory)
- Run ALL project tests: .
bun run test - Verify ALL pass with 100% success.
- Run type checking: .
bun run typecheck - The task is NOT complete if any test fails.
Step 7: Update bugs.md (Mandatory)
- For each fixed bug, append to its entry:
- Status: Fixed.
- Applied fix: Brief description.
- Regression tests: List of created tests.
Step 8: Generate Final Report
- Read the report template at .
assets/bugfix-report-template.md - Fill in all sections with actual results.
步骤1:上下文分析(必做)
- 读取位于的缺陷文件,提取所有已记录的缺陷。
./tasks/prd-[feature-slug]/bugs.md - 读取位于的PRD文档,了解受影响的需求。
./tasks/prd-[feature-slug]/prd.md - 读取位于的技术规格文档,明确相关技术决策。
./tasks/prd-[feature-slug]/techspec.md - 查阅项目规则,确保修复方案符合规范要求。
- 请勿跳过此步骤——完整的上下文理解是高质量修复的基础。
步骤2:制定修复计划(必做)
- 为每个缺陷生成计划摘要,包含以下内容:
- 缺陷ID、严重程度(高/中/低)、受影响组件
- 根本原因分析
- 待修改文件
- 修复策略说明
- 计划补充的回归测试(单元测试、集成测试、E2E测试)
- 使用Context7 MCP分析涉及的编程语言、框架和库的相关文档。
步骤3:执行修复(必做)
- 按严重程度顺序修复缺陷:优先修复高优先级,其次中优先级,最后低优先级。
- 每个缺陷的修复遵循以下流程:
a. 定位并读取受影响的代码
b. 梳理导致缺陷的执行流程
c. 从根本原因层面实现修复,禁止使用表面的临时绕过方案
d. 每次修复后执行e. 运行现有测试,确保没有引入回归问题
bun run typecheck
步骤4:编写回归测试(必做)
- 为每个已修复的缺陷编写测试用例,满足以下要求:
- 模拟原始缺陷场景(如果回滚修复,该测试必须失败)
- 验证修复应用后功能行为正确
- 覆盖相关边界场景
- 根据缺陷类型选择测试类型:
- 单元测试:孤立函数/方法逻辑存在的缺陷
- 集成测试:模块通信层面的缺陷(例如控制器 + 服务层)
- E2E测试:UI层面或全流程可见的缺陷
步骤5:使用Playwright MCP进行视觉验证(前端缺陷必做)
- 针对影响UI的缺陷:
a. 使用访问应用 b. 使用
browser_navigate验证页面状态 c. 复现导致缺陷的操作流程 d. 使用browser_snapshot捕获修复生效的证据browser_take_screenshot
步骤6:执行最终测试(必做)
- 运行项目所有测试:
bun run test - 验证所有测试100%通过
- 执行类型检查:
bun run typecheck - 如有任何测试失败,视为任务未完成
步骤7:更新bugs.md(必做)
- 为每个已修复的缺陷在其条目后追加以下内容:
- 状态: 已修复
- 应用的修复方案: 简要说明
- 回归测试: 新增的测试用例列表
步骤8:生成最终报告
- 读取位于的报告模板
assets/bugfix-report-template.md - 使用实际结果填充所有章节
Error Handling
错误处理
- If bugs.md does not exist, halt and report to the user.
- If a bug requires significant architectural changes, document the justification before proceeding.
- If new bugs are discovered during fixes, document them in bugs.md.
- Begin implementation immediately after planning — do not wait for approval.
- 如果bugs.md不存在,停止执行并向用户反馈
- 如果某个缺陷需要大幅修改架构,先记录修改理由再继续执行
- 修复过程中发现新缺陷时,将其记录到bugs.md中
- 计划制定完成后立即开始执行,无需等待审批