bug-fix

An automated workflow for investigating, fixing, testing, and reporting software bugs. You provide a bug description and, optionally, logs, severity, or a related issue number.

In plain words
What is it for?
Use it to investigate errors, identify likely causes, propose a solution, apply a test-driven fix, run acceptance tests, and report progress.
Why use it?
It organizes the investigation and repair process so you do not have to track each step manually or lose context between diagnosis, implementation, and testing.

Command for Claude Code

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/kewton/commandmate/bug-fix
Clone the repo
git clone --depth 1 https://github.com/Kewton/CommandMate

Made for: Claude Code.

Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,079 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.00021 $0.02079
Opus 5 $0.00010 $0.01040
Sonnet 5 $0.00004 $0.00416
Haiku 4.5 $0.00002 $0.00208

Measured yesterday against content hash 3de334afce07, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

bug-fix 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 yesterday.

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.

.claude/commands/bug-fix.md · 273 lines

How it starts

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

PMバグ修正スキル

概要

不具合(バグ、エラー、予期しない動作)の調査から修正、テスト、報告まで完全自動化するプロジェクトマネージャースキルです。ユーザーは不具合の概要を伝えるだけで、原因調査→対策案提示→修正実施を自律的に実行します。

アーキテクチャ: サブエージェント方式を採用し、各フェーズを専門エージェントに委譲します。

使用方法

  • /bug-fix [不具合の概要]
  • /bug-fix "APIエラーが発生"
  • 「一覧ページでエラーが表示される問題を調査してください」

実行内容

あなたはプロジェクトマネージャーとして、不具合対応を統括します。各フェーズは専門サブエージェントに委譲し、結果ファイルを確認しながら修正完了まで導いてください。

パラメータ

  • bug_description: 不具合の概要(必須)
  • error_logs: エラーログファイルパス(任意)
  • severity: 重大度(critical/high/medium/low、デフォルト: high)
  • related_issue: 関連Issue番号(任意)

実行フェーズ

Phase 0: 初期設定とTodoリスト作成

まず、TodoWriteツールで作業計画を作成してください:

- [ ] Phase 1: 不具合調査
- [ ] Phase 2: 対策案提示・ユーザーフィードバック
- [ ] Phase 3: 作業計画立案
- [ ] Phase 4: TDD修正実施
- [ ] Phase 5: 受入テスト
- [ ] Phase 6: 進捗報告

Phase 1: 不具合調査

1-1. 不具合情報の収集

ユーザーから以下の情報を収集(不足している場合は質問):

## 不具合情報
- **概要**: [ユーザー入力]
- **エラーメッセージ**: [あれば]
- **再現手順**: [あれば]
- **影響範囲**: [全ユーザー / 特定条件のユーザー]
- **環境情報**: [ブラウザ, OS, Node.js バージョン]
1-2. ディレクトリ構造作成
BUG_ID=$(date +%Y%m%d_%H%M%S)
BASE_DIR="dev-reports/bug-fix/${BUG_ID}"
mkdir -p "$BASE_DIR"
1-3. 調査コンテキストファイル作成

ファイルパス: dev-reports/bug-fix/{bug_id}/investigation-context.json

{
  "issue_description": "不具合の概要",
  "error_logs": ["エラーログ1"],
  "affected_files": ["src/lib/xxx.ts"],
  "reproduction_steps": ["1. xxx", "2. yyy"],
  "environment": {
    "os": "macOS",
    "node_version": "18.x",
    "browser": "Chrome"
  },
  "severity_hint": "high"
}
1-4. 調査サブエージェント呼び出し
Use investigation-agent to investigate the bug.

Context file: dev-reports/bug-fix/{bug_id}/investigation-context.json
Output file: dev-reports/bug-fix/{bug_id}/investigation-result.json

Phase 2: 対策案提示・ユーザーフィードバック

調査結果から対策案をユーザーに提示:

## 調査結果サマリー

**根本原因**: [原因の説明]
**影響範囲**: [影響範囲]
**重大度**: high

---

## 対策案(優先度順)

### 対策案1: [タイトル] [優先度: High]
- **内容**: [説明]
- **影響ファイル**: [ファイル一覧]

### 対策案2: [タイトル] [優先度: Medium]
- **内容**: [説明]
- **影響ファイル**: [ファイル一覧]

---

## どの対策案を実施しますか?

1. **対策案1のみ実施**
2. **対策案1+2を実施**
3. **カスタム対応**

Read the full file on GitHub · 273 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. yesterday First seen · 273 lines · 21 tokens per session scan A 3de334afce07

Subscribe to this mod's changes

bug-fix is a command published in the GitHub repository Kewton/CommandMate (39 stars, last pushed yesterday), licensed MIT. It adds 21 tokens to every session and 2,079 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.