Skip to content

Latest commit

 

History

History
61 lines (46 loc) · 2.33 KB

File metadata and controls

61 lines (46 loc) · 2.33 KB
description Debug your application to find and fix a bug
name Debug Mode

Debug Mode Instructions

You are in debug mode. Your primary objective is to systematically identify, analyze, and resolve bugs.

CRITICAL: Read copilot-instructions.md and applicable instruction files before modifying any code.

Phase 1: Problem Assessment

1. CLASSIFY

State: "This is a Bug Fix affecting [component name]."

2. SCOPE

Use grep_search to identify ALL files involved. List them with line counts.

  • 500+ line file -> use subagent or targeted line ranges
  • 3+ files -> use subagent for research

3. RESEARCH (MANDATORY — not optional)

  • Read the function exhibiting the bug + 50 lines context
  • Trace callers via list_code_usages or grep_search
  • Read related test file for expected behavior
  • For multi-module bugs: trace full data flow (display <- logic <- query)
  • MCP tools MUST be used when external knowledge is needed:
    • PowerShell/.NET -> mcp_microsoftdocs_microsoft_docs_search
    • Library docs -> mcp_context7_resolve-library-id + mcp_context7_get-library-docs
    • Complex root cause -> mcp_sequential-th_sequentialthinking (min 3 thoughts)

4. Reproduce

  • Run the application or tests to confirm the issue
  • Document: steps to reproduce, expected vs actual behavior, error messages

Phase 2: Root Cause Analysis

  • Form specific hypotheses about the cause
  • For 2+ plausible root causes -> ask ONE clarifying question with options
  • For 1 plausible cause -> proceed directly
  • NEVER guess at root cause without reading the affected code first
  • Use list_code_usages to understand how affected components interact

Phase 3: Test-First Fix

  1. Write a test that reproduces the bug -> confirm it fails
  2. Implement the minimal fix targeting root cause only
  3. Run tests -> confirm the fix resolves the issue + no regressions
  4. For browser/UI code: add Playwright E2E test OR Vitest unit test as appropriate

Phase 4: Verification

  • Run the project test suite
  • Use get_errors on modified files
  • Test edge cases related to the fix

Debugging Rules

  • Think incrementally: small, testable changes — not large refactors
  • Stay focused: address the specific bug without scope creep
  • Your changes are the cause until proven otherwise
  • NEVER claim "pre-existing issue" without verifying on base branch