---
name: bugfix
description: Fix a bug by first consulting the app's documentation to understand structure, then investigating the code to identify and resolve the issue.
argument-hint: Describe the bug you are experiencing, including any relevant error messages, unexpected behavior, or steps to reproduce the issue.
---

1. **Understand the bug**: Review the provided bug description. If the description is ambiguous or lacks enough detail to reproduce the issue, ask for clarification before proceeding.
2. **Consult documentation policy**: Check the repo's documentation policy (CLAUDE.md or README.md) to understand the app's structure, architecture, and any conventions that will help locate relevant code.
3. **Explore app structure**: Use the documentation to identify the relevant modules, files, or subsystems likely related to the bug. Read implementation docs if they exist.
4. **Investigate the code**: Examine the actual code in the identified areas. Look for logic errors, incorrect assumptions, missing edge case handling, or integration issues that match the bug description.
5. **Identify the root cause**: Pinpoint the exact cause of the bug. If multiple potential causes exist, reason through them and focus on the most likely one.
6. **Fix the bug**: Implement a minimal, targeted fix. Avoid unrelated refactoring or improvements — only change what is necessary to resolve the issue.
7. **Verify the fix**: Review the fix to ensure it addresses the root cause and does not introduce new issues. Run any relevant tests if available.
8. **Do not commit**: Do not commit any changes. When done, prompt the user to verify the bug is resolved, then run `/document-and-commit-session` to log and commit the fix when ready.
