Bugs are no longer mysteries to be solved; they are data processing issues to be computed. Learn how to execute deterministic debugging workflows.
1Stack Trace Injection
When a massive red error hits your terminal, do not attempt to read it yourself. Copy the entire block of text. Attach the files you suspect are involved (e.g., @database.ts) and paste the raw trace into the AI chat. The AI will instantly map the error message to the exact line number in your attached context and provide the diff to fix it. This reduces Mean Time To Resolution (MTTR) from hours to seconds.
2Silent Bug Rubber Ducking
If your logic is wrong but the app doesn't crash, you cannot use a stack trace. You must use Rubber Ducking. Attach the problematic file. Explain the symptom: 'When I click Checkout, the cart total goes to zero.' Command the AI: 'Act as a Senior QA Engineer. Walk through the execution flow of the checkout function line-by-line and identify the state change where the total drops.' The AI will trace the logic and find the flaw.
3Closing the Loop
Fixing a bug without writing a test guarantees that the bug will return later. Once the AI provides the fix and your app is working, you MUST close the loop. Prompt: 'The fix worked. Now, generate a Jest regression test that simulates the exact conditions of that failure. Ensure it passes.' This locks the deterministic cage around your new code.
