CommandMate: Command for Claude Code

.claude/commands/bug-fix.md

bug-fix is a command for Claude Code from Kewton/CommandMate. It costs 21 tokens per session (3,187 once invoked), scanned A, original, MIT.

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

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; names the TodoWrite tool; mentions Codex.

This is Kewton/CommandMate's own configuration. It tells Claude Code how to work on CommandMate itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything CommandMate configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Kewton/CommandMate. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Kewton/CommandMate/main/.claude/commands/bug-fix.md
Clone the repo
git clone --depth 1 https://github.com/Kewton/CommandMate

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for bug-fix

README.md
[![agentmods](https://agentmods.dev/badge/commands/kewton/commandmate/bug-fix/github.svg)](https://agentmods.dev/commands/kewton/commandmate/bug-fix)
Your own site
<a href="https://agentmods.dev/commands/kewton/commandmate/bug-fix"><img src="https://agentmods.dev/badge/commands/kewton/commandmate/bug-fix/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for bug-fix

Your own site · 80×15
<a href="https://agentmods.dev/commands/kewton/commandmate/bug-fix"><img src="https://agentmods.dev/badge/commands/kewton/commandmate/bug-fix.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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 3,187 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00021 $0.03187
Opus 5.5 $0.00008 $0.01275
Sonnet 5.5 $0.00004 $0.00637
Haiku 4.5 $0.00002 $0.00319

Measured 21d ago against content hash da615969950b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 21d 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.

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

How it starts

The opening of the file, as written. The whole thing — 317 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-1b. bug Issue として起票するとき

不具合を bug Issue として起票するとき(gh issue create --label bug --body … でテンプレートを通らないときも)、本文の末尾に次の「分類」節を置く。 値は決まった語から選ぶ(.github/ISSUE_TEMPLATE/bug_report.md と同じ語。日次メトリクスの bug-flow がこの節を数える)。

## 分類
- 原因の PR: #<番号> / 不明 / なし(以前から)/ 上流(<CLI> <版>)
- 発見経路: uat / review / orchestrate / daily-use / automated
- 影響する経路: chat / terminal / cli / mobile / auto-yes / push / なし(内部)
  • 各行は 1 つを選んで書き換える(例: - 原因の PR: #3191、- 原因の PR: 上流(codex 0.50.0)、- 発見経路: uat)。 影響する経路だけは複数を , で区切って書ける(例: - 影響する経路: chat, mobile)。選択肢を残したままの行は「未記入」に数えられる
  • 影響する経路は取りこぼしを防ぐ欄。直す人は、挙げた経路すべてを確かめる
  • 影響する経路が なし(内部)(テスト・CI・開発用スキル・agent-health・orchestrate)なら、bug に加えて internal ラベルも付ける (gh issue create … --label bug --label internal)
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"
}

Read the full file on GitHub · 317 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. 21d ago Changed · +26 lines da615969950b
  2. 23d ago Changed · +18 lines 2852edf9cbb1
  3. 1mo ago 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 (44 stars, last pushed today), licensed MIT. It adds 21 tokens to every session and 3,187 once invoked, about $0.0001 per session on Opus 5.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.