System diagnostic agent that identifies errors, attempts self-healing, and tracks remediation metrics.
Install
mkdir -p .claude/skills/doctor-louisphamdev && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/10777" && unzip -o skill.zip -d .claude/skills/doctor-louisphamdev && rm skill.zipInstalls to .claude/skills/doctor-louisphamdev
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
**SKILL** — Doctor Agent diagnostic & self-healing toolkit for Turing OS. Use when: diagnosing errors, fixing system issues, checking Docker/container health, querying known issues database, running self-healing scripts, tracking fix metrics, or generating GitHub issues. Triggers: "doctor", "diagnose", "fix error", "system health", "self-heal", "container crashed", "service downKey capabilities
- →Diagnose system errors
- →Check container health
- →Run self-healing scripts
- →Track fix metrics
How it works
It provides a diagnostic and self-healing toolkit that maps errors to allow-listed remediation actions via an orchestrator.
Inputs & outputs
When to use doctor
- →Diagnose system errors
- →Check docker container health
- →Run self-healing scripts
About this skill
Doctor Agent Skill — Diagnostic & Self-Healing Toolkit
Doctor is the system-doctor agent: it diagnoses failures, attempts self-healing, escalates, and records incidents. Fix-execution is orchestrator-mediated:
run_fix_script()maps a fix name onto an allow-listed action andPOSTs it to{ORCHESTRATOR_URL}/remediation(the orchestrator runs it via Dockerode with audit + RBAC). The worker has no Docker socket and runs no local scripts. Knowledge base / metrics / GitHub escalation route through the gateway (/gateway/bookstack,/gateway/github) withCONSUMER_TOKEN. Dynamic fix-script creation is disabled and arbitrary config patching is gated for safety. These paths are implemented and unit-tested but pending live-stack verification.
Core Philosophy
Every failure is a learning opportunity.
Doctor never just reports — Doctor fixes, tracks, and improves.
Doctor Tool Suite
1. check_system_health()
Quick snapshot of system vitals: CPU, memory, disk, Docker, network.
TOOL_CALL: check_system_health
ARGUMENTS: {}
2. parse_docker_logs(container_name, lines=50)
Fetch & parse logs. Filters INFO, highlights ERROR/WARN. Returns structured entries.
TOOL_CALL: parse_docker_logs
ARGUMENTS: {"container_name": "turing-orchestrator", "lines": 100}
3. check_service_connectivity(service_name)
Test if a service (plane, bookstack, matrix, orchestrator, github) is up/degraded/down.
TOOL_CALL: check_service_connectivity
ARGUMENTS: {"service_name": "plane"}
4. check_recent_errors(count=10)
Aggregate recent ERROR/WARN entries across ALL running containers.
TOOL_CALL: check_recent_errors
ARGUMENTS: {"count": 20}
5. query_known_issues_db(error_pattern) 🔍
Search BookStack known-issues DB. Matches against error key, symptoms, causes, fix.
TOOL_CALL: query_known_issues_db
ARGUMENTS: {"error_pattern": "OOM memory"}
6. save_to_known_issues(error_key, symptoms, causes, fix, pattern)
Record a new known issue to BookStack for future reference.
TOOL_CALL: save_to_known_issues
ARGUMENTS: {"error_key": "worker OOM", "symptoms": "Container killed by OOM killer", "causes": "Memory limit too low", "fix": "Increase MEMORY_LIMIT in .env", "pattern": "killed.*OOM"}
7. create_github_issue(title, body, labels, assignees)
Create a structured GitHub issue via the gateway GitHub proxy (the GitHub token lives in the orchestrator vault; the worker uses CONSUMER_TOKEN).
TOOL_CALL: create_github_issue
ARGUMENTS: {"title": "[Bug] Worker OOM on large file upload", "body": "## Error Summary\n...", "labels": ["project-bug", "severity-p1"]}
8. run_fix_script(fix_name, target) 🔧
Map a fix name onto an allow-listed remediation action and POST it to
{ORCHESTRATOR_URL}/remediation (CONSUMER_TOKEN). The orchestrator runs the
action via Dockerode with audit + RBAC. The worker runs no local scripts.
Mappings: restart_container / restart_service / restart_pm → restart_container;
check_disk_usage → check_disk_usage; cleanup_docker → cleanup_docker (admin).
Unmapped names short-circuit with a clear message.
TOOL_CALL: run_fix_script
ARGUMENTS: {"fix_name": "restart_container", "target": "ticket-42"}
9. verify_fix(command, expected_outcome)
Verify a fix worked by running a shell command and checking output.
TOOL_CALL: verify_fix
ARGUMENTS: {"command": "docker ps | grep turing-orchestrator", "expected_outcome": "turing-orchestrator"}
10. track_metrics(metric_name, value) 📊
Record a metric to BookStack. Keeps last 100 entries per metric.
TOOL_CALL: track_metrics
ARGUMENTS: {"metric_name": "fix_success_rate", "value": 0.85}
11. get_doctor_dashboard() 📋
Full summary: recent errors, fix success rate, open escalations, system health.
TOOL_CALL: get_doctor_dashboard
ARGUMENTS: {}
12. ask_user_confirmation(question) 🙋
Ask admin a yes/no question via Matrix, poll for reply (up to 600s).
TOOL_CALL: ask_user_confirmation
ARGUMENTS: {"question": "Should I restart the failed container?"}
13. run_self_healing_pipeline(error_description) (experimental)
Orchestrates the full self-healing workflow: diagnose → check known issues → attempt fix → verify → track → report. The fix-execution steps are experimental; diagnosis + escalation are reliable.
TOOL_CALL: run_self_healing_pipeline
ARGUMENTS: {"error_description": "Container turing-orchestrator keeps restarting with exit code 137"}
14. run_full_remediation(error_description, container_name) 🚀
Auto-remediation — tries approaches in sequence:
- Known Issues DB → 2. Allow-listed remediation (
run_fix_script→POST /remediation) → 3. Cross-worker tools → 4. GitHub escalation (via/gateway/github). Dynamic-script creation and arbitrary config patching are NOT in this chain (disabled / gated for safety — escalate instead).
TOOL_CALL: run_full_remediation
ARGUMENTS: {"error_description": "Container keeps crashing", "container_name": "turing-orchestrator"}
15. create_dynamic_fix_script(...) 🔨 — DISABLED
Disabled for safety. This used to write an LLM-generated .ps1/.sh into
scripts/doctor-fixes/ and execute it locally; that write+exec path is unsafe
and now has no consumer (run_fix_script no longer runs local scripts). The
function is inert (returns { disabled: true }). When no allow-listed action
fits, escalate to a human via create_github_issue.
16. patch_config_file(file_path, operation, key, value, path) ⚙️ — GATED
Off by default. Returns disabled unless DOCTOR_ALLOW_CONFIG_PATCH=true, and
even then it is workspace-only (absolute paths and .. traversal rejected;
the worker only mounts /workspace, so the host repo/compose/.env are not
reachable). Escalate host config changes to a human / DevOps. Operations:
set, remove, reset (append is rejected).
17. invoke_worker_tool(target_role, tool_name, arguments) 🌐
Call a tool from another worker role via orchestrator relay. Used when the fix requires capabilities from devops, qa, se, or pm workers.
# Scale via DevOps worker
TOOL_CALL: invoke_worker_tool
ARGUMENTS: {"target_role": "devops", "tool_name": "scale_worker", "arguments": {"service": "plane", "replicas": 3}}
# Run tests via QA worker
TOOL_CALL: invoke_worker_tool
ARGUMENTS: {"target_role": "qa", "tool_name": "run_tests", "arguments": {"test_suite": "integration"}}
18. list_docker_containers(include_logs, log_lines) 🔍 NEW
Discover ALL containers and workers in the system. This is Doctor's "eyes on the entire Docker estate" — returns running + stopped containers, role-classified (doctor/devops/qa/se/po/pm/hr/data/infrastructure), and optionally with error lines attached.
Discovery strategy: tries local docker ps first, falls back to
orchestrator relay via GET /containers.
TOOL_CALL: list_docker_containers
ARGUMENTS: {"include_logs": true, "log_lines": 20}
19. get_container_inspect(container_name) 🔬 NEW
Deep inspection of any container — restart count, restart policy,
resource limits (memory/CPU), mounts, networks, env vars, labels.
Full docker inspect parsed into a clean structured dict.
TOOL_CALL: get_container_inspect
ARGUMENTS: {"container_name": "turing-worker-qa-ticket-42"}
20. tail_container_logs(container_name, tail, since) 📜 NEW
Stream log reader — fetches live logs from any container (even if Doctor has no local Docker socket), filters ERROR/WARN entries, returns structured entries with timestamps.
TOOL_CALL: tail_container_logs
ARGUMENTS: {"container_name": "turing_orchestrator", "tail": 50}
21. find_containers_by_role(role) 🎯 NEW
Find all containers matching a worker role. Uses list_docker_containers
internally so result is always fresh.
TOOL_CALL: find_containers_by_role
ARGUMENTS: {"role": "doctor"}
22. report_fix_success(ticket_id, fix_applied, classification) ✅
Record fix success to BookStack metrics + notify admin via Matrix.
23. report_fix_failure(ticket_id, diagnosis, reason) ❌
Record fix failure to BookStack metrics + notify admin via Matrix.
Self-Healing Pipeline (Deep Dive)
The run_self_healing_pipeline is Doctor's most powerful capability:
STEP 1: TRIAGE
- Categorize: PROJECT_BUG | LLM_BUG | INTEGRATION_ERROR | USER_ERROR
- Assess severity: P0 (critical) → P3 (low)
- Check urgency level
STEP 2: DIAGNOSE
- check_recent_errors() — find the actual error
- parse_docker_logs() — deep dive into container logs
- check_service_connectivity() — verify all dependencies
- check_system_health() — confirm resources aren't exhausted
STEP 3: CHECK KNOWLEDGE BASE
- query_known_issues_db() — has Doctor seen this before?
- If found: apply known fix, skip to VERIFY
- If new: proceed to ATTEMPT FIX
STEP 4: ATTEMPT FIX (orchestrator-mediated)
- run_fix_script() maps the fix name onto an allow-listed action and
POSTs it to {ORCHESTRATOR_URL}/remediation (no local script):
• "connection refused" / crash → restart_container (worker containers only)
• "OOM killed" → ask admin → restart_container / cleanup_docker [admin]
• "disk full" → check_disk_usage, then cleanup_docker [admin]
- Unmapped fix names short-circuit with a clear message (no local exec)
STEP 5: VERIFY
- verify_fix() — confirm the fix worked
- If failed: retry once with adjusted approach
- If still failed: ESCALATE
STEP 6: TRACK & LEARN
- track_metrics("fix_success_rate") — record outcome
- save_to_known_issues() — store new knowledge if fix succeeded
- update ticket status to RESOLVED or ESCALATED
STEP 7: REPORT
- Report back to user with full diagnosis
- If escalated: provide
---
*Content truncated.*
When not to use it
- →When the orchestrator is unreachable
- →For arbitrary config patching
Limitations
- →Fix-execution is orchestrator-mediated
- →Dynamic fix-script creation is disabled
How it compares
It uses an orchestrator-mediated remediation process with audit and RBAC, rather than running local scripts directly.
Compared to similar skills
doctor side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| doctor (this skill) | 0 | 2mo | Review | Advanced |
| debug-cluster | 2 | 8mo | Review | Intermediate |
| railway-deployment | 1 | 7mo | Review | Intermediate |
| mlops-engineer | 3 | 3mo | No flags | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
debug-cluster
openshift
Provides systematic debugging approaches for HyperShift hosted-cluster issues. Auto-applies when debugging cluster problems, investigating stuck deletions, or troubleshooting control plane issues.
railway-deployment
davila7
Manage Railway deployments - view logs, redeploy, restart, or remove deployments. Use for deployment lifecycle (remove, stop, redeploy, restart), deployment visibility (list, status, history), and troubleshooting (logs, errors, failures, crashes). NOT for deleting services - use railway-environment skill with isDeleted for that.
mlops-engineer
sickn33
Build comprehensive ML pipelines, experiment tracking, and model registries with MLflow, Kubeflow, and modern MLOps tools. Implements automated training, deployment, and monitoring across cloud platforms. Use PROACTIVELY for ML infrastructure, experiment management, or pipeline automation.
senior-devops
davila7
Comprehensive DevOps skill for CI/CD, infrastructure automation, containerization, and cloud platforms (AWS, GCP, Azure). Includes pipeline setup, infrastructure as code, deployment automation, and monitoring. Use when setting up pipelines, deploying applications, managing infrastructure, implementing monitoring, or optimizing deployment processes.
log-analyzer
mikopbx
Анализ логов Docker контейнера для диагностики проблем и мониторинга здоровья системы. Использовать при отладке ошибок, отслеживании процессов воркеров, исследовании проблем API или мониторинге поведения системы после тестов.
server-management
davila7
Server management principles and decision-making. Process management, monitoring strategy, and scaling decisions. Teaches thinking, not commands.