Systematically troubleshoot bugs by tracing data flow through code, comparing expected vs actual behavior. Use when investigating why stored data differs from expected values, or when a feature works in one code path but not another.
When troubleshooting a bug, follow this systematic approach:
Start by understanding what the user is seeing vs what they expect:
Example:
# Read credentials from .env and query directly
PGPASSWORD='<from .env>' psql -h <POSTGRES_HOST> -p <POSTGRES_PORT> -U <POSTGRES_USER> -d <POSTGRES_DB> --set=sslmode=require -c "SELECT id, sender_email, sender_name FROM messages WHERE ticket_id = 123;"
Check if this area was recently modified:
# Find recent commits that touched relevant files
git log --oneline -10 -- <file>
# Show what changed in a specific commit
git show <commit-hash> -p
Look for:
Follow the code path from input to output:
For each step, verify the value is what you expect. The bug is where expected != actual.
Common patterns:
Once you find the bug, search for the same pattern elsewhere:
# Find similar code that might have the same issue
grep -r "similar_pattern" src/
Pay special attention to:
Summarize:
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer