$npx -y skills add hashicorp/agent-skills --skill terraform-policyWrite, test, or convert Terraform Policy files (.policy.hcl, .policytest.hcl, Sentinel→tfpolicy). Triggers: policy.hcl, policytest, convert sentinel, tfpolicy, write a policy.
| 1 | # terraform-policy |
| 2 | |
| 3 | **UTILITY SKILL** — INVOKES: [tfpolicy-author](references/tfpolicy-author.md) | [tfpolicy-test](references/tfpolicy-test.md) |
| 4 | |
| 5 | ## USE FOR: |
| 6 | |
| 7 | - Writing a new `.policy.hcl` policy from a description or requirement |
| 8 | - Converting a `.sentinel` policy to Terraform Policy |
| 9 | - Writing or debugging a `.policytest.hcl` test file |
| 10 | - Migrating a Sentinel policy library to Terraform Policy |
| 11 | |
| 12 | ## DO NOT USE FOR: |
| 13 | |
| 14 | - Writing `.tftest.hcl` files for Terraform modules — use `terraform-test` |
| 15 | - General Terraform HCL authoring — use `terraform-style-guide` |
| 16 | |
| 17 | ## Routing |
| 18 | |
| 19 | | Task | Sub-skill | |
| 20 | |------|-----------| |
| 21 | | Write or convert a `.policy.hcl` policy | [tfpolicy-author](references/tfpolicy-author.md) | |
| 22 | | Write or debug a `.policytest.hcl` test | [tfpolicy-test](references/tfpolicy-test.md) | |
| 23 | |
| 24 | ## Examples |
| 25 | |
| 26 | - "Block EC2 instances without encryption" → [tfpolicy-author](references/tfpolicy-author.md) |
| 27 | - "Convert this Sentinel policy to tfpolicy" → [tfpolicy-author](references/tfpolicy-author.md) |
| 28 | - "Write a policytest for my EBS policy" → [tfpolicy-test](references/tfpolicy-test.md) |
| 29 | |
| 30 | ## Troubleshooting |
| 31 | |
| 32 | - **Wrong skill triggered?** Load the sub-skill directly from the routing table above. |
| 33 | |
| 34 | ```bash |
| 35 | npx skills add hashicorp/agent-skills/terraform/terraform-policy/skills/tfpolicy-author |
| 36 | npx skills add hashicorp/agent-skills/terraform/terraform-policy/skills/tfpolicy-test |
| 37 | ``` |