github-fix-issue

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Fix GitHub Issue

修复GitHub问题

A structured workflow for analyzing, fixing, and submitting a PR for a GitHub issue. This skill uses the GitHub CLI (
gh
) for all GitHub interactions.
这是一套用于分析、修复GitHub问题并提交PR的结构化工作流程。本技能使用GitHub CLI(
gh
)完成所有GitHub交互操作。

Workflow

工作流程

1. Understand the Issue

1. 理解问题内容

  • Run
    gh issue view <number>
    to get full issue details (title, body, labels, comments)
  • Read through the problem description carefully
  • If the issue is unclear or missing key details, ask the user clarifying questions before proceeding
  • 执行
    gh issue view <number>
    获取完整的问题详情(标题、描述、标签、评论)
  • 仔细阅读问题描述
  • 如果问题表述模糊或缺少关键信息,在继续操作前向用户询问澄清问题

2. Research Prior Art

2. 调研已有工作

Before jumping into code, gather context — understanding what's been tried or discussed prevents duplicate work and surfaces useful patterns:
  • Search the codebase for files and functions related to the issue
  • Check if related PRs exist with
    gh pr list --search "<keywords>"
  • Look for scratchpads or notes from previous investigation
  • Read relevant source files to understand the current behavior
在开始编写代码前,先收集相关背景信息——了解已尝试的方案或讨论内容可避免重复工作,同时发现有用的模式:
  • 在代码库中搜索与该问题相关的文件和函数
  • 使用
    gh pr list --search "<keywords>"
    查看是否存在相关PR
  • 查找之前调研留下的草稿或笔记
  • 阅读相关源码以理解当前行为

3. Plan the Fix

3. 规划修复方案

Think through how to break the issue into small, manageable tasks. Document your plan in a scratchpad file:
  • Name the file descriptively (include the issue reference)
  • Include a link back to the issue
  • List the specific changes needed and their order
  • Note any risks or edge cases
思考如何将问题拆解为多个小而可控的任务。在草稿文件中记录你的规划:
  • 为文件起一个描述性名称(包含问题编号)
  • 添加指向该问题的链接
  • 列出需要修改的具体内容及其顺序
  • 记录任何风险或边缘情况

4. Implement

4. 代码实现

  • Create a new branch for the issue (e.g.,
    fix/issue-123-description
    )
  • Work through the plan in small steps
  • Commit after each meaningful change — small commits are easier to review and revert
  • 为该问题创建新分支(例如:
    fix/issue-123-description
  • 按照规划逐步完成任务
  • 每次完成有意义的修改后提交代码——小提交更便于审核和回滚

5. Test

5. 测试验证

Thorough testing prevents the fix from introducing new problems:
  • Write unit tests that describe the expected behavior
  • Run the full test suite to catch regressions
  • If UI changes were made and browser automation (e.g., Puppeteer MCP) is available, use it to verify visually
  • Fix any failing tests before moving on
全面测试可避免修复引入新问题:
  • 编写描述预期行为的单元测试
  • 运行完整测试套件以捕获回归问题
  • 如果涉及UI变更且有浏览器自动化工具(如Puppeteer MCP)可用,使用它进行视觉验证
  • 在进入下一步前修复所有测试失败的问题

6. Open Pull Request

6. 提交Pull Request

  • Push the branch and open a PR with
    gh pr create
  • Reference the issue in the PR description (e.g., "Fixes #123")
  • Request a review
  • 推送分支并使用
    gh pr create
    打开PR
  • 在PR描述中关联该问题(例如:"Fixes #123")
  • 请求代码审核

gh Command Reference

gh命令参考

sh
undefined
sh
undefined

View issue details

View issue details

gh issue view 123
gh issue view 123

Create a branch

Create a branch

git checkout -b fix/issue-123-description
git checkout -b fix/issue-123-description

Open a PR that closes the issue

Open a PR that closes the issue

gh pr create --title "Fix: description" --body "Fixes #123"
gh pr create --title "Fix: description" --body "Fixes #123"

Request review

Request review

gh pr edit 456 --add-reviewer username
undefined
gh pr edit 456 --add-reviewer username
undefined