@slamb2k/mad-skills 2.0.14 → 2.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,498 @@
1
+ ---
2
+ name: keel
3
+ description: >-
4
+ Generate Infrastructure as Code (IaC) pipelines that provision the cloud and
5
+ container infrastructure your app deploys to. Interview-driven: detects your
6
+ stack and cloud provider, then outputs deterministic IaC files (Terraform,
7
+ Bicep, Pulumi, or CDK) plus CI/CD pipelines that plan on PR and apply on merge.
8
+ Use when setting up cloud infrastructure, provisioning container registries,
9
+ databases, networking, DNS, or any infrastructure that containers deploy onto.
10
+ Designed to run before /dock — /keel lays the infrastructure, /dock deploys to it.
11
+ argument-hint: "--plan-only, --skip-interview, --dry-run, --tool terraform|bicep|pulumi|cdk"
12
+ allowed-tools: Bash, Read, Write, Edit, Glob, Grep, AskUserQuestion, Agent
13
+ ---
14
+
15
+ # Keel - Infrastructure as Code Pipelines
16
+
17
+ When this skill is invoked, IMMEDIATELY output the banner below before doing anything else.
18
+ Pick ONE tagline at random — vary your choice each time.
19
+ CRITICAL: Reproduce the banner EXACTLY character-for-character. The first line of the art has 4 leading spaces — you MUST preserve them.
20
+
21
+ ```
22
+ {tagline}
23
+
24
+ ⠀ ██╗██╗ ██╗███████╗███████╗██╗
25
+ ██╔╝██║ ██╔╝██╔════╝██╔════╝██║
26
+ ██╔╝ █████╔╝ █████╗ █████╗ ██║
27
+ ██╔╝ ██╔═██╗ ██╔══╝ ██╔══╝ ██║
28
+ ██╔╝ ██║ ██╗███████╗███████╗███████╗
29
+ ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝
30
+ ```
31
+
32
+ Taglines:
33
+ - ⚓ Laying the keel — everything builds on this!
34
+ - 🏗️ Infrastructure from code, not from clicks!
35
+ - 🌍 Terraforming your cloud, one resource at a time!
36
+ - 🔩 Bolting down the foundation!
37
+ - ☁️ Cloud infrastructure, declared and versioned!
38
+ - 🧱 No infra, no deploy — let's fix that!
39
+ - 📐 Measure twice, provision once!
40
+ - 🗺️ Charting the infrastructure map!
41
+
42
+ ---
43
+
44
+ Provision cloud and container infrastructure through an interview-driven workflow
45
+ that generates deterministic IaC files and CI/CD pipelines. The generated pipelines
46
+ run `plan` on every PR and `apply` on merge to the default branch — no LLM at runtime.
47
+
48
+ **Recommended skill order:**
49
+ `/brace` → `/rig` → `/build` → `/ship` → `/keel` → `/dock`
50
+
51
+ /keel lays the infrastructure (registries, compute, networking, databases).
52
+ /dock creates the deployment pipelines that push containers onto that infrastructure.
53
+
54
+ ## Flags
55
+
56
+ Parse optional flags from the request:
57
+ - `--plan-only`: Generate IaC files but no CI/CD pipeline
58
+ - `--skip-interview`: Use detected defaults without interactive prompts
59
+ - `--dry-run`: Show what would be generated without writing files
60
+ - `--tool <name>`: Force a specific IaC tool (terraform, bicep, pulumi, cdk)
61
+
62
+ ---
63
+
64
+ ## Pre-flight
65
+
66
+ Before starting, check dependencies:
67
+
68
+ | Dependency | Type | Check | Required | Resolution | Detail |
69
+ |-----------|------|-------|----------|------------|--------|
70
+ | git | cli | `git --version` | yes | stop | Install from https://git-scm.com |
71
+ | sync | skill | `.claude/skills/sync/SKILL.md` | no | fallback | Repo sync; falls back to manual git pull |
72
+ | terraform | cli | `terraform --version` | no | fallback | Detected if user wants Terraform; suggest install from https://terraform.io |
73
+ | az | cli | `az --version` | no | fallback | Needed for Bicep; suggest install from https://aka.ms/install-azure-cli |
74
+ | pulumi | cli | `pulumi version` | no | fallback | Detected if user wants Pulumi; suggest install from https://pulumi.com |
75
+ | cdk | cli | `cdk --version` | no | fallback | Detected if user wants AWS CDK; install via npm |
76
+
77
+ Only check the tool that matches the user's choice (or detected default).
78
+ Skip checks for tools not being used.
79
+
80
+ ---
81
+
82
+ ## Phase 0: Sync
83
+
84
+ Invoke `/sync` to ensure the working tree is up to date with origin/main.
85
+ Falls back to `git pull` if /sync is unavailable.
86
+
87
+ ---
88
+
89
+ ## Phase 1: Detection
90
+
91
+ Launch an **Explore subagent** to scan the codebase for existing infrastructure.
92
+
93
+ ```
94
+ Task(
95
+ subagent_type: "Explore",
96
+ description: "Detect existing IaC and cloud config",
97
+ prompt: <read from references/interview-guide.md#detection-prompt>
98
+ )
99
+ ```
100
+
101
+ The detection scans for:
102
+ - **Existing IaC**: Terraform (.tf), Bicep (.bicep), Pulumi (Pulumi.yaml), CDK (cdk.json),
103
+ CloudFormation (template.yaml), ARM (azuredeploy.json)
104
+ - **Cloud provider signals**: Azure (azure-pipelines.yml, .azure/), AWS (.aws/, buildspec.yml),
105
+ GCP (.gcloud/, cloudbuild.yaml)
106
+ - **Existing CI/CD**: .github/workflows/, azure-pipelines.yml, .gitlab-ci.yml
107
+ - **Container config**: Dockerfile, docker-compose.yml (signals what infra is needed)
108
+ - **Database signals**: migrations/, prisma/schema.prisma, alembic/, knex migrations
109
+ - **Existing /dock artifacts**: deploy/ directory, environment matrix (signals target platforms)
110
+ - **State backends**: terraform.tfstate, .terraform/, Pulumi.*.yaml stacks
111
+
112
+ Parse INFRA_DETECTION_REPORT. This feeds into the interview.
113
+
114
+ ---
115
+
116
+ ## Phase 2: Interview
117
+
118
+ Present detection results and fill gaps through guided questions.
119
+ Read the full interview flow from `references/interview-guide.md#interview-questions`.
120
+
121
+ The interview covers these topics in order. Skip questions where detection provided
122
+ high-confidence answers (but confirm with the user).
123
+
124
+ ### 2.1 — Cloud Provider
125
+
126
+ ```
127
+ Which cloud provider(s) will host your infrastructure?
128
+
129
+ Options:
130
+ 1. Azure (Recommended if Azure signals detected)
131
+ 2. AWS
132
+ 3. Google Cloud
133
+ 4. Multi-cloud
134
+ 5. Self-hosted / VPS (Dokku, Coolify, CapRover)
135
+ ```
136
+
137
+ If /dock has already run, infer from the deployment targets chosen there.
138
+
139
+ ### 2.2 — IaC Tool
140
+
141
+ Suggest based on cloud provider:
142
+ - Azure → Bicep (native) or Terraform (universal)
143
+ - AWS → Terraform or CDK
144
+ - GCP → Terraform or Pulumi
145
+ - Multi-cloud → Terraform
146
+ - Self-hosted → Terraform (for VPS provisioning) or skip IaC
147
+
148
+ ```
149
+ Which Infrastructure as Code tool do you want to use?
150
+
151
+ Options:
152
+ 1. Terraform (Recommended — universal, multi-cloud)
153
+ 2. Bicep (Azure-native, simpler syntax)
154
+ 3. Pulumi (code-first, TypeScript/Python/Go)
155
+ 4. AWS CDK (AWS-native, TypeScript/Python)
156
+ ```
157
+
158
+ ### 2.3 — Infrastructure Components
159
+
160
+ Present a checklist based on detected needs. The goal is to provision everything
161
+ /dock needs to deploy to, plus supporting services.
162
+
163
+ ```
164
+ Which infrastructure components do you need?
165
+
166
+ Container platform:
167
+ [x] Container registry (required for /dock)
168
+ [ ] Kubernetes cluster (AKS/EKS/GKE)
169
+ [ ] Serverless containers (Container Apps/Fargate/Cloud Run)
170
+ [ ] Self-hosted PaaS (Dokku/Coolify/CapRover on VPS)
171
+
172
+ Data:
173
+ [ ] Managed database (PostgreSQL, MySQL, SQL Server, etc.)
174
+ [ ] Cache (Redis, Memcached)
175
+ [ ] Object storage (S3, Blob Storage, GCS)
176
+ [ ] Message queue (SQS, Service Bus, Pub/Sub)
177
+
178
+ Networking:
179
+ [ ] DNS zone
180
+ [ ] CDN / Front Door
181
+ [ ] Virtual network / VPC
182
+ [ ] Load balancer (if not using platform-managed)
183
+ [ ] API Gateway
184
+
185
+ Security:
186
+ [ ] Key Vault / Secrets Manager
187
+ [ ] Managed identity / IAM roles
188
+ [ ] SSL/TLS certificates
189
+
190
+ Monitoring:
191
+ [ ] Log aggregation (Application Insights, CloudWatch, Cloud Logging)
192
+ [ ] Metrics / dashboards
193
+ [ ] Alerts
194
+ ```
195
+
196
+ Auto-check components if /dock detection or the codebase signals them:
197
+ - Dockerfile found → container registry checked
198
+ - Database migrations found → managed database checked
199
+ - Redis client in deps → cache checked
200
+ - S3/Blob SDK in deps → object storage checked
201
+
202
+ ### 2.4 — Environment Topology
203
+
204
+ Align with /dock's environments if it has run. Otherwise ask:
205
+
206
+ ```
207
+ How many environments do you need?
208
+
209
+ Options:
210
+ 1. Simple: dev + prod (Recommended for starting out)
211
+ 2. Standard: dev + staging + prod
212
+ 3. Custom: define your own
213
+ ```
214
+
215
+ Each environment gets its own IaC state and variable set. Resource sizing
216
+ scales with the environment tier (dev=small, staging=medium, prod=large).
217
+
218
+ ### 2.5 — State Management
219
+
220
+ Where to store IaC state (critical for team collaboration):
221
+
222
+ **Terraform:**
223
+ ```
224
+ Where should Terraform state be stored?
225
+
226
+ Options:
227
+ 1. Azure Blob Storage (Recommended for Azure)
228
+ 2. AWS S3 + DynamoDB (Recommended for AWS)
229
+ 3. Google Cloud Storage (Recommended for GCP)
230
+ 4. Terraform Cloud
231
+ 5. Local (not recommended for teams)
232
+ ```
233
+
234
+ **Bicep:** No state management needed (Azure Resource Manager handles it).
235
+
236
+ **Pulumi:** Pulumi Cloud (default) or self-managed backend.
237
+
238
+ **CDK:** CloudFormation handles state.
239
+
240
+ ### 2.6 — CI/CD for Infrastructure
241
+
242
+ ```
243
+ How should infrastructure changes be applied?
244
+
245
+ Options:
246
+ 1. Plan on PR, apply on merge (Recommended)
247
+ 2. Plan on PR, manual apply via approval
248
+ 3. Plan and apply on merge (no PR preview)
249
+ ```
250
+
251
+ All options generate a pipeline. Option 1 is the default and safest for teams.
252
+
253
+ ### 2.7 — Naming Convention
254
+
255
+ ```
256
+ What naming convention should resources use?
257
+
258
+ Options:
259
+ 1. Azure CAF style: {resource-type}-{project}-{env}-{region} (Recommended)
260
+ 2. Simple: {project}-{resource}-{env}
261
+ 3. Custom prefix: {user-defined}
262
+ ```
263
+
264
+ ### 2.8 — Integration with /dock
265
+
266
+ If /dock artifacts exist, ask:
267
+ ```
268
+ I found /dock deployment config. Should /keel provision the infrastructure
269
+ those pipelines deploy to?
270
+
271
+ Detected targets:
272
+ dev: {platform}
273
+ staging: {platform}
274
+ prod: {platform}
275
+
276
+ I'll provision: container registry, {platform}-specific compute, networking.
277
+ ```
278
+
279
+ **If `--skip-interview`**: Use detected defaults + sensible defaults.
280
+
281
+ Compile all answers into an INFRA_CONFIG object for Phase 3.
282
+
283
+ ---
284
+
285
+ ## Phase 3: Generate Artifacts
286
+
287
+ Based on INFRA_DETECTION_REPORT and INFRA_CONFIG, generate all IaC files.
288
+ Use templates from `references/` as starting points.
289
+
290
+ ### 3.1 — Project Structure
291
+
292
+ Generate an `infra/` directory with this layout:
293
+
294
+ **Terraform:**
295
+ ```
296
+ infra/
297
+ ├── main.tf # Provider config, backend, module calls
298
+ ├── variables.tf # Input variables
299
+ ├── outputs.tf # Output values (registry URL, endpoints, etc.)
300
+ ├── versions.tf # Required providers and versions
301
+ ├── environments/
302
+ │ ├── dev.tfvars # Dev variable values
303
+ │ ├── staging.tfvars # Staging variable values
304
+ │ └── prod.tfvars # Prod variable values
305
+ └── modules/
306
+ ├── registry/ # Container registry
307
+ ├── compute/ # Container platform (AKS, ECS, Cloud Run, etc.)
308
+ ├── database/ # Managed database
309
+ ├── networking/ # VPC, DNS, load balancer
310
+ └── monitoring/ # Logging, metrics, alerts
311
+ ```
312
+
313
+ **Bicep:**
314
+ ```
315
+ infra/
316
+ ├── main.bicep # Orchestration (module calls)
317
+ ├── main.bicepparam # Parameter file template
318
+ ├── environments/
319
+ │ ├── dev.bicepparam
320
+ │ ├── staging.bicepparam
321
+ │ └── prod.bicepparam
322
+ └── modules/
323
+ ├── registry.bicep
324
+ ├── compute.bicep
325
+ ├── database.bicep
326
+ ├── networking.bicep
327
+ └── monitoring.bicep
328
+ ```
329
+
330
+ **Pulumi:**
331
+ ```
332
+ infra/
333
+ ├── Pulumi.yaml # Project config
334
+ ├── Pulumi.dev.yaml # Dev stack config
335
+ ├── Pulumi.staging.yaml # Staging stack config
336
+ ├── Pulumi.prod.yaml # Prod stack config
337
+ ├── index.ts # Main program (or __main__.py for Python)
338
+ └── resources/
339
+ ├── registry.ts
340
+ ├── compute.ts
341
+ ├── database.ts
342
+ └── networking.ts
343
+ ```
344
+
345
+ Only generate modules for components selected in the interview.
346
+
347
+ ### 3.2 — State Backend Bootstrap
348
+
349
+ Generate `infra/bootstrap.sh` for first-time state backend setup.
350
+ Use the provider-specific template from `references/iac-pipeline-templates.md#bootstrap-scripts`.
351
+
352
+ ### 3.3 — CI/CD Pipeline for IaC
353
+
354
+ Read the appropriate template from `references/iac-pipeline-templates.md`.
355
+
356
+ Generate a workflow that implements:
357
+
358
+ **On pull request:**
359
+ 1. `terraform init` (or equivalent)
360
+ 2. `terraform plan` with the target environment's vars
361
+ 3. Post plan output as PR comment (for review)
362
+ 4. Fail if plan has errors
363
+
364
+ **On merge to default branch:**
365
+ 1. `terraform init`
366
+ 2. `terraform plan`
367
+ 3. `terraform apply -auto-approve`
368
+ 4. Output resource endpoints and connection strings
369
+
370
+ **On environment promotion (tag or manual dispatch):**
371
+ 1. Apply to staging with staging vars
372
+ 2. Apply to prod with prod vars (requires approval)
373
+
374
+ ### 3.4 — Outputs for /dock
375
+
376
+ Generate an outputs file that /dock's pipelines can consume:
377
+
378
+ ```hcl
379
+ # outputs.tf
380
+ output "registry_url" {
381
+ value = module.registry.login_server
382
+ }
383
+
384
+ output "registry_name" {
385
+ value = module.registry.name
386
+ }
387
+
388
+ output "compute_endpoint" {
389
+ value = module.compute.endpoint
390
+ }
391
+
392
+ output "database_connection_string" {
393
+ value = module.database.connection_string
394
+ sensitive = true
395
+ }
396
+ ```
397
+
398
+ These outputs become inputs for /dock's deployment pipelines — the registry URL
399
+ for pushing images, the compute endpoint for deploying containers, etc.
400
+
401
+ ### 3.5 — Environment Variables Bridge
402
+
403
+ Generate a script or workflow step that reads IaC outputs and writes them as
404
+ CI/CD secrets/variables for /dock's pipelines:
405
+
406
+ ```bash
407
+ # infra/sync-outputs.sh
408
+ REGISTRY_URL=$(terraform output -raw registry_url)
409
+ gh secret set REGISTRY_URL --body "$REGISTRY_URL"
410
+ gh secret set DATABASE_URL --body "$(terraform output -raw database_connection_string)"
411
+ ```
412
+
413
+ ---
414
+
415
+ ## Phase 4: Verify
416
+
417
+ Validate generated IaC files:
418
+
419
+ **Terraform:**
420
+ ```bash
421
+ cd infra && terraform init -backend=false && terraform validate
422
+ ```
423
+
424
+ **Bicep:**
425
+ ```bash
426
+ az bicep build --file infra/main.bicep
427
+ ```
428
+
429
+ **Pulumi:**
430
+ ```bash
431
+ cd infra && pulumi preview --stack dev
432
+ ```
433
+
434
+ If the IaC tool is not installed, skip validation and note it in the report.
435
+
436
+ Also validate generated workflow files for YAML syntax.
437
+
438
+ Present the user with a summary of all generated files before writing.
439
+
440
+ **If `--dry-run`**: Show file list and content previews without writing.
441
+
442
+ ---
443
+
444
+ ## Final Report
445
+
446
+ After all files are generated and verified, present:
447
+
448
+ ```
449
+ Keel complete
450
+
451
+ Provider: {cloud_provider}
452
+ IaC Tool: {tool}
453
+ Envs: {env1} → {env2} → {env3}
454
+ State: {state_backend}
455
+
456
+ Components provisioned:
457
+ {checklist of selected components}
458
+
459
+ Generated files:
460
+ {file list with brief descriptions}
461
+
462
+ Pipeline flow:
463
+ PR → terraform plan → comment on PR
464
+ Merge → terraform apply (dev) → sync outputs
465
+ Tag → terraform apply (staging) → terraform apply (prod)
466
+
467
+ /dock integration:
468
+ Registry URL: output from infra/outputs.tf
469
+ Compute: {platform} provisioned per environment
470
+ Secrets: synced via infra/sync-outputs.sh
471
+
472
+ Next steps:
473
+ 1. Run bootstrap script: ./infra/bootstrap.sh
474
+ 2. Review generated IaC files
475
+ 3. Configure CI/CD secrets: {list}
476
+ 4. Push to trigger first plan
477
+ 5. After apply succeeds, run /dock to set up deployment pipelines
478
+ ```
479
+
480
+ ---
481
+
482
+ ## Idempotency
483
+
484
+ If /keel detects it has been run before (existing `infra/` directory):
485
+ - **Modules**: Update existing; add new components without removing user customizations
486
+ - **Variables**: Merge new variables; preserve existing values
487
+ - **Pipeline**: Update steps; preserve custom jobs
488
+ - **State config**: Never overwrite backend config
489
+ - **Always ask** before overwriting existing files
490
+
491
+ ---
492
+
493
+ ## Integration Points
494
+
495
+ - **/dock**: /keel provisions what /dock deploys to. /dock pipelines consume
496
+ the outputs (registry URL, compute endpoints) as deployment targets.
497
+ - **/rig**: Detects `infra/` and wires IaC pipeline into CI workflow.
498
+ - **/ship**: Merge triggers IaC apply → /dock deploy chain.