Bug Fixing Workflow
Learn how to systematically investigate, fix, and verify bug fixes using Dotpack’s debugging workflow.
Overview
Goal: Debug and fix issues systematically with root cause analysis.
Agents Used: Debugger, QA, Engineer.
Command: /fix
Step-by-Step Guide
1. Reproduce & Investigate
Start by describing the bug to the Debugger.
/fix "users can't login with valid credentials, receiving 401 error"What happens:
- Debugger analyzes the request and codebase.
- Attempts to reproduce the issue (if a reproduction script is possible).
- Investigates logs and code flow to identify the root cause.
2. Implementation of Fix
The agent will propose and implement a solution.
What happens:
- Debugger/Engineer modifies the code to resolve the root cause.
- Applies minimal changes to avoid side effects.
- Adds safeguards (validation, error handling) to prevent recurrence.
3. Verification
Verify the fix using tests.
/testWhat happens:
- QA agent runs relevant tests to ensure the bug is fixed.
- Checks for regressions in related functionality.
Scenarios
Scenario A: Quick Fix
For simple, obvious bugs.
/fix "typo in the login button label"Result: The agent locates the component and corrects the text immediately.
Scenario B: Deep Investigation
For complex, multi-file issues.
/fix "memory leak in WebSocket connections causing server crashes"Result: The Debugger performs a deep dive, analyzing lifecycle methods and event listeners before proposing a structural fix.
Scenario C: UI/Visual Bugs
For layout or styling issues.
/fix "login button is misaligned on mobile devices"Result: The agent analyzes CSS/Tailwind classes and adjusts responsive breakpoints.
Scenario D: CI/CD Failures
For build pipeline errors.
/fix "build failed due to missing dependency in CI"Result: The agent checks package.json, lock files, and build configurations to resolve the dependency mismatch.
Real Example: Shopping Cart Bug
Bug Report
“Shopping cart duplicates items when the page is refreshed.”
Execution
/fix "shopping cart duplicates items on page refresh"Analysis Results
- Root Cause: Cart data loaded from both LocalStorage and Database without deduplication.
- Fix: Added a check in the
loadCartfunction to merge items by ID.
Verification
- QA runs tests: Add item -> Refresh -> Verify count is 1.
Best Practices
- Be Specific: Include error messages, reproduction steps, and environment details in your prompt.
- Logs: If you have a stack trace, paste it into the prompt.
- Verify: Always run
/testafter a fix to ensure no regressions. - Document: Use
/docsto update troubleshooting guides if the bug was critical.