agentleFS
QBall-IncQBall-Inc/the-bulwark/skills/fix-bug/SKILL.md

fix-bug

Skill8 starsChanged 5 months agoMITView on GitHub

Run the Fix Validation pipeline to investigate, fix, and validate a bug. Ensures deterministic pipeline execution with IssueAnalyzer, FixWriter, TestWriter (conditional), TestAudit (conditional), and FixValidator stages.

40 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use improvement, build-feature and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • kiminmonacoSkill

    improvement

    Guide for making improvements to existing ClaudeBar functionality using TDD. Use this skill when: (1) Enhancing existing features (not adding new ones) (2) Improving UX, performance, or code quality (3) User asks "improve X", "make Y better", or "enhance Z" (4) Small enhancements that don't require full architecture design For NEW features, use implement-feature skill instead.

    Also in 4 projects that use this

  • sirakinbSkill

    build-feature

    Autonomous task loop that picks ready tasks, implements them, updates progress.txt, commits, and repeats. Use when asked to 'build feature', 'run the loop', or 'implement these tasks'.

    Also in 5 projects that use this

  • kiminmonacoSkill

    implement-feature

    Guide for implementing features in ClaudeBar following architecture-first design, TDD, rich domain models, and Swift 6.2 patterns. Use this skill when: (1) Adding new functionality to the app (2) Creating domain models that follow user's mental model (3) Building SwiftUI views that consume domain models directly (4) User asks "how do I implement X" or "add feature Y" (5) Implementing any feature that spans Domain, Infrastructure, and App layers

    Also in 7 projects that use this

  • SentrySkill

    write-tests

    Write tests following project conventions. Use when adding new tests or modifying existing ones.

    Also in 6 projects that use this

  • JetBrainsSkill

    create-plan

    Research the codebase and create an implementation plan with architecture notes, design document, and track decomposition. Use when starting a new feature or large change.

    Also in 4 projects that use this

  • JasonPaffSkill

    implement-plan

    Execute implementation plan with structured tracking and validation using subagent architecture

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

9 rules. 0 are common, 8 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 40 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When invoked, follow the Fix Validation pipeline exactly:

    line 62
  2. Very specific:

    Condition: Check debug report's validation_plan.recommendation.new_tests_needed

    line 127
  3. Distinctive:

    Write tests that verify the fix

    line 130
  4. Distinctive:

    Follow T1-T4 rules (no mocking system under test)

    line 132
  5. Distinctive:

    Condition: Run if any test files were created or modified in Stage 2 (FixWriter) OR Stage 3 (TestWriter).

    line 138
  6. Distinctive:

    Action: Run mock-detection on new/modified tests to verify T1-T4 compliance

    line 140
  7. Distinctive:

    No new issues introduced

    line 190
  8. Distinctive:

    If rejected and iterations < 3:

    line 195
  9. Distinctive:

    After each stage, report progress to user:

    line 205

“Common” is measured: kept by at least 6 in 10 of the 40 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Fix Bug Pipeline

This skill triggers the Fix Validation pipeline to systematically investigate, fix, and validate a bug.

When to Use This Skill

Load this skill when the user request matches ANY of these patterns:

Trigger PatternExample User Request
Bug fix requests"Fix this bug", "Something is broken in X"
Error investigation"Users report errors in X", "This feature isn't working"
Regression fixes"This used to work", "Breaking after recent changes"
Production issues"Login fails for new accounts", "API returns 500"
Flaky behavior"Tests pass sometimes", "Intermittent failures"

DO NOT use this skill for:

Anti-PatternUse Instead
Ad-hoc fixes without investigationDirect fix (skip pipeline)
Simple typo correctionsDirect edit
Refactoring without reported issuesCode Review pipeline
Adding new featuresNew Feature pipeline
Performance optimizationResearch & Planning pipeline

Why This Skill Exists

Without this skill, conversational prompts like "please investigate and fix this bug" may cause Claude to skip pipeline stages and fix directly. This skill ensures deterministic execution of all Fix Validation pipeline stages.

Usage

/fix-bug <path> [description]

Arguments:

  • $1 (required): Path to code with the bug
  • $2 and beyond (optional): Description of the issue - recommended for better analysis

Examples:

/fix-bug src/auth/login.ts "Users report login fails for new accounts"
/fix-bug tests/fixtures/fix-validator/simple-fix/ "Cannot read property displayName of undefined"
/fix-bug src/api/routes.ts

Pipeline Stages

When invoked, follow the Fix Validation pipeline exactly:

IssueAnalyzer (bulwark-issue-analyzer)          // Sonnet - root cause analysis
|> FixWriter (bulwark-implementer)              // Opus - implement fix
|> (if !tests_cover_scenario                    // Conditional: only if tests don't already exist
    then TestWriter |> TestAudit                // Opus writes, then audit for T1-T4
    else Skip)
|> FixValidator (bulwark-fix-validator)          // Sonnet - validate against debug report
|> CodeReviewer (general-purpose)               // Sonnet - review fix
|> (if !approved
    then IssueAnalyzer                          // Loop back
    else Done)
|> LOOP(max=3)                                  // Max 3 iterations

Execution Instructions

Stage 1: IssueAnalyzer

MUST spawn bulwark-issue-analyzer agent via Task tool:

Task(
  subagent_type="bulwark-issue-analyzer",
  model="sonnet",
  prompt="GOAL: Analyze the bug and produce a debug report..."
)

Input: Path from $1, description from $2 onward

Output: Debug report at logs/debug-reports/{issue-id}-{timestamp}.yaml

Do NOT skip this stage. The debug report is required for subsequent stages.

Stage 2: FixWriter

MUST spawn bulwark-implementer agent via Task tool:

Task(
  subagent_type="bulwark-implementer",
  prompt="GOAL: Fix the identified issue based on the debug report.
  CONSTRAINTS: Only fix the identified issue. Write tests for the fix. Max 3 quality gate retries.
  CONTEXT:
    mode: fix
    debug_report_path: logs/debug-reports/{issue-id}-{timestamp}.yaml
    root_cause: {from Stage 1}
    affected_files: {from Stage 1}
    fix_approach: {from Stage 1}
  OUTPUT: Implementation report at logs/implementer-{id}-{timestamp}.yaml"
)

Input: Debug report from Stage 1

Output: Implementation report at logs/implementer-{id}-{timestamp}.yaml

SA6 Note: The implementer returns pipeline suggestions with MANDATORY language in its summary. Evaluate each suggestion per SA6.

Do NOT implement the fix yourself. The implementer agent handles quality gates and structured output.

Stage 3: TestWriter (Conditional)

Condition: Check debug report's validation_plan.recommendation.new_tests_needed

If tests needed:

  1. Write tests that verify the fix
  2. Cover the specific bug scenario
  3. Follow T1-T4 rules (no mocking system under test)

If tests exist: Skip to Stage 3b or Stage 4

Stage 3b: TestAudit (Conditional)

Condition: Run if any test files were created or modified in Stage 2 (FixWriter) OR Stage 3 (TestWriter). This ensures implementer-written tests receive T1-T4 audit even when TestWriter is skipped.

Action: Run mock-detection on new/modified tests to verify T1-T4 compliance

If T1 violation: Return to TestWriter (or FixWriter if TestWriter was skipped), request rewrite

If T2-T4 violations: Log warning, proceed

Stage 4: FixValidator

MUST spawn bulwark-fix-validator agent via Task tool:

Task(
  subagent_type="bulwark-fix-validator",
  model="sonnet",
  prompt="GOAL: Validate the fix against the debug report...

  CONTEXT:
  Debug Report: logs/debug-reports/{issue-id}-{timestamp}.yaml
  Fix Applied: {description of changes}
  Tests Added: {if any}
  ..."
)

Input: Debug report path, fix details, test details

Output: Validation report at logs/validations/fix-validation-{issue-id}-{timestamp}.yaml

Stage 5: CodeReviewer

MUST spawn general-purpose agent via Task tool:

Task(
  subagent_type="general-purpose",
  model="sonnet",
  prompt="GOAL: Review the fix for correctness, completeness, and safety.
  CONSTRAINTS: Do NOT modify any files. Review only.
  CONTEXT:
    debug_report: logs/debug-reports/{issue-id}-{timestamp}.yaml
    fix_applied: {description of changes from Stage 2}
    tests_added: {from Stage 3, if any}
    validation_results: {from Stage 4}
  OUTPUT: Approval decision (approved: true/false) with concerns and recommendations."
)

Approval Criteria:

  • Fix addresses root cause from debug report
  • Tests verify the specific bug scenario
  • No new issues introduced
  • Validation confidence is acceptable (high or medium with justification)

Loop Handling

If rejected and iterations < 3:

  • Return to Stage 1 with feedback
  • Include previous validation results

If rejected and iterations >= 3:

  • Escalate to user
  • Summarize all attempts

Progress Reporting

After each stage, report progress to user:

Stage 1 (IssueAnalyzer): Complete
  - Debug report: logs/debug-reports/AUTH-001-20260120.yaml
  - Root cause: {summary}
  - Complexity: {low|medium|high}

Stage 2 (FixWriter): Complete
  - Files modified: {list}
  - Fix: {brief description}

Stage 3 (TestWriter): {Complete|Skipped}
  - Tests added: {count or "existing tests sufficient"}

Stage 4 (FixValidator): Complete
  - Confidence: {HIGH|MEDIUM|LOW}
  - Recommendation: {proceed|revise}

Stage 5 (CodeReviewer): Complete
  - Decision: {Approved|Rejected}

Error Handling

ErrorAction
IssueAnalyzer fails to identify root causeReport to user, ask for more context
Tests cannot be executedFixValidator uses manual validation strategy
FixValidator confidence is LOWEscalate to user with details
Max iterations reachedSummarize attempts, ask user for guidance

Related Resources

ResourceLocation
Pipeline definitionpipeline-templates/references/fix-validation.md
IssueAnalyzer agentagents/bulwark-issue-analyzer.md
Implementer agentagents/bulwark-implementer.md
FixValidator agentagents/bulwark-fix-validator.md
Issue debugging skillissue-debugging/SKILL.md

Note: Paths are relative to your skills/agents directory (either skills/ or .claude/skills/).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.