fix-issue

A command that takes a GitHub Issue—a tracked bug, request, or question—and guides its fix from investigation through testing and submission. TDD means writing a failing test first, then changing the code until the test passes.

In plain words
What is it for?
Use it to fix one or several GitHub Issues, reproduce bugs with tests, verify builds and tests, create commits, and optionally close the issues.
Why use it?
It keeps the issue, code changes, tests, verification, and optional issue closing in one workflow. It also checks that existing work is not accidentally overwritten.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/xiaobei930/cc-best/fix-issue
Clone the repo
git clone --depth 1 https://github.com/xiaobei930/cc-best
Per session 23 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,023 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00023 $0.01023
Opus 5 $0.00012 $0.00511
Sonnet 5 $0.00005 $0.00205
Haiku 4.5 $0.00002 $0.00102

Measured 2d ago against content hash 69b7a23d227d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

fix-issue scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/fix-issue.md · 115 lines

How it starts

The opening of the file, as written. The whole thing — 115 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/fix-issue - Issue 修复闭环

从 GitHub Issue 出发,端到端完成修复闭环。核心能力是自动化 Issue 分析→代码修复→测试验证→提交→关闭的完整流程。

Agent 集成:

  • 代码定位使用 exploration 技能(Explore Agent)
  • 修复实现调用 tdd-guide Agent 确保测试覆盖
  • 提交前调用 /cc-best:verify 综合验证

使用方式

# 修复指定 Issue
/cc-best:fix-issue #123

# 修复 Issue 并跳过关闭(仅提交代码)
/cc-best:fix-issue #123 --no-close

# 批量修复多个 Issue
/cc-best:fix-issue #123 #124 #125

执行流程

第 0 步:守卫检查

  • 确认 gh CLI 已安装且已认证
  • 确认当前 git status 干净(无未提交变更)
  • 确认 Issue 存在且状态为 Open

第 1 步:读取 Issue

gh issue view <NUMBER> --json title,body,labels,assignees,comments
  • 提取 Issue 标题、描述、标签
  • 分析 Issue 类型:bug / feature / enhancement / question
  • 读取评论中的补充信息

第 2 步:分析与定位

  • 根据 Issue 描述使用 exploration 技能定位相关代码
  • 建立 TodoWrite 任务清单,列出需要修改的文件
  • 如果 Issue 涉及多个模块,按依赖关系排序

第 3 步:实施修复

  • Bug 类型: 先编写失败测试(复现问题)→ 修复代码 → 测试通过
  • Feature 类型: 按 TDD 流程实现(调用 tdd-guide Agent)
  • Enhancement 类型: 修改现有代码,确保不破坏已有测试

关键原则: 最小化修改范围,不做超出 Issue 描述的额外变更

第 4 步:验证

调用 /cc-best:verify 执行综合验证:

  • 构建检查(无编译错误)
  • 类型检查(无类型错误)
  • Lint 检查(无规范违规)
  • 测试运行(全部通过)

第 5 步:提交

调用 /cc-best:commit 生成规范的提交信息:

  • 提交信息格式: fix: <简要描述> (#<ISSUE_NUMBER>)
  • Feature 类型使用 feat: 前缀
  • 关联 Issue: 提交信息中包含 Closes #<NUMBER>

第 6 步:关闭 Issue

gh issue close <NUMBER> --comment "修复已提交: <commit-sha>\n\n变更摘要:\n- <变更列表>"
  • 在 Issue 中评论修复摘要
  • 列出修改的文件和关键变更
  • 如果使用 --no-close,仅评论不关闭

错误处理

场景 处理方式
Issue 不存在 报错退出,提示检查 Issue 编号
gh 未认证 提示执行 gh auth login
测试失败 继续修复,不跳过测试
构建失败 调用 build-error-resolver Agent 分析
修改范围过大 提醒用户拆分 Issue

与其他命令的关系

命令 关系
/cc-best:verify 第 4 步调用,综合验证
/cc-best:commit 第 5 步调用,规范提交
/cc-best:dev 类似但更通用,fix-issue 专注 Issue 闭环
/cc-best:iterate 可在 iterate 模式中自动调用 fix-issue

Read the full file on GitHub · 115 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 115 lines · 23 tokens per session scan A 69b7a23d227d

Subscribe to this mod's changes

fix-issue is a command published in the GitHub repository xiaobei930/cc-best (50 stars, last pushed 2mo ago), licensed MIT. It adds 23 tokens to every session and 1,023 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.