agentsclimarketplace

Castai local dev loop

Skill ComeOnOliver/skillshub/skills/jeremylongshore/claude-code-plugins-plus-skills/castai-local-dev-loop

🧠 The right skill, one API call. AI agent skills registry with token-efficient skill resolution. 5,000+ skills from 500+ top repos.

Install
npx -y skills add ComeOnOliver/skillshub --skill castai-local-dev-loop

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

Set up a local Kubernetes development loop with CAST AI cost monitoring. Use when building cost-aware deployments, testing autoscaler policies, or iterating on Terraform CAST AI configurations locally. Trigger with phrases like "cast ai dev setup", "cast ai local testing", "develop with cast ai", "cast ai terraform dev".

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

4.5 KB, ~1.0k tokens by cl100k_base, as published. Nobody here has run it

CAST AI Local Dev Loop

Overview

Fast iteration workflow for CAST AI integrations: test autoscaler policies in a dev cluster, validate Terraform modules before applying to production, and use the CAST AI API to measure savings impact during development.

Prerequisites

  • Completed castai-install-auth setup
  • A development Kubernetes cluster (kind, minikube, or cloud dev cluster)
  • kubectl, helm, and optionally terraform installed

Instructions

Step 1: Project Structure

my-castai-infra/
β”œβ”€β”€ terraform/
β”‚   β”œβ”€β”€ environments/
β”‚   β”‚   β”œβ”€β”€ dev.tfvars
β”‚   β”‚   β”œβ”€β”€ staging.tfvars
β”‚   β”‚   └── prod.tfvars
β”‚   β”œβ”€β”€ modules/
β”‚   β”‚   └── castai-cluster/
β”‚   β”‚       β”œβ”€β”€ main.tf
β”‚   β”‚       β”œβ”€β”€ variables.tf
β”‚   β”‚       └── outputs.tf
β”‚   └── main.tf
β”œβ”€β”€ policies/
β”‚   β”œβ”€β”€ dev-policy.json
β”‚   └── prod-policy.json
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ check-savings.sh
β”‚   └── validate-policies.sh
β”œβ”€β”€ .env.dev            # Dev API key (git-ignored)
└── .env.example

Step 2: Dev Cluster with Relaxed Policies

# Connect your dev cluster (read-only first)
helm upgrade --install castai-agent castai-helm/castai-agent \
  -n castai-agent --create-namespace \
  --set apiKey="${CASTAI_API_KEY_DEV}" \
  --set provider="eks"

# Apply development-safe autoscaler policy
curl -X PUT -H "X-API-Key: ${CASTAI_API_KEY_DEV}" \
  -H "Content-Type: application/json" \
  "https://api.cast.ai/v1/kubernetes/clusters/${CASTAI_CLUSTER_ID}/policies" \
  -d '{
    "enabled": true,
    "unschedulablePods": { "enabled": true },
    "nodeDownscaler": {
      "enabled": true,
      "emptyNodes": { "enabled": true, "delaySeconds": 300 }
    },
    "clusterLimits": {
      "enabled": true,
      "cpu": { "minCores": 2, "maxCores": 16 }
    }
  }'

Step 3: Quick Savings Check Script

#!/bin/bash
# scripts/check-savings.sh
set -euo pipefail

API_KEY="${CASTAI_API_KEY_DEV}"
CLUSTER_ID="${CASTAI_CLUSTER_ID}"

echo "=== CAST AI Dev Cluster Savings ==="
curl -s -H "X-API-Key: ${API_KEY}" \
  "https://api.cast.ai/v1/kubernetes/clusters/${CLUSTER_ID}/savings" \
  | jq '{
    monthlySavings: .monthlySavings,
    percentage: .savingsPercentage,
    spotNodes: [.nodes[] | select(.lifecycle == "spot")] | length,
    totalNodes: [.nodes[]] | length
  }'

Step 4: Terraform Plan-Apply Loop

# Plan with dev variables
cd terraform/
terraform plan -var-file=environments/dev.tfvars -out=plan.tfplan

# Apply and check CAST AI result
terraform apply plan.tfplan

# Verify policies took effect
curl -s -H "X-API-Key: ${CASTAI_API_KEY_DEV}" \
  "https://api.cast.ai/v1/kubernetes/clusters/${CASTAI_CLUSTER_ID}/policies" \
  | jq .

Step 5: Watch Node Changes in Real Time

# Terminal 1: Watch CAST AI node operations
watch -n 15 'curl -s -H "X-API-Key: ${CASTAI_API_KEY_DEV}" \
  "https://api.cast.ai/v1/kubernetes/external-clusters/${CASTAI_CLUSTER_ID}/nodes" \
  | jq "[.items[] | {name, instanceType, lifecycle, age: .createdAt}] | length"'

# Terminal 2: Watch kubectl node status
kubectl get nodes -w

Error Handling

ErrorCauseSolution
Dev cluster not foundWrong cluster IDList clusters with API first
Policy rejectedInvalid JSONValidate with jq . < policy.json
Terraform driftManual console changesRun terraform refresh
Agent offline after restartHelm release stalehelm upgrade --install again

Resources

Next Steps

See castai-sdk-patterns for reusable API wrapper patterns.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.