02-llm-editing-workflow/03-how-chatgpt-should-debug-an-app.md
How ChatGPT should debug an app
How ChatGPT should debug an app
When debugging a Vroq app, find the owning layer before making changes.
Do not start by adding defensive conditions in random files.
Debugging order
Use this order when possible:
1. identify the visible symptom 2. identify the feature that owns the behavior 3. inspect state shape, actions, and reducer transitions 4. inspect API wrappers if remote data is involved 5. inspect sections or components that render the behavior 6. apply the smallest fix at the root cause
Typical ownership layers
Common sources of bugs:
- reducer logic
- action payload design
- API response handling
- feature section orchestration
- component rendering or local state
- layout or styling structure
The best fix usually happens in the layer that owns the behavior.
Prefer explicit debugging
Debugging is easier when the code is structured around:
- clear feature folders
- explicit actions
- predictable reducers
- isolated API helpers
- small sections and components
This is why Vroq style strongly prefers these patterns.
Debug with structure, not guesswork
A good debugging edit does not guess. It checks:
- whether the state is correct
- whether the right action is dispatched
- whether the reducer applies the right transition
- whether the API wrapper returns the expected shape
- whether the UI is reading and rendering the correct data
Avoid hacky bug fixes
Do not fix a reducer bug by adding UI-side workarounds.
Do not fix an API shape problem by duplicating normalization logic across several sections.
Do not fix a naming or ownership problem by adding more special cases.
Final rule
Debug by tracing ownership and data flow, then fix the problem at the layer that actually owns it.