$npx -y skills add girijashankarj/cursor-handbook --skill infrastructureWorkflow for provisioning cloud infrastructure using IaC. Use when the user needs to create or modify cloud resources.
| 1 | # Skill: Set Up Cloud Infrastructure |
| 2 | |
| 3 | ## Trigger |
| 4 | When the user needs to create or modify cloud resources. |
| 5 | |
| 6 | ## Steps |
| 7 | |
| 8 | ### Step 1: Define Requirements |
| 9 | - [ ] What resources are needed? |
| 10 | - [ ] Which environment? (dev, staging, production) |
| 11 | - [ ] Performance requirements? |
| 12 | - [ ] Budget constraints? |
| 13 | - [ ] Security requirements? |
| 14 | |
| 15 | ### Step 2: Design Architecture |
| 16 | - [ ] Draw architecture diagram (Mermaid) |
| 17 | - [ ] Define networking (VPC, subnets, security groups) |
| 18 | - [ ] Plan compute resources (size, scaling) |
| 19 | - [ ] Plan storage (database, file storage, cache) |
| 20 | - [ ] Plan monitoring and alerting |
| 21 | |
| 22 | ### Step 3: Write IaC |
| 23 | - [ ] Create Terraform/CDK/CloudFormation templates |
| 24 | - [ ] Use modules for reusable components |
| 25 | - [ ] Parameterize environment-specific values |
| 26 | - [ ] Follow naming conventions: `{project}-{env}-{resource}` |
| 27 | - [ ] Tag all resources |
| 28 | |
| 29 | ### Step 4: Security |
| 30 | - [ ] Enable encryption at rest |
| 31 | - [ ] Enable encryption in transit |
| 32 | - [ ] Configure IAM with least privilege |
| 33 | - [ ] Set up VPC and security groups |
| 34 | - [ ] Enable audit logging |
| 35 | |
| 36 | ### Step 5: Deploy |
| 37 | - [ ] Plan: Review changes before applying |
| 38 | - [ ] Apply to dev first |
| 39 | - [ ] Verify in dev |
| 40 | - [ ] Promote to staging |
| 41 | - [ ] Verify in staging |
| 42 | - [ ] Promote to production |
| 43 | |
| 44 | ### Step 6: Monitor |
| 45 | - [ ] Set up health checks |
| 46 | - [ ] Configure alert rules |
| 47 | - [ ] Create dashboards |
| 48 | - [ ] Set up cost alerts |
| 49 | |
| 50 | ## If a step fails |
| 51 | |
| 52 | | Step | Failure | Recovery | |
| 53 | |------|---------|----------| |
| 54 | | Step 5 | Deploy to dev/staging fails | Run `terraform destroy` or equivalent; fix IaC; re-apply; never proceed to prod until dev/staging succeeds | |
| 55 | | Step 5 | Deploy to production fails | Rollback via IaC (revert and apply previous state); investigate; fix in dev; re-test full pipeline | |
| 56 | | Step 5 | Partial apply (some resources created) | Document what was created; run destroy/rollback for failed resources; fix and retry | |
| 57 | |
| 58 | **Never** apply infrastructure changes to production without explicit user confirmation. Require confirmation before `terraform apply` or equivalent on prod. |
| 59 | |
| 60 | ## Completion |
| 61 | Infrastructure provisioned, secured, monitored, and documented. |