/major-ai-skills:packerfrom major-ai-skills
Build reproducible golden machine images with Packer HCL2: init/validate/build, pin source AMIs, provisioners, manifests, and cleanup on failure—without baking long-lived credentials.
Ships in major-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Packer turns a declarative template into a golden image: a builder launches a temporary VM/container, provisioners install/configure software, then the result is snapshotted (AMI, Azure image, GCE image, etc.). Packer does not manage fleet drift after publish—consumers (@terraform-aws, @pulumi) launch from the artifact. Agents prefer HCL2, run packer init → validate → build, pin base images, emit manifests, clean temp resources on failure, and never bake long-lived cloud keys into images.
┌─────────────────────────────────────────────────────────────┐
│ Packer build pipeline │
│ │
│ *.pkr.hcl │
│ ├── packer { required_plugins } │
│ ├── source "amazon-ebs" / azure-arm / googlecompute / … │
│ ├── build { provisioner shell|ansible|file } │
│ ├── error-cleanup-provisioner (optional) │
│ └── post-processor manifest / compress │
│ │
│ Runtime │
│ ├── Temp instance + SSH/WinRM │
│ ├── Snapshot → AMI / image artifact │
│ └── You own AMI lifecycle (delete old snaps) │
└─────────────────────────────────────────────────────────────┘
Use when
user-data that grows unbounded.Do not use when
@docker / OCI builds; Packer docker builder is a niche escape hatch.@vault at runtime.*.pkr.hcl); avoid legacy JSON unless migrating.packer init . → packer fmt → packer validate → packer build (CI must fail on validate errors).source_ami / image ID, or source_ami_filter with owners + deterministic naming; record the resolved ID in the manifest.export AWS_SECRET_ACCESS_KEY=… into provisioner scripts that land on disk.-on-error=cleanup; use error-cleanup-provisioner to unsubscribe/deregister side effects; lifecycle-delete old AMIs/snapshots yourself.@ansible for complex config; strip build SSH keys / cloud-init residue in a final cleanup script.git_sha, pipeline_id, build_time for traceability.packer {
required_plugins {
amazon = {
source = "github.com/hashicorp/amazon"
version = ">= 1.2.0"
}
}
}
variable "region" { type = string }
variable "git_sha" { type = string }
source "amazon-ebs" "ubuntu" {
region = var.region
instance_type = "t3.small"
ssh_username = "ubuntu"
ami_name = "api-golden-${var.git_sha}"
ami_regions = [var.region]
source_ami_filter {
filters = {
name = "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"
root-device-type = "ebs"
virtualization-type = "hvm"
}
owners = ["099720109477"] # Canonical
most_recent = true
}
tags = {
Name = "api-golden"
git_sha = var.git_sha
managed_by = "packer"
}
}
build {
sources = ["source.amazon-ebs.ubuntu"]
provisioner "shell" {
inline = [
"sudo apt-get update",
"sudo DEBIAN_FRONTEND=noninteractive apt-get install -y nginx",
"sudo systemctl enable nginx"
]
}
provisioner "shell" {
inline = [
"sudo cloud-init clean --logs || true",
"sudo rm -f /home/ubuntu/.ssh/authorized_keys"
]
}
post-processor "manifest" {
output = "manifest.json"
strip_path = true
}
}
CLI / CI loop:
packer init .
packer fmt -check .
packer validate -var region=us-east-1 -var git_sha="$(git rev-parse --short HEAD)" .
packer build -on-error=cleanup \
-var region=us-east-1 \
-var git_sha="$(git rev-parse --short HEAD)" .
# Consume artifact_id from manifest.json in Terraform/Pulumi
| Builder | Artifact | Notes |
|---|---|---|
| amazon-ebs | AMI | IAM to create images; you delete old AMIs |
| azure-arm | Managed image / Gallery | SP or managed identity |
| googlecompute | GCE image | GCP credentials / WIF |
| docker | OCI image | Prefer native Docker for apps |
| Signature | Likely cause | Fix path |
|---|---|---|
packer validate fails on plugin | Missing packer init / wrong required_plugins | packer init; pin plugin versions |
| SSH timeout to builder instance | SG/NACL, wrong ssh_username, public IP/subnet | Align network + username with base AMI; check temp SG rules |
| Build fails mid-provision; orphan resources | Abort without cleanup | packer build -on-error=cleanup; search for packer prefixed SG/keypairs |
| AMI exists but next build name collision | Duplicate ami_name | Include git SHA/timestamp; or -force when intentional replace |
| Image boots broken / no SSH | Cleanup removed needed keys; wrong cloud-init | Keep bootstrap user; inject runtime keys via cloud-init/SSM |
| Slow flaky apt/yum | Network/rate limits in builder VPC | Retry (max_retries), local mirrors, longer timeout |
| Credentials in image history | Env/files left by provisioner | Audit final image; use roles; scrub /tmp and shell history |
@trivy (or equivalent) before marking golden.@terraform-aws / @pulumi — launch ASGs from Packer AMI IDs@ansible — richer provisioners than inline shell@docker — prefer for container workloads@trivy — vulnerability gate before promotion@github-actions — OIDC build pipeline for Packer@aws-cli — describe/deregister old AMIs and snapshotsMANDATORY: Use HCL2 with
init+validatebeforebuild. Pin or owner-filter base images; tag with git SHA; emitmanifest.jsonfor IaC. Never bake long-lived credentials into images. Prefer-on-error=cleanupand explicit AMI lifecycle. Prefer Docker for app containers unless a VM image is explicitly required.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization./act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing.Other plugins' skills for the same job