claude.symlink/skills/debug/SKILL.md
Debug errors, test failures, and unexpected behavior with log analysis and correlation. Use when encountering issues, error messages, analyzing logs, or investigating production errors.
npx skillsauth add htlin222/dotfiles debugInstall 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 debugging for errors, test failures, unexpected behavior, and production issues.
/debug [issue] [--logs] [--correlate] [--trace] [--type bug|build|perf|deploy]
| Flag | Purpose |
| ------------- | ------------------------------------------------------------ |
| --logs | Enable log pattern analysis (error spikes, frequency, types) |
| --correlate | Run SQL correlation queries on structured logs |
| --trace | Deep stack trace analysis with context |
| --type | Issue category: bug, build, perf(ormance), deploy(ment) |
--logs)--correlate)--trace)# Check recent changes that might have caused the issue
git log --oneline -10
git diff HEAD~3
# Find error patterns in logs
grep -r "error\|Error\|ERROR" logs/ 2>/dev/null | tail -20
# Check test output
npm test 2>&1 | tail -50 # or pytest, cargo test, etc.
--logs)# Recent errors with context
grep -B 5 -A 10 "ERROR" /var/log/app.log
# Count by error type
grep -oE "Error: [^:]*" app.log | sort | uniq -c | sort -rn
# Errors in time range
awk '/2024-01-15 14:/ && /ERROR/' app.log
# Find repeated errors
grep "ERROR" app.log | cut -d']' -f2 | sort | uniq -c | sort -rn | head -20
# Find error spikes
grep "ERROR" app.log | cut -d' ' -f1-2 | uniq -c | sort -rn
| Pattern | Indicates | Action | | ------------------ | ------------------ | ------------------------ | | NullPointer | Missing null check | Add validation | | Timeout | Slow dependency | Add timeout, retry | | Connection refused | Service down | Check health, retry | | OOM | Memory leak | Profile, increase limits | | Rate limit | Too many requests | Add backoff, queue |
--correlate)-- Errors by endpoint
SELECT endpoint, count(*) as errors
FROM logs
WHERE level = 'ERROR' AND time > NOW() - INTERVAL '1 hour'
GROUP BY endpoint ORDER BY errors DESC;
-- Error rate over time
SELECT
date_trunc('minute', time) as minute,
count(*) filter (where level = 'ERROR') as errors,
count(*) as total
FROM logs
WHERE time > NOW() - INTERVAL '1 hour'
GROUP BY minute ORDER BY minute;
-- Correlate request IDs across services
SELECT service, message, time
FROM logs
WHERE request_id = 'req-12345'
ORDER BY time;
--trace)import re
def parse_stack_trace(log_content: str) -> list[dict]:
pattern = r'(?P<exception>\w+Error|\w+Exception): (?P<message>.*?)\n(?P<trace>(?:\s+at .+\n)+)'
traces = []
for match in re.finditer(pattern, log_content):
traces.append({
'type': match.group('exception'),
'message': match.group('message'),
'trace': match.group('trace').strip().split('\n')
})
return traces
## Debug Report
**Issue:** [Brief description]
**Root Cause:** [What's actually wrong]
### Evidence
- [Finding 1]
- [Finding 2]
### Fix
[Code or configuration change]
### Verification
[How to confirm the fix works]
### Prevention
[How to prevent this in the future]
Input: "TypeError: Cannot read property 'map' of undefined" Action: Trace the undefined value, find where data should be initialized, fix the source
Input: "Tests are failing" Action: Run tests, capture failures, analyze each failure, fix underlying issues
Input: /debug --logs "API returning 500 errors"
Action: Search logs for 500 status, find stack traces, identify root cause, check error frequency
Input: /debug --correlate "intermittent failures"
Action: Run correlation queries to find patterns, identify affected endpoints, correlate with events
testing
Converts narrative medical text into Pocket Medicine bullet-style notes with proper abbreviations, then modularizes sections exceeding 20 lines into linked standalone files.
devops
Use when deploying Docker services on the local VM (hostname: vm, Pop!_OS) with Traefik reverse proxy and Homepage dashboard. Covers crane image workflow, Traefik file-provider registration, Homepage services.yaml entries, and compose templates on the traefik-proxy network.
development
Use when reviewing a data visualization or figure for clarity, checking if a graph communicates its message without additional context, or iterating on R/Python plot scripts until a naive reader can fully understand the figure.
development
Runs Vale prose linter on markdown/text files and auto-fixes issues. Use when the user asks to lint, proofread, or improve writing quality of markdown or text files.