# Troubleshooting Bugs

> Standard protocol for debugging and fixing issues across the stack. Use when encountering errors or unexpected behavior.

- Skill: `majiayu000/troubleshooting-bugs` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add majiayu000/troubleshooting-bugs`
- Raw SKILL.md: https://api.skillmd.com/api/skills/majiayu000/troubleshooting-bugs/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: majiayu000 (https://skillmd.com/u/majiayu000)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/majiayu000/troubleshooting-bugs

---


# Debugging and Troubleshooting

## When to use this skill
- UI is not rendering as expected.
- Appwrite API calls are failing.
- Next.js build errors or hydration mismatches.

## Protocol
1.  **Check Browser Console**: Look for hydration errors or JavaScript crashes.
2.  **Check Network Tab**: Inspect the request/response payload for Appwrite calls.
3.  **Check Appwrite Console**: View "Logs" and "Permissions" for the failing collection.
4.  **Check Terminal**: Look for `use server` or promise-related errors in the Next.js dev server.

## Common Fixes
- **Auth Error (401)**: User is not logged in or doesn't have permissions.
- **Hydration Error**: Ensure `useState` or browser-only APIs are wrapped in `useEffect`.
- **Forbidden (403)**: Check Appwrite "Document Security" settings.

## Instructions
- **Log specifically**: Use `console.error('[Appwrite Error]:', error)` for clarity.

