kubernetes-optimizer
Skill1 starsChanged 8 days agoMITView on GitHub
Audit and optimize Kubernetes manifests and workloads (Kubernetes 1.37 current, 1.36/1.35 supported, 1.34 EOL) for requests/limits and scheduling, probes and lifecycle, securityContext/Pod Security/RBAC, Services/Ingress/NetworkPolicy, HPA/PDB/autoscaling and cost, observability, deprecated APIs and safe upgrades, with real before/after measurement. Always produces a written findings report and a fix plan for approval before touching code. Use this whenever the user mentions Kubernetes manifests, Helm/Kustomize, resource requests/limits, OOMKilled/CrashLoopBackOff, readiness/liveness probes, HPA/PDB, NetworkPolicy, RBAC, Pod Security, cluster upgrades, K8s cost, or "optimize my Kubernetes setup" -- even if they never say audit or optimize.
In this repository44 other files it gives its agents.
- AGENTS.mdAGENTS.md
- architecture-optimizerSkill
- csharp-optimizerSkill
- cpp-optimizerSkill
- c-optimizerSkill
- go-optimizerSkill
- node-service-optimizerSkill
- ruby-optimizerSkill
- rust-optimizerSkill
- docker-optimizerSkill
- terraform-optimizerSkill
- animate-cssSkill
- animejsSkill
- auto-animateSkill
- gsapSkill
- lenisSkill
- magicuiSkill
- motionSkill
- react-moveSkill
- react-springSkill
- react-three-fiberSkill
- theatrejsSkill
- threejsSkill
- optimizer-routerSkill
- bootstrap-optimizerSkill
- pandacss-optimizerSkill
- sass-scss-optimizerSkill
- stylex-optimizerSkill
- tailwindcss-optimizerSkill
- twind-optimizerSkill
- unocss-optimizerSkill
- vanilla-extract-optimizerSkill
- angular-optimizerSkill
- astro-optimizerSkill
- ui-components-optimizerSkill
- nextjsSkill
- node-optimizerSkill
- nuxt-optimizerSkill
- react-optimizerSkill
- remix-optimizerSkill
- solid-optimizerSkill
- svelte-optimizerSkill
- tanstack-start-optimizerSkill
- vue-optimizerSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Run python <skill-dir>/scripts/audit.py <repo-root> -- static scan for floating images, missing probes/resources/securityContext, …
- Very specific: line 17
Read references/upgrades-tooling.md once: what can be measured here (kubectl, metrics-server, kube-state-metrics, scans, cost tools).
- Very specific: line 32
Measure, never guess: Read the live objects (kubectl get/describe), metrics (CPU/memory throttling, OOMKills, restarts, pending pods), …
- Very specific: line 42
Use plan mode: EnterPlanMode (load with ToolSearch if deferred), write the plan, present with ExitPlanMode.
- Distinctive: line 65
Upgrade one minor at a time: Check deprecated APIs and add-on compatibility before the control plane moves.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.
Files
Kubernetes Optimizer
Audit a Kubernetes workload/config, report what is unsafe, unreliable or expensive and why, agree a plan, then change it. Order: evidence, approval, edits. Cluster changes can cause outages; nothing is applied before approval.
Workflow
1. Scope (quick)
- Find the manifests/Helm/Kustomize and record: cluster version (1.37 current; 1.36/1.35 supported; 1.34 EOL), distribution, ingress/CNI/CSI, autoscaler, workload types, namespaces and environment.
- Run
python <skill-dir>/scripts/audit.py <repo-root>-- static scan for floating images, missing probes/resources/securityContext, privileged/host access, deprecated APIs, missing PDB/NetworkPolicy/HPA, secrets in env and risky Services/Ingress, with file:line evidence. Use--jsonto post-process. - Classify the pain: reliability (OOM/crash/restarts), latency/throughput, scheduling/capacity, security/compliance, cost, or upgrade risk. Ask which hurts if unclear.
- Read
references/upgrades-tooling.mdonce: what can be measured here (kubectl, metrics-server, kube-state-metrics, scans, cost tools).
2. Audit
The script finds cheap leads; you find the rest by reading the manifests and the live cluster. Load only what applies:
| Area | Reference |
| Deployments/StatefulSets, probes, requests/limits, lifecycle, PDB, topology | references/workloads.md |
| Services, Ingress, NetworkPolicy, DNS, mTLS | references/networking.md |
| securityContext, Pod Security, RBAC, secrets, admission | references/security.md |
| HPA/VPA/autoscaling, scheduling, capacity and cost | references/scaling-cost.md |
| Metrics, logs, traces, events, SLOs and alerts | references/observability.md |
| API deprecations, cluster upgrades, validation/scanning tools | references/upgrades-tooling.md |
Measure, never guess. Read the live objects (kubectl get/describe), metrics (CPU/memory throttling, OOMKills, restarts, pending pods), events and traces. A YAML review without cluster evidence is a hypothesis; a healthy pod at low load is not capacity proof.
Mark each finding Confirmed (kubectl/metrics/event/code evidence) or Suspected (needs measuring).
3. Report
Fill assets/report-template.md, save it as KUBERNETES_OPTIMIZATION_REPORT.md in the repo root, and show the user. Five-line summary, findings table by impact/effort/risk, then per-finding detail (evidence, why it hurts, fix, risk, rollout/rollback). Group near-duplicates.
4. Plan -- then stop for approval
Use plan mode: EnterPlanMode (load with ToolSearch if deferred), write the plan, present with ExitPlanMode; if unavailable show it in chat and wait for an explicit "go". Structure:
- Quick wins -- pin images, set requests/limits, add readiness/startup probes, securityContext, PDB, NetworkPolicy, HPA, fix deprecated APIs. Low risk, manifest-only.
- Structural -- right-size requests from metrics, split workloads, topology spread/anti-affinity, HPA/VPA strategy, ingress/TLS, RBAC least privilege, resource quotas, cost labels. Name each behavior change.
- Heavy -- cluster upgrade, CNI/CSI/ingress replacement, autoscaler migration, multi-cluster/multi-tenant architecture. Separately approved with a staged rollout. Each step: files/cluster objects touched, expected effect, how to verify, how to roll back.
5. Fix
Only approved items, in small groups. After each: kubectl diff/server-side dry-run, policy/scan checks, rollout status, and the relevant metrics. A break must trace to one change. Do not mix a cluster upgrade with workload optimization. If a change alters availability (PDB/replicas), security posture, or network reachability, stop and ask.
6. Verify and wrap up
Re-check the same objects/metrics: restarts/OOMKills, pending pods, CPU throttling, p95/p99 latency, availability during rollout, HPA behavior, cost. State plainly what could not be measured. End with deferred items and one suggested next step.
Principles
- Requests are scheduling; limits are enforcement. Set requests from measured usage, not guesses.
- Probes must reflect readiness, not liveness theater. Startup protects slow boots; readiness removes traffic; liveness restarts only true hangs.
- Least privilege by default. Non-root, no privilege escalation, read-only rootfs, dropped capabilities, scoped RBAC.
- Availability is a budget. PDB, replicas, topology spread and graceful termination are part of correctness.
- Network is deny-by-default where possible. NetworkPolicy + explicit ingress/egress.
- Autoscaling needs signals. HPA on meaningful metrics, requests set, and a node autoscaler that can react.
- Upgrade one minor at a time. Check deprecated APIs and add-on compatibility before the control plane moves.
- Cost is a workload property. Requests, replicas, storage class and idle capacity have owners.
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
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.

