agentleFS
abdullahkhawerabdullahkhawer/devops-skills/skills/kubernetes-cli/SKILL.md

kubernetes-cli

Skill8 starsChanged 7 months agoApache-2.0View on GitHub

Perform Kubernetes operations using the kubectl CLI. Use for inspecting, managing, and troubleshooting workloads, nodes, and cluster resources across contexts.

  • Installs packages

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 4 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use the context table and rules below when constructing all kubectl commands.

    line 8
  2. Distinctive:

    Update the table below with your kubeconfig context names before using this skill:

    line 12
  3. Distinctive:

    If the target environment is unclear, ask the user before running any command.

    line 20
  4. Very specific:

    If kubectl is not installed or no context is configured for the target cluster, inform the user that setup is required and ask them to …

    line 24
  5. Very specific:

    Always pass --context and --namespace explicitly — never rely on the current context or namespace set in kubeconfig:

    line 35
  6. Distinctive:

    NEVER target a context not listed in the configuration table above.

    line 96
  7. Very specific:

    Always pass --context and --namespace explicitly on every command — never rely on the current kubeconfig context, as this may silently …

    line 97
  8. Distinctive:

    NEVER run commands in the "Never run" table above without explicit user instruction — this includes any command against a production …

    line 98
  9. Very specific:

    If a resource name, namespace, or context looks unfamiliar, look it up with a read-only command first (get, describe) before mutating.

    line 99
  10. Very specific:

    Prefer kubectl diff -f <file> before any apply to preview changes.

    line 100
  11. Very specific:

    NEVER print, display, or store the contents of Secrets (kubectl get secret -o yaml exposes base64-encoded values) — if a Secret must be …

    line 101
  12. Very specific:

    All list commands may be paginated or truncated by the API server for large clusters — use --chunk-size or narrow the query with label …

    line 102

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Kubernetes CLI Skill

Use the context table and rules below when constructing all kubectl commands.

Configuration

Update the table below with your kubeconfig context names before using this skill:

EnvironmentContext NameDefault Namespace
Production<your-prod-context><your-prod-namespace>
Staging / Non-Prod<your-nonprod-context><your-nonprod-namespace>
Sandbox / Dev<your-sandbox-context><your-sandbox-namespace>

If the target environment is unclear, ask the user before running any command.

Prerequisites (one-time setup by user)

If kubectl is not installed or no context is configured for the target cluster, inform the user that setup is required and ask them to complete the following steps manually. Do not perform these steps yourself.

brew install kubectl
aws eks update-kubeconfig --name <cluster-name> --profile <profile> --region <region> --alias <your-context-name>
# or for other providers, follow the provider-specific kubeconfig setup
kubectl config get-contexts

Command Format

Always pass --context and --namespace explicitly — never rely on the current context or namespace set in kubeconfig:

kubectl <command> --context <context-name> --namespace <namespace> [options]

Examples

# Production
kubectl get pods --context <your-prod-context> --namespace <your-prod-namespace>

# Staging / Non-Prod
kubectl get pods --context <your-nonprod-context> --namespace <your-nonprod-namespace>

Available Commands

Read-only (safe, no confirmation needed)

CommandDescription
get <resource> [name]List or show resources (pods, deployments, services, nodes, etc.)
describe <resource> <name>Show detailed information and recent events for a resource
logs <pod> [-c container] [--previous] [--tail=N]Show container logs
top nodes / top podsShow resource usage (requires metrics-server)
get events --sort-by=.lastTimestampShow recent cluster events
explain <resource>Show API resource schema documentation
api-resources / api-versionsList available resource types and API versions
config get-contexts / config current-contextInspect kubeconfig contexts
versionShow client and server version
cluster-infoShow cluster endpoint information
diff -f <file>Show what would change if a manifest were applied (dry run, no cluster mutation)
get <resource> -o yaml/jsonDump full resource manifest

Mutating operations (confirm with user before running)

CommandDescription
apply -f <file>Create or update resources from a manifest
create -f <file> / create <resource>Create a new resource
patch <resource> <name>Apply a strategic/JSON merge patch
scale <resource> <name> --replicas=NScale a deployment/statefulset/replicaset
rollout restart/undo <resource> <name>Restart or roll back a deployment
label / annotateAdd or modify labels/annotations
cordon <node> / uncordon <node>Mark a node unschedulable or schedulable

Never run — requires explicit human approval

CommandReason
delete <resource> <name>Irreversible deletion of a resource
delete namespace <name>Deletes the namespace and everything inside it
drain <node>Evicts all pods from a node, affecting live workloads
exec -it <pod> -- <command>Opens an interactive shell/session inside a running container
edit <resource> <name>Opens an interactive editor against a live resource
replace --force -f <file>Force-deletes and recreates a resource, causing downtime
taint <node>Alters node scheduling behavior cluster-wide

Rules

  • NEVER target a context not listed in the configuration table above. If a command references an unfamiliar context, stop and ask the user to confirm.
  • Always pass --context and --namespace explicitly on every command — never rely on the current kubeconfig context, as this may silently target the wrong cluster.
  • NEVER run commands in the "Never run" table above without explicit user instruction — this includes any command against a production context, even if listed as a mutating operation above.
  • If a resource name, namespace, or context looks unfamiliar, look it up with a read-only command first (get, describe) before mutating.
  • Prefer kubectl diff -f <file> before any apply to preview changes.
  • NEVER print, display, or store the contents of Secrets (kubectl get secret -o yaml exposes base64-encoded values) — if a Secret must be inspected, only confirm its existence and keys, not its values.
  • All list commands may be paginated or truncated by the API server for large clusters — use --chunk-size or narrow the query with label selectors (-l) if results seem incomplete.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.