Skip to main content
skill CX Codex

safe-sre-investigator — Claude Code skill: read-only GCP and K8s

safe-sre-investigator creates dedicated read-only service accounts for GCP and Kubernetes, then hands you gcloud and kubectl commands with a risk rating attached.

Apache-2.0 ★ 151 updated 2026-10-12

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add gemini-cli-extensions/sre
/plugin install sre-extension@sre
Open on GitHub

What safe-sre-investigator does

This skill builds a way for an agent to look around GCP and a Kubernetes cluster while holding no write access. Two wrappers come out of it, safe_gcloud and safe_kubectl, and every command it suggests gets a risk assessment block.

GCP setup is a one-time run per project: bash ./scripts/setup_safe_sre_investigator.sh PROJECT_ID. It is idempotent and drops ~/bin/safe_gcloud, so you may need to re-source your shell profile afterwards. Kubernetes is handled per cluster with bash ./scripts/setup_safe_kubectl.sh CLUSTER_NAME CLUSTER_LOCATION, which leaves a read-only ServiceAccount behind and writes a dedicated kubeconfig under ~/.kube/safe-investigator-configs/.

That second script expects credentials that can create ServiceAccounts and ClusterRoleBindings in the target cluster. A plain read-only account will not get past it. When you ask for something that writes, the skill returns the ordinary gcloud or kubectl line and warns you to run it under your own credentials. The roles it grants are spelled out in references/iam_roles.md and references/k8s_readonly_role.yaml.

What it helps with

  • scope an agent's GCP access down to reads
  • inspect a GKE cluster without write rights
  • list pods through a separate kubeconfig
  • see the risk of a command before running it
  • keep access to each cluster isolated

Example prompts for the agent

  • Set up safe_gcloud for project my-project
  • List pods in default with safe_kubectl my-cluster
  • Give me the gcloud command that lists GKE clusters plus its risk assessment

How to install safe-sre-investigator

1Plugin marketplace

/plugin marketplace add gemini-cli-extensions/sre
/plugin install sre-extension@sre

This installs the whole sre-extension plugin with all its skills

2Skills CLI (Vercel)

npx skills add gemini-cli-extensions/sre --skill safe-sre-investigator -a claude-code

3Manually: put the files in place

~/.claude/skills/safe-sre-investigator/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/safe-sre-investigator/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about safe-sre-investigator

How do I install safe-sre-investigator in Claude Code?

Add the marketplace first with /plugin marketplace add gemini-cli-extensions/sre, then install the plugin: /plugin install sre-extension@sre.

What does safe-sre-investigator do?

It sets up read-only service accounts for GCP and Kubernetes, wraps calls as safe_gcloud and safe_kubectl, and rates the risk of each command it recommends.

Do I need a separate Kubernetes setup for every cluster?

Yes. bash ./scripts/setup_safe_kubectl.sh CLUSTER_NAME CLUSTER_LOCATION runs once per cluster, since the ServiceAccount and kubeconfig live inside that cluster.

Source text

SKILL.md · Apache-2.0
---
name: safe-sre-investigator
description: 🐉 Sets up and uses read-only Service Accounts for GCP and Kubernetes investigations using the principle of least privilege, and provides risk assessments for suggested commands. Use when asked to investigate GCP/GKE resources or suggest gcloud/kubectl commands.
metadata:
    author: Riccardo Carlesso
    version: 1.0.8 
    status: draft
# See CHANGELOG.md for version history
---

# Safe SRE Investigator

This skill helps set up and use dedicated read-only Service Accounts for investigating GCP and Kubernetes resources.
It provides wrapper scripts `safe_gcloud` and `safe_kubectl` to ensure commands are run with these limited-privilege accounts.
When suggesting commands, it includes a risk assessment.


## Core Tasks

1.  **Setup GCP:** Initialize the GCP service account and `safe_gcloud` script.
2.  **Setup Kubernetes:** Initialize the Kubernetes service account and `safe_kubectl` script for a specific cluster.
3.  **Suggest Commands:** Provide `gcloud` or `kubectl` commands with risk assessments.

## 1. Setup GCP (`safe_gcloud`)

When first using this skill for a project, or if the user asks for setup, guide them through the one-time setup process for GCP access.

**Action:** Ask the user for the Project ID.

**Script:** Run the setup script:
```bash
bash ./scripts/setup_safe_sre_investigator.sh PROJECT_ID
```
*   This script is idempotent.
*   It creates `~/bin/safe_gcloud`.
*   The user might need to re-source their shell profile.
*   IAM roles are in `references/iam_roles.md`.

## 2. Setup Kubernetes (`safe_kubectl`)

This setup must be run for EACH Kubernetes cluster you want to investigate.

**Action:** Ask the user for the Cluster Name and Cluster Location (Zone or Region).

**Script:** Run the setup script:
```bash
bash ./scripts/setup_safe_kubectl.sh CLUSTER_NAME CLUSTER_LOCATION
```
*   This script needs to be run with user credentials that have permissions to create ServiceAccounts and ClusterRoleBindings in the target cluster.
*   It creates a read-only ServiceAccount in the cluster and generates a dedicated kubeconfig in `~/.kube/safe-investigator-configs/`.
*   It also creates `~/bin/safe_kubectl`.
*   The K8s roles are in `references/k8s_readonly_role.yaml`.

## 3. Suggesting Commands

When the user asks for a command:

*   **GCP:** Use `safe_gcloud PROJECT_ID <gcloud commands>`.
*   **Kubernetes:** Use `safe_kubectl CLUSTER_NAME -- <kubectl commands>`.
*   **Risk Assessment:** ALWAYS include a risk assessment block. See `references/risk_assessment.md`.
*   **Write Operations:** For commands requiring write access, provide the standard `gcloud` or `kubectl` command and warn the user to run it with their own credentials, noting the risks.

**Example `safe_gcloud`:**

```bash
# 🎬 Check GKE cluster status
# ⚠️ Risk: ⚪ NONE: This is a read-only operation.
safe_gcloud my-project container clusters list
```

**Example `safe_kubectl`:**

```bash
# 🎬 List pods in the default namespace
# ⚠️ Risk: ⚪ NONE: This is a read-only operation.
safe_kubectl my-cluster -- get pods -n default
```

## Bundled Resources

*   `scripts/setup_safe_sre_investigator.sh`: GCP setup.
*   `scripts/safe_gcloud_wrapper.sh`: Template for `~/bin/safe_gcloud`.
*   `scripts/setup_safe_kubectl.sh`: Kubernetes setup.
*   `scripts/safe_kubectl_wrapper.sh`: Template for `~/bin/safe_kubectl`.
*   `references/iam_roles.md`: GCP IAM roles.
*   `references/k8s_readonly_role.yaml`: Kubernetes ClusterRole definition.
*   `references/risk_assessment.md`: Risk assessment format.

© Riccardo Carlesso · Apache-2.0 · gemini-cli-extensions/sre

Similar skills

All skills for DevOps and infrastructure →

From the same set17

The whole set →
cloud-logging Skill for analyzing Google Cloud Logging and Error Reporting. Processes large JSON logs from GCP and converts them to Apache format for efficient analysis. CX Codex +1 ★ 151repo stars gcp-slo-management gcp-slo-management finds services in Google Cloud Monitoring and creates availability or latency SLOs over the REST API, where gcloud has no command for it. CX Codex +1 ★ 151repo stars gcp-playbooks gcp-playbooks is a Claude Code skill with SRE playbooks for investigating GCP incidents and running mitigations across GKE and Cloud Run. CX Codex +1 ★ 151repo stars pre-publish-checker pre-publish-checker audits project files for profanity, internal links, sensitive paths, and unfinished development markers. Use it when preparing code or an extension for public release. CX Codex +1 ★ 151repo stars cloud-monitoring Interacts with Google Cloud Monitoring through MCP, rendering ASCII sparklines and concise CSV summaries to prevent context bloat. CX Codex +1 ★ 151repo stars postmortem-aggregator postmortem-aggregator turns Post Mortem files in a folder into incident statistics and updates POMO_AGGREGATED.md. Use it to spot recurring causes across incidents. CX Codex +1 ★ 151repo stars gcp-mcp-setup gcp-mcp-setup — a skill for Claude Code, Codex, and Gemini CLI that wires up Google Managed MCP servers (OneMCP) to your CLI environment. It enables APIs, generates an API key, and writes the MCP config to the right settings file. CX Codex +1 ★ 151repo stars generic-mitigations generic-mitigations guides your agent to halt production outages quickly using standard SRE strategies before diving into root-cause analysis. CX Codex +1 ★ 151repo stars

Project sponsors

Companies that keep this analytics open