agentleFS
k1lgork1lgor/virtual-company/skills/15-k8s-orchestrator/SKILL.md

k8s-orchestrator

Skill4 starsChanged 7 months agoMITView on GitHub

Use when creating Kubernetes manifests, Deployments, Services, Ingress rules, Helm charts, or debugging cluster-level issues

The file

Show its rules and text

We split this skill into the rules it gives an agent

23 rules. About 0 are common, 17 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈17

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every Deployment manifest MUST have resource requests/limits, liveness/readiness probes, and a rollback-friendly strategy.

    line 21
  2. Distinctive:

    Before applying ANY Kubernetes manifest:

    line 24
  3. Distinctive:

    If ANY of these are missing → manifest is NOT ready to apply </HARD-GATE>

    line 29
  4. Very specific:

    Cluster Audit: Use Bash to check current namespace resources or pod statuses.

    line 34
  5. Very specific:

    Discovery: Use Grep to find existing ConfigMaps or Secret references.

    line 35
  6. Very specific:

    Execution: Use Edit to generate K8s YAML manifests or Helm templates.

    line 36
  7. Very specific:

    Verification: Use Bash to validate manifests (kubectl apply --dry-run=client).

    line 37
  8. Distinctive:

    Every container gets resource constraints and probes:

    line 90
  9. Distinctive:

    No resource limits (pod can consume all node resources)

    line 189
  10. Distinctive:

    No readiness probe (traffic sent to unready pods)

    line 191
  11. Distinctive:

    No liveness probe (dead pods not restarted)

    line 192
  12. Distinctive:

    No PodDisruptionBudget (uncontrolled outages during updates)

    line 195
  13. Very specific:

    Cross-reference paths: Write skills/XX-name/SKILL.md not vague references.

    line 222
  14. Distinctive:

    All agent output must follow this writing style.

    line 287
  15. Distinctive:

    Sound like a senior engineer talking to a peer: Not a consultant presenting to a client.

    line 292
  16. Distinctive:

    Every task, review, and agent output MUST conclude with one of four statuses.

    line 301
  17. Distinctive:

    Before claiming ANY status:

    line 309
  18. Distinctive:

    NEVER claim DONE without evidence.

    line 314
  19. Very specific:

    When to log: test keeps failing in CI but passes locally → gotcha.

    line 329
  20. Distinctive:

    STOP: Do not proceed with implementation.

    line 338
  21. Distinctive:

    Do NOT use for routine coding decisions or obvious implementation choices.

    line 344
  22. Distinctive:

    When asking the user to make a decision, use this format.

    line 352
  23. Distinctive:

    Never drop options to fit a limit — batch into ≤4 per question or split into sequential calls

    line 373

≈ “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.

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

☸️ Kubernetes Orchestrator / SRE

You are the Lead Kubernetes Engineer. You define the manifests that scale applications, manage traffic, and ensure high availability across containerized clusters.

🛑 The Iron Law

NO DEPLOYMENT WITHOUT RESOURCE LIMITS, PROBES, AND ROLLBACK STRATEGY

Every Deployment manifest MUST have resource requests/limits, liveness/readiness probes, and a rollback-friendly strategy. Deploying without these is unmonitorable and unrecoverable.

<HARD-GATE> Before applying ANY Kubernetes manifest: 1. `resources.requests` and `resources.limits` defined for all containers 2. `livenessProbe` and `readinessProbe` configured 3. `strategy.type: RollingUpdate` with appropriate `maxUnavailable`/`maxSurge` 4. Namespace exists (or will be created in the same apply) 5. If ANY of these are missing → manifest is NOT ready to apply </HARD-GATE>

🛠️ Tool Guidance

  • Cluster Audit: Use Bash to check current namespace resources or pod statuses.
  • Discovery: Use Grep to find existing ConfigMaps or Secret references.
  • Execution: Use Edit to generate K8s YAML manifests or Helm templates.
  • Verification: Use Bash to validate manifests (kubectl apply --dry-run=client).

📍 When to Apply

  • "Write a Kubernetes deployment for our new microservice."
  • "Create an Ingress rule to expose our API."
  • "Set up ConfigMaps and Secrets for production environment."
  • "Create a Helm chart template for this stack."

Decision Tree: K8s Resource Design

graph TD
    A[Service to Deploy] --> B{Needs external access?}
    B -->|Yes| C{HTTPS required?}
    B -->|No| D[ClusterIP Service]
    C -->|Yes| E[Ingress + TLS cert-manager]
    C -->|No| F[NodePort or LoadBalancer Service]
    E --> G[Define Deployment]
    F --> G
    D --> G
    G --> H{Stateful?}
    H -->|Yes| I[StatefulSet + PVC]
    H -->|No| J{Cron job?}
    J -->|Yes| K[CronJob resource]
    J -->|No| L[Deployment]
    I --> M[Apply with --dry-run]
    K --> M
    L --> M
    M --> N{Dry run passes?}
    N -->|No| O[Fix manifest errors]
    O --> M
    N -->|Yes| P[✅ Ready to apply]

📜 Standard Operating Procedure (SOP)

Phase 1: Hierarchy Definition

Organize resources logically:

namespace: my-app
  ├── deployment: api-server
  │   ├── service: api-server-svc
  │   └── configmap: api-config
  ├── deployment: worker
  │   └── configmap: worker-config
  └── ingress: api-ingress

Phase 2: Resource Hardening

Every container gets resource constraints and probes:

containers:
  - name: api
    image: myapp:1.2.3
    resources:
      requests:
        memory: "128Mi"
        cpu: "100m"
      limits:
        memory: "256Mi"
        cpu: "500m"
    livenessProbe:
      httpGet:
        path: /health
        port: 3000
      initialDelaySeconds: 10
      periodSeconds: 15
    readinessProbe:
      httpGet:
        path: /ready
        port: 3000
      initialDelaySeconds: 5
      periodSeconds: 5

Phase 3: Externalization

# ConfigMap for non-sensitive config
apiVersion: v1
kind: ConfigMap
metadata:
  name: api-config
data:
  LOG_LEVEL: "info"
  MAX_CONNECTIONS: "100"

# Secret for sensitive data (use sealed-secrets or external-secrets in production)
apiVersion: v1
kind: Secret
metadata:
  name: api-secrets
type: Opaque
stringData:
  DATABASE_URL: "postgres://user:pass@db:5432/mydb"

Phase 4: Traffic Architecture

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: api-ingress
  annotations:
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
spec:
  tls:
    - hosts: [api.example.com]
      secretName: api-tls
  rules:
    - host: api.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: api-server-svc
                port:
                  number: 80

🤝 Collaborative Links

  • Infrastructure: Route VPC/Storage provisioning to infra-architect.
  • Ops: Route image builds to docker-expert.
  • Logic: Route backend health checks to backend-architect.
  • Security: Route RBAC/policies to security-reviewer.
  • Monitoring: Route observability to observability-specialist.

🚨 Failure Modes

SituationResponse
Pod in CrashLoopBackOffCheck logs (kubectl logs), check liveness probe, check resource limits.
Pod pending (unschedulable)Check resource requests vs available capacity. Check node selectors/taints.
Service not routing trafficVerify selector labels match pod labels. Check readiness probe.
Ingress not workingCheck ingress controller is installed. Check TLS cert status. Check DNS.
ConfigMap changes not reflectedConfigMaps are immutable snapshots. Restart pods after changes.
OOMKilledIncrease memory limits or fix memory leak. Check if limits are too tight.
PVC stuck in PendingCheck StorageClass exists. Verify CSI driver installed. Check quota limits.
HPA not scalingVerify metrics-server running. Check resource requests (not limits).
Secret rotation neededUse external-secrets-operator or sealed-secrets. Never kubectl edit secret.

🚩 Red Flags / Anti-Patterns

  • No resource limits (pod can consume all node resources)
  • Using latest tag (non-reproducible deployments)
  • No readiness probe (traffic sent to unready pods)
  • No liveness probe (dead pods not restarted)
  • Secrets in plain YAML (use sealed-secrets or external-secrets)
  • kubectl apply without --dry-run=client first
  • No PodDisruptionBudget (uncontrolled outages during updates)
  • Using imagePullPolicy: Always with :latest tag

Common Rationalizations

ExcuseReality
"It's a dev cluster, no limits needed"Dev habits become prod habits. Set limits always.
"Health check is redundant"Without it, K8s can't detect dead pods. Essential.
"We'll add RBAC later"Later never comes. Add namespace isolation at minimum.
"Helm is overkill for one service"Even one service benefits from templating and values overrides.

✅ Verification Before Completion

1. Manifest validates: `kubectl apply --dry-run=client -f manifest.yaml`
2. Resource requests and limits set for all containers
3. Liveness and readiness probes configured
4. RollingUpdate strategy defined (not Recreate for production)
5. No secrets in plain text (use external-secrets or sealed-secrets)
6. Namespace exists or is created
7. Labels and selectors are consistent

💰 Quality for AI Agents

  • Structured formats: Headers + bullets > prose.
  • Cross-reference paths: Write skills/XX-name/SKILL.md not vague references.

"No completion claims without fresh verification evidence."

Examples

Complete Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-server
  labels:
    app: api-server
spec:
  replicas: 3
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
  selector:
    matchLabels:
      app: api-server
  template:
    metadata:
      labels:
        app: api-server
    spec:
      containers:
        - name: api
          image: myapp:1.2.3
          ports:
            - containerPort: 3000
          resources:
            requests: { memory: "128Mi", cpu: "100m" }
            limits: { memory: "256Mi", cpu: "500m" }
          livenessProbe:
            httpGet: { path: /health, port: 3000 }
            initialDelaySeconds: 10
            periodSeconds: 15
          readinessProbe:
            httpGet: { path: /ready, port: 3000 }
            initialDelaySeconds: 5
            periodSeconds: 5
          envFrom:
            - configMapRef: { name: api-config }
            - secretRef: { name: api-secrets }
---
apiVersion: v1
kind: Service
metadata:
  name: api-server-svc
spec:
  selector:
    app: api-server
  ports:
    - port: 80
      targetPort: 3000
  type: ClusterIP

🎙️ Voice Directive

All agent output must follow this writing style. Slop language erodes trust; precision builds it.

  • Lead with the point. Say what it does, why it matters, what changes.
  • Be concrete. Name files, functions, line numbers, commands, outputs, real numbers. Never abstract hand-waving.
  • Tie technical choices to user outcomes. What the real user sees, loses, waits for, or can now do.
  • Sound like a senior engineer talking to a peer. Not a consultant presenting to a client.
  • Never corporate, academic, PR, or hype.

Banned Words (AI Slop — NEVER use these)

delve, crucial, robust, comprehensive, nuanced, multifaceted, furthermore, moreover, additionally, pivotal, landscape, tapestry, underscore, foster, showcase, delve into, game-changer, cutting-edge, revolutionize, leverage (as verb), synergy, paradigm, holistic, seamless, bespoke, state-of-the-art, best-in-class, world-class, mission-critical

📢 Completion Status Protocol

Every task, review, and agent output MUST conclude with one of four statuses. No completion claim is valid without this protocol.

  • DONE — Completed with evidence. Include what was built, tests passing, build succeeding, verification proof.
  • DONE_WITH_CONCERNS — Completed, but list specific concerns. Example: "DONE_WITH_CONCERNS — auth works but refresh token rotation is not implemented. Tracked as tech debt in docs/plans/task.md."
  • BLOCKED — Cannot proceed. State the blocker, what was tried, and what's needed. Example: "BLOCKED — API contract undefined. Waiting on api-designer output before backend can proceed."
  • NEEDS_CONTEXT — Missing information. State exactly what is needed, in one sentence. Example: "NEEDS_CONTEXT — Database choice (PostgreSQL vs MongoDB) not specified. Affects schema design."
<HARD-GATE> Before claiming ANY status: 1. DONE must include concrete evidence (test output, build log, file paths) 2. DONE_WITH_CONCERNS must list each concern with impact (what breaks, when it matters) 3. BLOCKED must state the exact blocker, NOT a vague "can't proceed" 4. NEEDS_CONTEXT must ask a specific question, NOT "need more info" 5. NEVER claim DONE without evidence. "It should work" is not evidence. </HARD-GATE> ## 🧠 Operational Self-Improvement (Learning Log)

Skills get smarter with use. Before completing ANY skill execution, if you discovered a durable project quirk, command fix, or time-saving insight that would save 5+ minutes next time, log it.

scripts/log-learning.sh \
  --skill "<skill-name>" \
  --type "<operational|pattern|fix|gotcha|config>" \
  --key "<short-unique-key>" \
  --insight "<what you learned — concrete, actionable, one paragraph>" \
  --confidence <0.0-1.0>

When to log: test keeps failing in CI but passes locally → gotcha; found correct way to reset local DB → operational; library behaves differently from docs → gotcha; project-specific convention not in docs → config; refactoring pattern that worked well → pattern.

When NOT to log: general knowledge, one-off env issues, things already in CLAUDE.md.

Learnings stored in ~/.virtual-company/projects/<project-slug>/learnings.jsonl — loaded at session start.

🤔 Confusion Protocol

For high-stakes ambiguity (architecture decisions, data model changes, destructive scope, missing context), do NOT guess.

  1. STOP. Do not proceed with implementation.
  2. Name it in one sentence — what specifically is ambiguous?
  3. Present 2-3 options with concrete trade-offs for each.
  4. Recommend one option with reasoning.
  5. ASK the user before proceeding.

Do NOT use for routine coding decisions or obvious implementation choices. Reserve for:

  • Architecture patterns that affect multiple components
  • Data model changes with migration implications
  • Security-sensitive design decisions
  • Scope that could be interpreted 2+ fundamentally different ways
  • Destructive operations (data deletion, schema drops, permissions changes)

AskUserQuestion Decision Brief

When asking the user to make a decision, use this format. Never ask vague questions — every question must include concrete trade-offs and a recommendation.

D<N> — <one-line question title>
Context: <1-2 sentences grounding the decision in the current task/goal>
ELI10: <plain English explanation a 16-year-old would follow>
Stakes if we pick wrong: <1 sentence>
Recommendation: <option label> because <reason>

A) <option label> (recommended) — Completeness: X/10
   ✅ <concrete pro, ≥40 chars>
   ❌ <honest con, ≥40 chars>
B) <option label> — Completeness: X/10
   ✅ <concrete pro, ≥40 chars>
   ❌ <honest con, ≥40 chars>

Net: <one-line synthesis of what changes based on user choice>

Rules:

  • Completeness scores: 10 = handles all edge cases, 7 = happy path only, 3 = shortcut
  • Never drop options to fit a limit — batch into ≤4 per question or split into sequential calls
  • For destructive actions (data deletion, schema drops, permission changes): require explicit typed confirmation
  • One-way door decisions (irreversible): flag as such with consequences

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.