Agnostic Cluster Refactor Skill for Antigrafity CLI: Building an AI Agent that Migrates Apps from AWS to GKE (Subagents, HITL Gate & Workload Identity) A developer built an AI agent skill for the Antigravity CLI that migrates applications from AWS to GKE. The agent scans cloud dependencies, spawns parallel subagents to refactor code and infrastructure, and validates changes on local Kubernetes before deploying with keyless Workload Identity, with mandatory human oversight before any production mutation. Have you ever inherited a codebase where import boto3 appears in 47 different files? Where AWS credentials live in hardcoded environment variables and file storage is a file.save "/tmp/..." that will blow up the moment it hits an ephemeral Kubernetes pod? I did. And instead of refactoring everything by hand, I built an AI agent to do it for me β€” with mandatory human oversight before any production mutation. This article documents what I built: a skill for the Antigravity CLI agy that scans cloud dependencies, spawns parallel subagents to refactor code and infrastructure, and validates everything on local Kubernetes before deploying to GKE with keyless Workload Identity. boto3 is the AWS SDK for Python. It seems harmless at first: python Innocent on day 1 import boto3 s3 = boto3.client 's3', region name='us-east-1' s3.upload fileobj file, bucket name, filename Six months later: python examples/legacy-app/app.py β€” the real state after it grows import os import boto3 from flask import Flask, request, jsonify app = Flask name "Temporary" hardcoded since 2022 DB PASSWORD = os.getenv "DB PASSWORD", "default-insecure-password" S3 BUCKET = os.getenv "AWS S3 BUCKET NAME" AWS REGION = os.getenv "AWS DEFAULT REGION", "us-east-1" s3 client = boto3.client 's3', aws access key id=os.getenv "AWS ACCESS KEY ID" , aws secret access key=os.getenv "AWS SECRET ACCESS KEY" , region name=AWS REGION @app.route "/upload", methods= "POST" def upload file : file = request.files 'file' filename = file.filename if S3 BUCKET: s3 client.upload fileobj file, S3 BUCKET, filename return jsonify {"message": f"Uploaded to AWS S3: {S3 BUCKET}"} else: Fallback to local disk β€” will break in K8s ephemeral pods local path = os.path.join "/tmp", filename file.save local path return jsonify {"message": f"Saved locally at {local path}"} Three coupling problems in a single file: proprietary SDK boto3 , AWS-specific credentials, and local disk storage that doesn't survive ephemeral Kubernetes pods. Now multiply that by 10 services. A skill for the Antigravity CLI that adds two commands to the agent chat: /agnostic-cluster-refactor:scan-deps /agnostic-cluster-refactor:spawn-refactor The complete flow: But before diving into the code, let me introduce the players. agy is not a script. It's an LLM-powered agent β€” you describe what you want in the chat and it decides how to do it, using a toolset: read file , write to file , run command , invoke subagent . The difference from a web chatbot: agy has access to your local filesystem, runs terminal commands, and operates in autonomous loops. It's an engineer working on your machine. | Script | Agent | |---|---| sed 's/boto3/gcs/g' across all files | Analyzes the semantic context of each import and replaces it with the correct equivalent API | | Fails if the environment changed | Adapts to the current state | | Deterministic | Probabilistic + adaptive | A skill is a SKILL.md file with YAML frontmatter that defines when and how the agent uses that capability. The agent reads the description field and decides whether the skill is relevant to the current task. --- name: scan-deps description: Scans the project for cloud-provider dependencies and generates dependency-map.json. Use when the user wants to map vendor lock-in before migrating to GKE. --- Steps 1. Ask which directory to scan 2. Run: python3 .agents/skills/.../scan deps.py