Complete infrastructure task — lint, validate, review, and submit PR. Use when an infrastructure-only branch is ready for submission — runs Terraform/Terragrunt validation (plus Helm on AKS) and creates the PR, skipping application/frontend checks.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Complete Infra?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/makigjuro-complete-infra)
---
name: complete-infra
description: Complete infrastructure task — lint, validate, review, and submit PR. Use when an infrastructure-only branch is ready for submission — runs Terraform/Terragrunt validation (plus Helm on AKS) and creates the PR, skipping application/frontend checks.
allowed-tools: Bash, Read, Glob, Grep, Agent, Skill
user-invocable: true
---
# Complete Infrastructure Task
Finalize an infrastructure branch by running infra-specific quality gates and creating a PR. This is the infra equivalent of a full completion workflow — it skips application build/tests and frontend lint.
## Prerequisites
- You must be on a feature branch (not main)
- All infrastructure changes should be committed
- Working tree should be clean
## Arguments
- `{issue}` — GitHub issue number (optional). If not provided, extract from branch name.
## Configuration
Read `blueprint.json` from the project root at the start of execution. Extract:
- `CHARTS_PATH` = `infrastructure.chartsPath` (default: `deploy/charts`)
- `TF_PATH` = `infrastructure.terraformPath` (default: `infra/terraform/modules`)
- `TG_PATH` = `infrastructure.terragruntPath` (default: `infra/terragrunt`)
- `IAC_WRAPPER` = `infrastructure.iacWrapper` (default: `none`)
- `RUNTIME` = `infrastructure.runtime` (default: `container-apps`)
- `ENVIRONMENTS` = `infrastructure.containerApps.environments` (default: `dev staging prod`)
If `blueprint.json` does not exist, auto-detect by scanning the project structure. Derive `TF_PARENT` as the parent directory of `TF_PATH`.
## Scripts
Reusable bash scripts live in `scripts/` relative to this skill directory:
| Script | Purpose |
|--------|---------|
| `scripts/validate-terraform.sh` | Validate changed Terraform modules |
| `scripts/lint-helm.sh` | Lint changed Helm charts |
These scripts read `TF_PATH` and `CHARTS_PATH` from environment variables. Export them before calling:
```bash
export TF_PATH="..." CHARTS_PATH="..."
```
The security scan (Track E below) reuses the script from the `trivy-scan` skill rather than duplicating it:
```bash
bash ${CLAUDE_PLUGIN_ROOT}/skills/trivy-scan/scripts/scan-trivy.sh
```
## Process
### Phase 0: Pre-flight
Run pre-flight checks inline:
```bash
BRANCH=$(git branch --show-current)
if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "master" ]; then
echo "ERROR: Cannot complete task on main branch"
exit 1
fi
if [ -n "$(git status --porcelain)" ]; then
echo "ERROR: Working tree is dirty. Commit or stash changes first."
exit 1
fi
ISSUE=$(echo "$BRANCH" | grep -oE '/[0-9]+' | tr -d '/' || true)
echo "Branch: $BRANCH"
echo "Issue: ${ISSUE:-<none>}"
```
### Phase 1: Parallel Infrastructure Lint
The tracks are independent; run them in parallel.
**Track A: Terraform format check**
```bash
terraform fmt -check -recursive {TF_PARENT}
```
**Track B: Terraform validate (changed modules only)**
```bash
export TF_PATH="{TF_PATH}"
bash ${CLAUDE_PLUGIN_ROOT}/skills/complete-infra/scripts/validate-terraform.sh
```
**Track C: Terragrunt validate (if `IAC_WRAPPER` = `terragrunt`)**
```bash
(cd {TG_PATH} && terragrunt hcl format --check)
for env in {ENVIRONMENTS}; do
[ -d "{TG_PATH}/$env" ] || continue
(cd "{TG_PATH}/$env" && IMAGE_TAG="${IMAGE_TAG:-0000000}" terragrunt run --all validate --provider-cache)
done
```
**Track D: Helm lint (only if `RUNTIME` = `aks` or charts exist, and charts changed)**
```bash
export CHARTS_PATH="{CHARTS_PATH}"
bash ${CLAUDE_PLUGIN_ROOT}/skills/complete-infra/scripts/lint-helm.sh
```
**Track E: Security scan (trivy)**
```bash
export TF_PARENT="{TF_PARENT}" CHARTS_PATH="{CHARTS_PATH}"
bash ${CLAUDE_PLUGIN_ROOT}/skills/trivy-scan/scripts/scan-trivy.sh
```
Honours `.trivyignore` at `{TF_PARENT}/.trivyignore`. Every suppression must carry a justifying comment — see the `trivy-scan` skill for conventions.
If any lint or scan track fails, STOP and report. Treat `trivy` missing as a FAIL and print the install hint so the user can remediate.
### Phase 2: Infrastructure Review
Launch the review agent (it only reads, so no worktree isolation is needed):
**Agent: `cloud-infra:infra-reviewer`** — Dedicated Terraform/Container Apps/Helm/CI review using the `infra-reviewer` agent definition. Reviews `git diff origin/main...HEAD -- {TF_PARENT}/ {CHARTS_PATH}/ .github/workflows/` and returns APPROVED / CHANGES REQUESTED / BLOCKED with findings covering security, naming, resource limits, and CI best practices.
### Phase 3: Evaluate
**If the review verdict is APPROVED:** Proceed to Phase 4.
**If the verdict is CHANGES REQUESTED or BLOCKED:**
1. Display findings
2. Fix issues (max 3 iterations)
3. Re-run from Phase 1
### Phase 4: Create PR
Run `/create-pr {issue}`.
## Output
```
## Infrastructure Task Completed
- Branch: {branch}
- Issue: #{issue}
- PR: {pr-url}
### Quality Gates
- Terraform Format: PASS
- Terraform Validate: PASS
- Terragrunt Validate: PASS / SKIP (no Terragrunt)
- Helm Lint: PASS / SKIP (runtime not aks, or no chart changes)
- Security Scan (trivy): PASS / FAIL
- Infra Review: APPROVED
PR is ready for human review.
```