diagnose

mruwnik's avatarfrom mruwnik

Run safe diagnostic commands on the remote memory server. Use for checking logs, container status, disk usage, memory, and running read-only database queries.

⭐2stars🔀0forks📁View on GitHub🕐Updated Jan 4, 2026

When & Why to Use This Skill

This Claude skill provides a comprehensive suite of safe, read-only diagnostic tools for remote server management and system observability. It empowers users to proactively monitor container health, analyze application logs, track critical resource utilization (disk, memory, processes), and perform secure database inspections, significantly reducing the mean time to resolution (MTTR) for technical issues.

Use Cases

  • Incident Troubleshooting: Quickly retrieve and grep through Docker logs for specific services (API, workers) to identify the root cause of application crashes or errors.
  • System Health Audits: Monitor real-time resource consumption, including disk usage breakdowns and memory-intensive processes, to prevent downtime caused by resource exhaustion.
  • Infrastructure Monitoring: Check the operational status of all containers and system services to ensure high availability and environment stability.
  • Safe Database Verification: Execute read-only SQL queries to verify data integrity or check processing counts without the risk of accidental data modification or deletion.
namediagnose
descriptionRun safe diagnostic commands on the remote memory server. Use for checking logs, container status, disk usage, memory, and running read-only database queries.

Server Diagnostics

The diagnostics script is at tools/diagnose.sh. It provides safe, read-only commands for inspecting the remote server memory at /home/ec2-user/memory.

Commands

Status (overview)

Get overall system health:

./tools/diagnose.sh status

Shows: container status, memory, disk, and recent errors.

Logs

View docker logs:

./tools/diagnose.sh logs              # all services, last 100 lines
./tools/diagnose.sh logs api          # specific service
./tools/diagnose.sh logs api 500      # last 500 lines
./tools/diagnose.sh logs worker 200   # worker logs

Container Status

./tools/diagnose.sh ps

System Resources

./tools/diagnose.sh disk    # disk usage breakdown
./tools/diagnose.sh mem     # memory usage
./tools/diagnose.sh top     # top processes by memory

File Operations

./tools/diagnose.sh ls <path>              # list directory
./tools/diagnose.sh cat <file>             # view file
./tools/diagnose.sh tail <file> [lines]    # tail file (default: 50)
./tools/diagnose.sh grep <pattern> <path>  # search files

Database Queries

Run read-only SQL queries (SELECT only):

./tools/diagnose.sh db "SELECT count(*) FROM source_item"
./tools/diagnose.sh db "SELECT * FROM source_item ORDER BY created_at DESC LIMIT 5"
./tools/diagnose.sh db "SELECT status, count(*) FROM source_item GROUP BY status"

Non-SELECT queries are blocked for safety.

Common Diagnostics

Check why API is failing:

./tools/diagnose.sh logs api 200

Check worker processing:

./tools/diagnose.sh logs worker 100

Database stats:

./tools/diagnose.sh db "SELECT count(*) FROM source_item"
./tools/diagnose.sh db "SELECT modality, count(*) FROM source_item GROUP BY modality"

Find recent errors:

./tools/diagnose.sh status   # includes error grep
./tools/diagnose.sh grep "ERROR" src/

Check disk space:

./tools/diagnose.sh disk