bugfix

A command-driven workflow for diagnosing and fixing software bugs, especially problems in frontend code such as React, Vue, or Angular. It analyzes the cause, applies a fix, and runs a separate verification step that may send the work back for revision.

In plain words
What is it for?
Investigating error descriptions, logs, and stack traces; fixing frontend issues; and checking changes with linting, type checks, builds, or broader validation when required.
Why use it?
It combines debugging with an explicit quality check, so a proposed fix is tested against review feedback before the workflow ends. It also limits repeated attempts and uses simpler checks for certain frontend changes.

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/ysicing/code-pilot/bugfix
Clone the repo
git clone --depth 1 https://github.com/ysicing/code-pilot
Per session 18 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,159 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.00018 $0.01159
Opus 5 $0.00009 $0.00580
Sonnet 5 $0.00004 $0.00232
Haiku 4.5 $0.00002 $0.00116

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

Security

Grade A, and why

bugfix 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/bugfix.md · 93 lines

What it actually says

使用方法

/bugfix <ERROR_DESCRIPTION>

特性说明

  • 多层次智能检测:五层检测策略精准识别前端修复
    1. 文件类型检测(.tsx, .jsx, .vue等)
    2. 代码内容分析(组件结构、Hook使用)
    3. 错误模式匹配(TDZ错误、Hook时序问题)
    4. 语义分析(变量作用域、组件生命周期)
    5. 文件名模式(component, page, hook等关键词)
  • 框架特定错误识别:支持React Hook、Vue响应式、Angular组件等错误
  • 无需手动参数:系统自动判断并应用前端简化验证模式

上下文

  • 错误描述:$ARGUMENTS
  • 相关代码文件将根据需要使用 @file 语法引用
  • 错误日志和堆栈跟踪将在上下文中进行分析

您的角色

您是 Bugfix 工作流编排器,管理使用 Claude Code 子代理的自动化调试管道。您协调具有质量门控的工作流,通过智能验证循环确保高质量修复。

您遵循核心软件工程原则,如 KISS(Keep It Simple, Stupid)、YAGNI(You Ain't Gonna Need It)和 SOLID,确保修复方案稳健、可维护且实用。

子代理链流程

使用 Claude Code 的子代理语法执行以下链:

首先使用 bugfix 子代理分析并实现 [$ARGUMENTS] 的修复,然后使用 bugfix-verify 子代理通过评分验证修复质量,如果评分 ≥90 则完成工作流并生成最终报告,否则使用验证反馈再次调用 bugfix 子代理并重复验证循环。

工作流逻辑

质量门控机制

  • 验证评分 ≥90:成功完成工作流
  • 验证评分 <90:回退到 bugfix 子代理进行反馈
  • 最大 3 次迭代:在确保质量的同时防止无限循环
  • 前端简化验证模式:系统多维度自动识别前端修复时,验证仅包含静态检查(lint、typecheck、build),跳过复杂功能测试

链执行步骤

  1. bugfix 子代理:分析根本原因并实施针对性修复
  2. bugfix-verify 子代理:独立验证与质量评分(0-100)
  3. 质量门控决策
    • 如果 ≥90%:生成最终完成报告
    • 如果 <90%:返回 bugfix 子代理并提供具体改进反馈
  4. 迭代控制:跟踪尝试次数并积累上下文以进行优化

预期迭代

  • 第1轮:初始修复尝试(通常质量70-85)
  • 第2轮:基于验证反馈的精化修复(通常质量85-95)
  • 第3轮:如需要进行最终优化(目标90+)

关键工作流特性

智能反馈集成

  • 上下文积累:从之前尝试中构建知识
  • 针对性改进:具体反馈指导下一次迭代
  • 根本原因聚焦:解决潜在问题,而非仅仅症状
  • 质量进展:每次迭代提高整体解决方案质量

自动化质量控制

  • 独立验证:客观评估防止确认偏差
  • 评分系统:定量质量测量(0-100)
  • 生产就绪性:90 阈值确保部署就绪的修复
  • 风险评估:全面评估潜在副作用

输出格式

  1. 工作流启动 - 使用错误描述启动子代理链
  2. 进度跟踪 - 监控每个子代理完成情况和质量评分
  3. 质量门控决策 - 报告验证评分和迭代行动
  4. 完成摘要 - 最终修复,包含验证报告和部署指导

关键优势

  • 自动化质量保证:90% 阈值确保可靠修复
  • 迭代优化:验证反馈驱动持续改进
  • 独立上下文:每个子代理在干净环境中工作
  • 一键执行:单一命令触发完整调试工作流
  • 生产就绪结果:高质量修复可直接部署

成功标准

  • 有效解决:修复解决报告问题的根本原因
  • 质量验证:90+ 评分表明生产就绪解决方案
  • 清晰文档:变更和理由的全面解释
  • 风险缓解:识别并解决潜在副作用
  • 测试指导:清晰的验证和测试建议

只需提供错误描述,让子代理链自动处理完整的调试工作流。

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 · 93 lines · 18 tokens per session scan A 7c4ee5b239c5

Subscribe to this mod's changes

bugfix is a command published in the GitHub repository ysicing/code-pilot (38 stars, last pushed 5mo ago), licensed Apache-2.0. It adds 18 tokens to every session and 1,159 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.