Skip to content

SIDDARTHA577/envguard-node / .agents/skills/envguard-load-test

envguard-load-test

Verified

Guides capacity planning, workload profile design, local performance benchmarking, and threshold validation without fabricating production metrics or executing unauthorized traffic.

FileKindSize
SKILL.mdskill md7.7 KB
scripts/readiness-auditor.mjsscript27.1 KB
scripts/readiness/adapters/android-adapter.mjsscript30.0 KB
scripts/readiness/adapters/base-adapter.mjsscript4.6 KB
scripts/readiness/adapters/flutter-adapter.mjsscript28.9 KB
scripts/readiness/adapters/generic-adapter.mjsscript15.9 KB
scripts/readiness/adapters/index.mjsscript661 B
scripts/readiness/adapters/ios-adapter.mjsscript21.0 KB
scripts/readiness/adapters/java-spring-adapter.mjsscript39.9 KB
scripts/readiness/adapters/nextjs-react-adapter.mjsscript30.5 KB
scripts/readiness/adapters/node-typescript-adapter.mjsscript115.8 KB
scripts/readiness/adapters/python-adapter.mjsscript44.0 KB
scripts/readiness/adapters/react-native-adapter.mjsscript34.6 KB
scripts/readiness/adapters/registry.mjsscript3.7 KB
scripts/readiness/architecture/applicability.mjsscript21.8 KB
scripts/readiness/architecture/architecture-inventory.mjsscript16.9 KB
scripts/readiness/architecture/architecture-reporter.mjsscript9.4 KB
scripts/readiness/architecture/capacity-model.mjsscript16.9 KB
scripts/readiness/architecture/design-decisions.mjsscript42.0 KB
scripts/readiness/architecture/failure-modes.mjsscript13.3 KB
scripts/readiness/architecture/index.mjsscript895 B
scripts/readiness/architecture/requirements.mjsscript22.0 KB
scripts/readiness/architecture/tradeoffs.mjsscript4.5 KB
scripts/readiness/capacity/benchmark-runner.mjsscript13.4 KB
scripts/readiness/constants.mjsscript6.0 KB
scripts/readiness/deployment/cicd-gate-validator.mjsscript6.1 KB
scripts/readiness/deployment/container-validator.mjsscript10.1 KB
scripts/readiness/deployment/deployment-gate.mjsscript4.8 KB
scripts/readiness/deployment/index.mjsscript411 B
scripts/readiness/deployment/k8s-validator.mjsscript8.8 KB
scripts/readiness/deployment/reliability-validator.mjsscript9.4 KB
scripts/readiness/engine/discovery.mjsscript15.4 KB
scripts/readiness/engine/index.mjsscript341 B
scripts/readiness/engine/orchestrator.mjsscript21.0 KB
scripts/readiness/engine/planner.mjsscript4.2 KB
scripts/readiness/engine/sarif.mjsscript12.7 KB
scripts/readiness/engine/skills-selector.mjsscript10.0 KB
scripts/readiness/execution/git.mjsscript2.3 KB
scripts/readiness/execution/runner.mjsscript11.9 KB
scripts/readiness/index.mjsscript516 B
scripts/readiness/orchestration/engineering-workflow.mjsscript18.5 KB
scripts/readiness/orchestration/index.mjsscript170 B
scripts/readiness/policies/index.mjsscript189 B
scripts/readiness/policies/release-policy.mjsscript9.5 KB
scripts/readiness/remediation/checkpoint-manager.mjsscript34.0 KB
scripts/readiness/remediation/diff-viewer.mjsscript2.5 KB
scripts/readiness/remediation/index.mjsscript778 B
scripts/readiness/remediation/patch-generator.mjsscript17.5 KB
scripts/readiness/remediation/remediation-runner.mjsscript9.9 KB
scripts/readiness/reporters/comparator.mjsscript20.7 KB
scripts/readiness/reporters/index.mjsscript293 B
scripts/readiness/reporters/json-reporter.mjsscript193 B
scripts/readiness/reporters/markdown-reporter.mjsscript18.8 KB
scripts/readiness/validation/evidence-matrix.mjsscript21.5 KB
scripts/readiness/validation/independent-app-runner.mjsscript26.2 KB
scripts/readiness/validation/index.mjsscript328 B

scripts/readiness/deployment/k8s-validator.mjs

View on GitHub
import fs from 'node:fs';
import path from 'node:path';

/**
 * Validates Kubernetes manifests for production deployment readiness.
 * Evaluates health probes (liveness/readiness), resource limits, security contexts,
 * and high-availability replica counts.
 *
 * @param {string} projectDir - Root project directory
 * @param {string[]} [files=[]] - Relative project files list
 * @returns {object[]} Array of Kubernetes deployment findings
 */
export function validateKubernetesManifests(projectDir, files = []) {
  const findings = [];

  // Filter potential k8s manifest files
  const k8sFiles = files.filter((f) => {
    const ext = path.extname(f).toLowerCase();
    if (ext !== '.yaml' && ext !== '.yml') return false;
    const lower = f.toLowerCase().replace(/\\/g, '/');
    return (
      lower.includes('k8s') ||
      lower.includes('deploy') ||
      lower.includes('manifest') ||
      lower.includes('helm') ||
      lower.includes('chart') ||
      path.basename(lower).startsWith('deployment')
    );
  });

  const parsedWorkloads = [];

  for (const relPath of k8sFiles) {
    const fullPath = path.join(projectDir, relPath);
    let content;
    try {
      content = fs.readFileSync(fullPath, 'utf8');
    } catch {
      continue;
    }

    // Check if it looks like a Kubernetes workload manifest
    if (
      content.includes('apiVersion:') &&
      (content.includes('kind: Deployment') ||
        content.includes('kind: StatefulSet') ||
        content.includes('kind: DaemonSet') ||
        content.includes('kind: Pod'))
    ) {
      parsedWorkloads.push({
        file: relPath,
        content,
        isDeployment: content.includes('kind: Deployment'),
        isStatefulSet: content.includes('kind: StatefulSet'),
      });
    }
  }

  if (parsedWorkloads.length === 0) {
    findings.push({
      id: 'DEP-K8S-000',
      category: 'deployment',
      status: 'NOT_APPLICABLE',
      severity: 'info',
      title: 'Kubernetes Manifests Not Detected',
      explanation: 'No Kubernetes workload manifests (Deployments, StatefulSets) found in repository.',
      evidence: { file: null },
      checkMethod: 'static_analysis',
      recommendation: 'If targeting Kubernetes, ensure manifests configure liveness/readiness probes and explicit resource boundaries.',
      manualVerificationRequired: false,
      confidence: 'verified_fact',
    });
    return findings;
  }

  for (const workload of parsedWorkloads) {
    const { file, content } = workload;

    // 1. Health Probes (DEP-K8S-001)
    const hasReadinessProbe = content.includes('readinessProbe:');
    const hasLivenessProbe = content.includes('livenessProbe:');

    if (hasReadinessProbe && hasLivenessProbe) {
      findings.push({
        id: 'DEP-K8S-001',
        category: 'deployment',
        status: 'PASS',
        severity: 'info',
        title: 'Kubernetes Health Probes Configured',
        explanation: `Manifest "${file}" defines both readinessProbe and livenessProbe.`,
        evidence: { file },
        checkMethod: 'static_analysis',
        recommendation: 'Ensure readiness probe checks database readiness while liveness probe checks process health only.',
        manualVerificationRequired: false,
        confidence: 'verified_fact',
      });
    } else {
      findings.push({
        id: 'DEP-K8S-001',
        category: 'deployment',
        status: 'FAIL',
        severity: 'high',
        title: 'Missing Kubernetes Readiness or Liveness Probe',
        explanation: `Manifest "${file}" lacks ${
          !hasReadinessProbe && !hasLivenessProbe
            ? 'both readinessProbe and livenessProbe'
            : !hasReadinessProbe
            ? 'readinessProbe'
            : 'livenessProbe'
        }. Without probes, Kubernetes cannot route traffic safely during rollouts or restart hung pods.`,
        evidence: { file, hasReadinessProbe, hasLivenessProbe },
        checkMethod: 'static_analysis',
        recommendation: 'Add readinessProbe (httpGet on /readyz) and livenessProbe (httpGet on /livez) with suitable initialDelaySeconds.',
        manualVerificationRequired: false,
        confidence: 'verified_fact',
      });
    }

    // 2. Resource Requests and Limits (DEP-K8S-002)
    const hasRequests = content.includes('requests:');
    const hasLimits = content.includes('limits:');

    if (hasRequests && hasLimits) {
      findings.push({
        id: 'DEP-K8S-002',
        category: 'deployment',
        status: 'PASS',
        severity: 'info',
        title: 'Kubernetes Resource Requests & Limits Specified',
        explanation: `Manifest "${file}" defines both CPU/memory requests and limits.`,
        evidence: { file },
        checkMethod: 'static_analysis',
        recommendation: 'Verify request sizing matches baseline utilization and limits allow burst headroom.',
        manualVerificationRequired: false,
        confidence: 'verified_fact',
      });
    } else {
      findings.push({
        id: 'DEP-K8S-002',
        category: 'deployment',
        status: 'WARNING',
        severity: 'medium',
        title: 'Missing Kubernetes Resource Requests or Limits',
        explanation: `Manifest "${file}" does not define both resource requests and limits. Unbounded pods can cause node resource starvation and eviction cascades.`,
        evidence: { file, hasRequests, hasLimits },
        checkMethod: 'static_analysis',
        recommendation: 'Specify resources.requests and resources.limits for CPU (e.g. 250m / 500m) and memory (e.g. 512Mi / 1Gi).',
        manualVerificationRequired: false,
        confidence: 'verified_fact',
      });
    }

    // 3. Security Context & Non-Root Execution (DEP-K8S-003)
    const hasRunAsNonRoot = content.includes('runAsNonRoot: true');
    const hasReadOnlyRoot = content.includes('readOnlyRootFilesystem: true');
    const hasNoPrivEscalation = content.includes('allowPrivilegeEscalation: false');

    if (hasRunAsNonRoot || hasNoPrivEscalation) {
      findings.push({
        id: 'DEP-K8S-003',
        category: 'deployment',
        status: 'PASS',
        severity: 'info',
        title: 'Kubernetes Pod Security Context Hardened',
        explanation: `Manifest "${file}" configures pod security constraints (${[
          hasRunAsNonRoot ? 'runAsNonRoot: true' : null,
          hasNoPrivEscalation ? 'allowPrivilegeEscalation: false' : null,
          hasReadOnlyRoot ? 'readOnlyRootFilesystem: true' : null,
        ]
          .filter(Boolean)
          .join(', ')}).`,
        evidence: { file },
        checkMethod: 'static_analysis',
        recommendation: 'Maintain strict Pod Security Standards (Restricted profile).',
        manualVerificationRequired: false,
        confidence: 'verified_fact',
      });
    } else {
      findings.push({
        id: 'DEP-K8S-003',
        category: 'deployment',
        status: 'WARNING',
        severity: 'medium',
        title: 'Missing Kubernetes Pod Security Context Hardening',
        explanation: `Manifest "${file}" lacks hardened securityContext settings (runAsNonRoot: true, allowPrivilegeEscalation: false).`,
        evidence: { file },
        checkMethod: 'static_analysis',
        recommendation: 'Add securityContext: runAsNonRoot: true and allowPrivilegeEscalation: false to pod spec.',
        manualVerificationRequired: false,
        confidence: 'verified_fact',
      });
    }

    // 4. Replica Count & High Availability (DEP-K8S-004)
    if (workload.isDeployment) {
      const matchReplicas = content.match(/replicas:\s*(\d+)/);
      const replicas = matchReplicas ? parseInt(matchReplicas[1], 10) : 1;

      if (replicas >= 2) {
        findings.push({
          id: 'DEP-K8S-004',
          category: 'deployment',
          status: 'PASS',
          severity: 'info',
          title: 'Multi-Replica Kubernetes High Availability Configured',
          explanation: `Manifest "${file}" configures replicas: ${replicas}, eliminating single-pod compute SPOF.`,
          evidence: { file, replicas },
          checkMethod: 'static_analysis',
          recommendation: 'Pair with HorizontalPodAutoscaler (HPA) and PodDisruptionBudget (PDB).',
          manualVerificationRequired: false,
          confidence: 'verified_fact',
        });
      } else {
        findings.push({
          id: 'DEP-K8S-004',
          category: 'deployment',
          status: 'WARNING',
          severity: 'high',
          title: 'Single-Replica Deployment SPOF in Kubernetes',
          explanation: `Manifest "${file}" specifies replicas: 1. A single replica cannot provide zero-downtime rolling updates or survive node rescheduling.`,
          evidence: { file, replicas: 1 },
          checkMethod: 'static_analysis',
          recommendation: 'Configure replicas: 2 or greater behind an Ingress or ClusterIP service.',
          manualVerificationRequired: false,
          confidence: 'verified_fact',
        });
      }
    }
  }

  return findings;
}
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 319kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 319kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 319kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 197kUpdated Claude CodeCodexVerifiedInstall