/alibabacloud-spec-ops:alibabacloud-writing-plansfrom alibabacloud-spec-ops
Converts approved Alibaba Cloud infrastructure designs into Terraform HCL code and CLI scripts. Delegates code generation to a dedicated skill and supports fast-track and modification modes.
Ships in alibabacloud-spec-ops. 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.
AUTHORITATIVE GUIDANCE — MANDATORY COMPLIANCE
This skill converts approved designs into executable Terraform HCL code. It does NOT execute anything. HCL 代码生成 MUST 通过调用
alibabacloud-spec-ops:alibabacloud-terraform-codegenskill 完成,禁止自行内联生成。
PREREQUISITE CHECK (internal — do not expose these checks to user)
Before proceeding, verify:
tasks/status.jsonexists withstatus: "designed"designs/design.mdexists with approved designIf missing, STOP and inform the user that design planning needs to complete first.
Activate when:
tasks/status.json for "mode" field: "fast-track" or "full" (default)tasks/status.json for "change_type" field: "modify" means update existing .tf files, not create from scratchalibabacloud-spec-ops:alibabacloud-terraform-codegen for HCL generationmain.tf file (no splitting)When tasks/status.json contains "change_type": "modify":
designs/terraform/~ modify and + add instead of all + create| Aspect | Fast Track | Full Mode |
|---|---|---|
| Design input | Simplified quick plan | Full design.md |
| Code generation | Same (terraform-codegen) | Same |
| File organization | Single main.tf | Single main.tf |
| User output | Minimal — just list generated files | Include schema verification details |
| Next step | Auto-invoke alibabacloud-validate (no user prompt — validation is read-only and risk-free) | Same |
in_progressThe planning skill rendered a 3-task TODO list when the user confirmed
the design. At the very start of this skill's run, update that list
via TodoWrite to mark task "生成 Terraform 代码" as in_progress.
Do this before loading the design — the user sees the spinner align
with what's happening.
Read .aliyun-ai-ops-spec/{name}/designs/design.md and extract:
Produce a structured resource manifest (mental model):
Resources to generate:
1. VPC (cidr: 10.0.0.0/16, name: xxx)
2. VSwitch x2 (zone_h, zone_i)
3. Security Group + Rules
4. ECS x2 (c6.large)
5. SLB (internet)
6. RDS MySQL 8.0 (HA)
...
CRITICAL: You MUST invoke the Skill tool with alibabacloud-spec-ops:alibabacloud-terraform-codegen here.
The terraform-codegen skill will:
How to invoke:
Use the Skill tool:
Skill:
skill: "alibabacloud-spec-ops:alibabacloud-terraform-codegen"
Then provide the terraform-codegen skill with a clear instruction based on the design:
"Based on the following design, generate complete Terraform HCL code for Alibaba Cloud:
[paste the structured resource manifest from Step 1]
Requirements:
- Region: {region from design}
- Resources: {list all resources with specs}
- Network: {VPC/subnet topology}
- Security: {SG rules, encryption, RAM}
- HA: {multi-AZ, backup configs}
IMPORTANT: Output ALL code in a single main.tf file. Do NOT split into separate files. File internal order: terraform {} → provider → variables → locals → data → resources → outputs"
After terraform-codegen produces the HCL, write ALL code into a single main.tf:
.aliyun-ai-ops-spec/{name}/designs/terraform/
└── main.tf # ALL code: terraform{}, provider, variables, locals, data, resources, outputs
MANDATORY rules:
main.tf — never split into variables.tf, outputs.tf, locals.tf, etc.terraform {} → provider → variables → locals → data sources → resources → outputsvariable MUST have a default value — ensures zero-input deployment without failureFor operations not supported by Terraform, create CLI scripts in .aliyun-ai-ops-spec/{name}/designs/cli/:
#!/bin/bash
# Operations that require Alibaba Cloud CLI
# Only for actions that Terraform cannot handle
# Example: DNS record verification, certificate validation, etc.
aliyun <service> <operation> --<args>
When to use CLI scripts (instead of Terraform):
Silently update .aliyun-ai-ops-spec/{name}/tasks/status.json to status: "plans-written". Do NOT mention this to the user.
The terraform-codegen skill provides capabilities that inline generation cannot:
| Capability | terraform-codegen | Inline generation |
|---|---|---|
| Query real resource schemas via IaCService | ✅ | ❌ |
| Verify attribute names against API | ✅ | ❌ |
| Consult latest Alibaba Cloud docs | ✅ | ❌ |
| Error recovery with documentation lookup | ✅ | ❌ |
| Correct provider version constraints | ✅ | ⚠️ |
| Data source usage for dynamic values | ✅ | ⚠️ |
The IaCService schema query ensures generated code uses correct, current attribute names — avoiding common issues like deprecated attributes, renamed fields, or invalid enum values.
TodoWrite:
completedin_progress"Terraform code generated successfully.
Generated:
main.tf— {N} resources, {M} variables, {K} outputs (all in single file)Code was generated with resource schemas verified via IaCService API.
Now running review (spec compliance + code quality)..."
alibabacloud-spec-ops:alibabacloud-validate — do NOT stop to ask the user. Validation is read-only (no cloud changes, no cost) and the next user-facing decision is whether to deploy, which alibabacloud-validate itself gates.Do NOT:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub aliyun/alibabacloud-agent-toolkit --plugin alibabacloud-spec-ops6 skills in this plugin
/alibabacloud-executing-plansExecute validated Terraform plans via Alibaba Cloud IaC Service. Requires explicit user confirmation before any apply operation. WHEN: execute terraform, apply infrastructure, run terraform apply, deploy infrastructure, create cloud resources, execute plan./alibabacloud-planningAct as an Alibaba Cloud expert to help users clarify requirements, design architecture, and plan infrastructure operations. Supports both Day-1 creation and Day-2 modification (scale, expand, adjust). WHEN: user mentions ECS, RDS, VPC, OSS, SLB, ACK, cloud resources, infrastructure needs, deploy on Alibaba Cloud, create server, setup database, cloud architecture, security group, scaling, load balancer, modify resources, upgrade instance, expand capacity, or any Alibaba Cloud service requirement./alibabacloud-ram-permission-diagnoseAlibaba Cloud RAM permission diagnosis and repair assistant. When an agent encounters any permission-related error while operating Alibaba Cloud resources (403, NoPermission, Forbidden, AccessDenied, InvalidSecurityToken, etc.), or when the user describes an Alibaba Cloud RAM permission issue, use this skill immediately. Do not wait for the user to explicitly request it — proactively start the diagnostic process whenever a permission error appears. Also applies when: a developer encounters permission issues while writing Alibaba Cloud SDK code, the user asks how to configure minimum permissions for an operation, or the user wants to know which permissions the current identity is missing.
/alibabacloud-terraform-codegenUse when the user wants Terraform HCL for Alibaba Cloud (Alicloud) infrastructure —
new project or extending an existing one. Covers VPC, ECS, ApsaraDB RDS, OSS,
SLB / ALB, Function Compute v3, ACK, and any other `alicloud_*` resource via the
provider's own documentation fetched at generation time. For AWS → Alicloud
migration or importing existing resources into state, use a different skill.
Triggers: "write terraform for alicloud", "generate alibaba cloud terraform",
"alicloud HCL", "create alibaba cloud vpc/ecs/rds", "生成阿里云 Terraform",
"阿里云 HCL", "用 Terraform 部署阿里云", "alicloud provider", "aliyun/alicloud",
"terraform-provider-alicloud".
/alibabacloud-validateValidate generated Terraform code against design requirements and quality standards. Dispatches spec compliance review and code quality review as parallel subagents. Remote syntax validation is owned by alibabacloud-terraform-codegen Step 6 and is NOT re-run here. WHEN: validate terraform, check code quality, review infrastructure code, run preflight checks, validate before deploy.Other plugins' skills for the same job