fix-bug

A step-by-step workflow for investigating and fixing software bugs. It uses separate debugging, planning, implementation, and code-review steps, and requires specific add-ons to be installed and enabled.

In plain words
What is it for?
Use it to investigate a reported bug, plan the fix, implement it, simplify the resulting code, and review the changes before finishing.
Why use it?
It gives bug fixes a consistent process instead of relying on ad-hoc changes. It also checks that work happens in an isolated worktree, a separate copy of the repository.

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/pablomarin/claude-codex-forge/fix-bug
Clone the repo
git clone --depth 1 https://github.com/pablomarin/claude-codex-forge
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 18,395 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00000 $0.18395
Opus 5 $0.00000 $0.09198
Sonnet 5 $0.00000 $0.03679
Haiku 4.5 $0.00000 $0.01840

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

Security

Grade B, and why

fix-bug scanned grade B with 1 finding 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.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

[ -f .claude/playwright-dir ] && NODE_DIRS="$(cat .claude/playwright-dir) $NODE_DIRS"
Origin

Copies of this mod

1 near-identical copy found in the catalogue:

commands/fix-bug.md · 1,239 lines

How it starts

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

Bug Fix Workflow

This workflow is MANDATORY. Follow every step in order. If any required command/skill fails with "Unknown skill", STOP and alert the user.

Required Plugins

This workflow requires the following plugins to be installed AND enabled:

Plugin Skills/Commands Used
superpowers@claude-plugins-official /superpowers:systematic-debugging, /superpowers:brainstorming, /superpowers:writing-plans, /superpowers:subagent-driven-development (default executor), /superpowers:executing-plans (headless mode)
pr-review-toolkit@claude-plugins-official code-simplifier agent, code-reviewer agent, /pr-review-toolkit:review-pr

To enable plugins, add to ~/.claude/settings.json:

{
  "enabledPlugins": {
    "superpowers@claude-plugins-official": true,
    "pr-review-toolkit@claude-plugins-official": true,
    "frontend-design@claude-plugins-official": true
  }
}

Pre-Flight Checks

1. Create Isolated Workspace (MANDATORY)

Check if already in a worktree:

if [[ "$(pwd)" == *".worktrees/"* ]]; then
  echo "STATE: ALREADY_IN_WORKTREE"
else
  echo "STATE: NEEDS_WORKTREE"
fi

If ALREADY_IN_WORKTREE:

  • You're already isolated — continue with current workspace
  • Surface drift on the parent default branch (advisory; no auto-FF from inside a worktree)
# DRIFT-PREFLIGHT-ALREADY-BEGIN (byte-identical with commands/fix-bug.md — enforced by test-contracts.sh)
ROOT="$(git rev-parse --show-toplevel)"
LIB="$ROOT/.claude/hooks/lib/default-branch.sh"
[ ! -f "$LIB" ] && LIB="$ROOT/hooks/lib/default-branch.sh"
DEFAULT_BRANCH=$(bash "$LIB" 2>/dev/null) \
    || { DEFAULT_BRANCH="main"; echo "  ⚠ default-branch helper bailed; assuming 'main' (drift check may be wrong on non-main repos)" >&2; }
ALREADY_FETCH_OK=true
git fetch origin --quiet 2>/dev/null || ALREADY_FETCH_OK=false
# Behind-check: only if FETCH succeeded AND both refs exist. Skipping on fetch failure
# prevents reporting drift against a stale origin/* ref. Also guards rev-list exit-128.
if [ "$ALREADY_FETCH_OK" = "true" ] \
   && git rev-parse --verify "$DEFAULT_BRANCH" >/dev/null 2>&1 \
   && git rev-parse --verify "origin/$DEFAULT_BRANCH" >/dev/null 2>&1; then
  BEHIND=$(git rev-list --count "$DEFAULT_BRANCH..origin/$DEFAULT_BRANCH" 2>/dev/null || echo "")
  if [[ "$BEHIND" =~ ^[0-9]+$ ]] && [ "$BEHIND" -gt 0 ]; then
    echo "  ⚠ Parent '$DEFAULT_BRANCH' is $BEHIND commits behind origin (skipping auto-FF from worktree)"
  fi
fi
# DRIFT-PREFLIGHT-ALREADY-END

Read the full file on GitHub · 1,239 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 · 1,239 lines · 0 tokens per session scan B edd7ded1bf98

Subscribe to this mod's changes

fix-bug is a command published in the GitHub repository pablomarin/claude-codex-forge (5 stars, last pushed 4d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 18,395 tokens. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.