Debugging Loops
Prompt Copilot to run the next-step skill and move to the ai-training-debugging-2 branch.
Β
Intelligent AI + Deterministic Scripts
The core insight behind debugging with Copilot is pairing its intelligence with deterministic tools.
Deterministic tools (linters, test runners, type checkers) produce reliable, specific output: file paths, line numbers, exact error messages. They're cheap, fast, and always produce the same output for the same input. You can run them hundreds of times with no LLM cost.
AI (Copilot) is intelligent but non-deterministic. It can reason, synthesize, and make targeted edits β but it benefits from precise, structured information to act on.
The debug loop that ties these together:
Run a deterministic script (linter, test runner, etc.)
Read the output β Copilot extracts what's wrong, where, and why
Fix β Copilot makes targeted edits to the affected files
Verify β Copilot reruns the same script to confirm the fixes worked
Repeat if any issues remain
This loop is at the heart of all the debugging patterns covered in this section.
Exercise: Fixing Linter Errors
Run
npm run lintin terminaloutput includes file, line, column, and exact error
Prompt:
Run the linter and fix any errorsReads errorsβtargets the right filesβmakes fixes
Rerun the linter after fixing to confirm zero errors
fix-tests Skill
Run all tests and capture output
Identify every failing test by file, name, and error message
Pick the first failing test a. Diagnose the failure β write out the reasoning in chat (builds LLM context) b. Propose and implement a fix c. Rerun tests to verify the fix passes
Repeat for each remaining failure
Final verification pass
βοΈ Exercise: Fixing Failing Tests
Run
npm testin the terminalInspect
fix-testsskillPrompt Copilot:
/fix-testsObserve Copilot in action
Β
Next: Debugging End-to-End Flows
Β