backend/omoi_os/sandbox_skills/error-diagnosis/SKILL.md
Debug errors, analyze logs, identify root causes, and suggest fixes
npx skillsauth add kivo360/omoios backend/omoi_os/sandbox_skills/error-diagnosisInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Systematic approach to debugging errors and identifying root causes.
1. Reproduce → 2. Isolate → 3. Identify → 4. Fix → 5. Verify
| Exception | Common Cause | Investigation |
|-----------|--------------|---------------|
| KeyError | Missing dict key | Check if key exists before access |
| AttributeError | None object access | Check for None before method call |
| TypeError | Wrong argument type | Check function signature and input |
| ImportError | Missing/circular import | Check import paths and dependencies |
| ConnectionError | Network/DB issues | Check connectivity and credentials |
# Example stack trace:
# Traceback (most recent call last):
# File "app.py", line 42, in handle_request ← Entry point
# result = process_data(data)
# File "processor.py", line 15, in process_data ← Intermediate
# return transform(data['key'])
# File "processor.py", line 8, in transform ← Root cause
# return value.upper()
# AttributeError: 'NoneType' object has no attribute 'upper'
# The error is at line 8, but the fix might be:
# - Line 15: Check if 'key' exists in data
# - Line 8: Check if value is None before .upper()
# - Caller: Ensure data is properly validated
| Error | Likely Cause | Fix | |-------|--------------|-----| | Connection refused | DB not running | Start DB, check port | | Authentication failed | Bad credentials | Check env vars | | Timeout | Long query or lock | Optimize query, check locks | | Unique constraint | Duplicate data | Handle conflict or validate first | | Foreign key violation | Invalid reference | Check referential integrity |
| Status | Meaning | Investigation | |--------|---------|---------------| | 400 | Bad request | Check request body/params | | 401 | Unauthorized | Check auth token | | 403 | Forbidden | Check permissions | | 404 | Not found | Check URL path | | 500 | Server error | Check server logs | | 502/503 | Service unavailable | Check upstream services |
# Quick debugging
import pdb; pdb.set_trace() # Breakpoint
# Better: ipdb or pudb
import ipdb; ipdb.set_trace()
# Inspect object
print(vars(obj))
print(dir(obj))
# Pretty print
from pprint import pprint
pprint(complex_dict)
# Get traceback
import traceback
traceback.print_exc()
# Search logs for errors
grep -i "error\|exception\|traceback" app.log
# Get context around error
grep -B 5 -A 10 "ERROR" app.log
# Follow logs in real-time
tail -f app.log | grep --line-buffered "ERROR"
# Count error types
grep "ERROR" app.log | cut -d':' -f4 | sort | uniq -c | sort -rn
# What changed recently?
git log --oneline -20
# What changed in specific file?
git log --oneline -p -- path/to/file.py
# Who changed this line?
git blame path/to/file.py -L 42,42
# Find when bug was introduced
git bisect start
git bisect bad HEAD
git bisect good v1.0.0
# Test at each step until found
-- Check for locks (PostgreSQL)
SELECT * FROM pg_locks WHERE granted = false;
-- Active queries
SELECT pid, now() - pg_stat_activity.query_start AS duration, query
FROM pg_stat_activity
WHERE state != 'idle'
ORDER BY duration DESC;
-- Kill stuck query
SELECT pg_cancel_backend(pid);
## Error Report
### Summary
{One-line description of the error}
### Environment
- OS: {os}
- Version: {app version}
- Config: {relevant config}
### Steps to Reproduce
1. {Step 1}
2. {Step 2}
3. {Step 3}
### Expected Behavior
{What should happen}
### Actual Behavior
{What actually happens}
### Error Message
{Full error message and stack trace}
### Logs
{Relevant log entries}
### Root Cause Analysis
{What is causing this error}
### Proposed Fix
{How to fix it}
### Impact
- Severity: Critical/High/Medium/Low
- Affected users: {scope}
- Workaround: {if any}
development
Spec-driven development workflow for turning feature ideas into structured PRDs, requirements, designs, tickets, and tasks. Uses a state machine approach with EXPLORE → REQUIREMENTS → DESIGN → TASKS → SYNC phases. Each phase has validation gates, checkpointing, and session transcript support for cross-sandbox resumption.
development
Generate comprehensive tests including unit, integration, and property-based tests
development
Spec-driven development workflow for turning feature ideas into structured PRDs, requirements, designs, tickets, and tasks. Uses a state machine approach with EXPLORE → REQUIREMENTS → DESIGN → TASKS → SYNC phases. Each phase has validation gates, checkpointing, and session transcript support for cross-sandbox resumption.
development
Plan safe refactoring with dependency analysis, impact assessment, and rollback strategies