Debug and fix bugs with interactive upstream trace-back — diagnoses root cause level, confirms upstream document updates, and applies TDD fixes.
Diagnoses and fixes bugs by tracing root causes to upstream documents and applying TDD corrections.
npx claudepluginhub tercel/code-forgeThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Systematically debug and fix bugs with interactive trace-back to upstream documents (task descriptions, plans, requirements).
Bug Input → Context Scan → Feature Association → Root Cause Diagnosis → Trace-back Confirmation → TDD Fix → Doc Sync → Summary
@../shared/configuration.md
Accept input in two modes:
/code-forge:fixbug login page returns 500 error) — use the text as bug description/code-forge:fixbug @issues/bug-123.md) — read the file for bug detailsIf no input provided, use AskUserQuestion to ask: "Describe the bug you encountered."
Store the bug description for subsequent steps.
Scan the project codebase to understand the context:
Glob to get project structure overviewGrep to search for keywords from the bug description in the codebaseStore a concise context summary (~500 words).
Attempt to associate the bug with an existing code-forge feature:
{output_dir}/*/state.json for all featurestasks/*.md → "Files Involved" sections)plan.md and relevant tasks/*.md as additional context. Note the feature name.If multiple features match, use AskUserQuestion to let user select the most relevant one.
Offload to sub-agent for deep analysis.
Spawn a Task tool call with:
subagent_type: "general-purpose"description: "Diagnose bug root cause"Sub-agent prompt must include:
Root cause levels:
| Level | Description | Example |
|---|---|---|
| 1 | Code bug | Logic error, boundary miss, typo, wrong variable |
| 2 | Incomplete task description | Task.md steps missing a case, wrong acceptance criteria |
| 3 | Plan design flaw | Architecture doesn't handle a scenario, missing component |
| 4 | Incomplete requirement doc | Original feature doc missing a requirement |
Sub-agent must return:
ROOT_CAUSE_LEVEL: <1-4>
ROOT_CAUSE_SUMMARY: <1-2 sentence description>
AFFECTED_FILES:
- path/to/file.ext: <what's wrong>
UPSTREAM_DOCS_AFFECTED: (only if Level >= 2)
- Level 2: tasks/<task>.md — <what's missing/wrong>
- Level 3: plan.md — <what's missing/wrong>
- Level 4: {input_dir}/<feature>.md — <what's missing/wrong>
PROPOSED_FIX: <brief fix description>
REGRESSION_TEST: <what test to write>
This step only runs if Level >= 2 AND the bug is associated with a feature.
Present the root cause analysis to the user, then confirm upstream updates level by level.
Display:
Root Cause Analysis
Level: {level} — {level_description}
Summary: {root_cause_summary}
Affected code:
{affected_files list}
Upstream documents affected:
{upstream_docs_affected list}
For each affected upstream level (from lowest to highest), use AskUserQuestion:
"Root cause traced to {level_name}: {doc_path} — {what's wrong}. Update this document?"
Options:
Compile the fix plan:
Execute the fix following TDD methodology:
Write a test that reproduces the bug:
Run the test to verify it fails.
Make the minimal code changes to fix the bug.
Run the regression test to verify it passes.
Run the project's full test suite to ensure no regressions:
Commit the code changes with a descriptive message:
fix: {brief description of bug fix}
This step only runs if upstream documents were confirmed for update in Step 5.
For each confirmed document update:
Before modifying each document, show the proposed changes in diff format:
--- a/{doc_path}
+++ b/{doc_path}
@@ ... @@
- old content
+ new content
Ask user: "Apply this change?" (Yes / No / Edit manually)
Commit upstream document changes separately from code fix:
docs: update {doc_path} — traced from bug fix
If the bug is associated with a feature:
state.jsonfixes array (if not present) to the feature-level metadata{
"bug": "brief bug description",
"root_cause_level": 2,
"root_cause": "brief root cause",
"fixed_files": ["path/to/file.ext"],
"commits": ["abc1234"],
"doc_updates": ["tasks/auth-logic.md"],
"fixed_at": "ISO timestamp"
}
state.json updated timestampIf standalone bug (no associated feature): skip this step.
Display fix summary:
Bug Fix Complete
Bug: {description}
Root Cause: Level {level} — {summary}
Code Changes:
{files changed}
Regression Test:
{test file and name}
Document Updates:
{list of updated docs, or "none"}
Commits:
{commit hashes}
Next steps:
/code-forge:status {feature} View updated progress
/code-forge:review {feature} Review all changes
Search, retrieve, and install Agent Skills from the prompts.chat registry using MCP tools. Use when the user asks to find skills, browse skill catalogs, install a skill for Claude, or extend Claude's capabilities with reusable AI agent components.
Activates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.