ワンクリックで
infra-monitor
Monitor Kubernetes cluster health and create fix PRs via Claude Code for GitOps-fixable issues.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Monitor Kubernetes cluster health and create fix PRs via Claude Code for GitOps-fixable issues.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Generate a DrawIO cloud-architecture diagram (generic, Azure, or AWS) from a natural-language description. Always writes a `.drawio.png` — a PNG with the editable mxfile XML embedded in a PNG text chunk, so the same file renders inline in markdown and opens as an editable diagram in app.diagrams.net or drawio-desktop. Provider is auto-detected from the description; GCP is not supported.
Find Renovate dependency update PRs with failing CI and fix them using Claude Code.
Refactor and test recent changes across all repos with publishable changes, ship PRs with auto-merge, then monitor CI and auto-fix failures until merged.
Review the pending diff on the current branch for security issues (injection, authz, secrets, crypto misuse, SSRF, XSS, etc.) and apply fixes. Runs on the current repo by default; pass "all" to fan out across every accessible repo with pending changes. Stops before commit; pair with /publish to ship.
Create a GitHub repository from template with full configuration (merge settings, branch protection, profile READMEs).
Review the pending diff on the current branch for documentation drift (README, docs/, CHANGELOG, docstrings, inline comments, config examples) and apply updates. Runs on the current repo by default; pass "all" to fan out across every accessible repo with pending changes. Stops before commit; pair with /publish to ship.
| name | infra-monitor |
| description | Monitor Kubernetes cluster health and create fix PRs via Claude Code for GitOps-fixable issues. |
| user-invocable | false |
| allowed-tools | Bash, Read, Glob, Grep, Edit, Write, Agent, Skill |
Monitors Kubernetes cluster health by collecting pod status, events, node metrics, and Prometheus alerts. If issues are detected, clones the GitOps repo and creates a fix PR.
Required env vars: GH_TOKEN, CLAUDE_CODE_OAUTH_TOKEN,
REPO (GitOps repo owner/repo), PROMETHEUS_URL.
Verify required env vars and configure git for the CI runner:
[[ -n "$GH_TOKEN" && -n "$CLAUDE_CODE_OAUTH_TOKEN" \
&& -n "$REPO" && -n "$PROMETHEUS_URL" ]] \
|| { echo "Missing required env vars"; exit 1; }
git config --global user.name "claude-code-bot"
git config --global user.email "claude-code-bot@users.noreply.github.com"
git config --global url."https://x-access-token:${GH_TOKEN}@github.com/".insteadOf "https://github.com/"
Run these commands and read the output directly. Partial data is fine — continue on any individual failure.
echo '=== Non-Running Pods ==='
kubectl get pods -A --field-selector 'status.phase!=Running,status.phase!=Succeeded' 2>&1 || true
echo; echo '=== Recent Warning Events ==='
kubectl get events -A --field-selector type=Warning --sort-by='.lastTimestamp' 2>&1 | tail -50 || true
echo; echo '=== Node Status ==='
kubectl get nodes -o wide 2>&1 || true
kubectl top nodes 2>&1 || true
echo; echo '=== Pod Resource Usage (top 20 by memory) ==='
kubectl top pods -A --sort-by=memory 2>&1 | head -20 || true
echo; echo '=== Prometheus Alerts Firing ==='
curl -sf "${PROMETHEUS_URL}/api/v1/alerts" \
| jq -r '
.data.alerts[]
| select(.state=="firing")
| "\(.labels.alertname) [\(.labels.severity)] - \(.annotations.summary // .annotations.description // "no description")"
' 2>/dev/null || true
echo; echo '=== High Restart Count Pods (>3) ==='
kubectl get pods -A -o json \
| jq -r '
.items[]
| select(.status.containerStatuses[]?.restartCount > 3)
| "\(.metadata.namespace)/\(.metadata.name) restarts=\(.status.containerStatuses[].restartCount)"
' 2>/dev/null || true
Inspect the output for non-running pods (skip header/empty lines) and firing Prometheus alerts. If nothing is found, log "Cluster healthy, no action needed" and exit.
workdir="/workspace/$(echo "$REPO" | tr '/' '-')"
rm -rf "$workdir"
git clone --depth=1 "https://github.com/${REPO}.git" "$workdir"
cd "$workdir"
branch="fix/infra-monitor-$(date +%Y%m%d-%H%M%S)"
git checkout -b "$branch"
Use the Agent tool with the cluster state from Step 2 as input. Prompt:
You are a Kubernetes cluster monitor for a bare-metal Talos Linux cluster managed by ArgoCD GitOps. Working directory:
<workdir>, already on a fix branch.Here is the current cluster state:
<cluster state from Step 2>Analyze the cluster state and identify issues that can be fixed via GitOps changes in this repo. Focus on:
- Pods in CrashLoopBackOff, Error, or Pending state
- Firing Prometheus alerts indicating misconfigurations
- Resource limit/request mismatches causing OOMKills
- Configuration issues visible in events
For each fixable issue, make the minimal targeted change in the appropriate Kubernetes manifest. Do not refactor unrelated code. Do not fix issues that require manual intervention outside GitOps. If there are no GitOps-fixable issues, do nothing.
After making changes, stage them with
git add. Do not commit or push; the lead will handle that.
Allowed tools for the sub-agent: Bash, Read, Edit, Write, Glob, Grep.
After the sub-agent returns:
git diff --cached --quiet && echo "no changes" || echo "changes staged"
rm -rf "$workdir" and report
"no GitOps-fixable issues found"./ship via the Skill tool with message
fix: infra-monitor auto-remediation $(date +%Y-%m-%d). Capture the
PR URL from the output.Print a summary: