loom-terraform

loom-terraform is a skill for Claude Code from cosmix/loom. It costs 13 tokens per session (6,381 once invoked), scanned C, original, MIT.

A guide to managing cloud and server infrastructure with Terraform or OpenTofu, tools that describe infrastructure in configuration files. It covers reusable modules, state storage, providers, environments, and safe refactoring.

In plain words
What is it for?
Use it to structure infrastructure projects, configure remote state and locking, reuse modules, and manage development, staging, and production environments.
Why use it?
It helps keep infrastructure consistent across environments and reduces mistakes when changing, importing, or replacing resources.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it to structure infrastructure projects, configure remote state and locking, reuse modules, and manage development, staging, and production environments.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cosmix/loom/loom-terraform
View source ↗ cosmix/loom
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add cosmix/loom --skill loom-terraform
Clone the repo
git clone --depth 1 https://github.com/cosmix/loom

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for loom-terraform

README.md
[![agentmods](https://agentmods.dev/badge/skills/cosmix/loom/loom-terraform/github.svg)](https://agentmods.dev/skills/cosmix/loom/loom-terraform)
Your own site
<a href="https://agentmods.dev/skills/cosmix/loom/loom-terraform"><img src="https://agentmods.dev/badge/skills/cosmix/loom/loom-terraform/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for loom-terraform

Your own site · 80×15
<a href="https://agentmods.dev/skills/cosmix/loom/loom-terraform"><img src="https://agentmods.dev/badge/skills/cosmix/loom/loom-terraform.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 13 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,381 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00013 $0.06381
Opus 5 $0.00006 $0.03191
Sonnet 5 $0.00003 $0.01276
Haiku 4.5 $0.00001 $0.00638

Measured 6d ago against content hash 12047bde0616, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade C, and why

loom-terraform scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

| Corrupt provider cache | `rm -rf .terraform/ && tofu init` — do NOT delete `.terraform.lock.hcl` |
skills/loom-terraform/SKILL.md · 466 lines

How it starts

The opening of the file, as written. The whole thing — 466 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Terraform / OpenTofu

Overview

Terraform/OpenTofu infrastructure: module design, state/backends, multi-environment strategy, provider config, refactoring/import. Prefer tofu over terraform — OpenTofu is the Linux Foundation fork, config-compatible, and has capabilities OSS Terraform lacks (client-side state encryption). Command mapping table is at the end.

The single highest-value section is Expert Practices below — the anti-patterns/gotchas there are where naive-but-working configs go wrong.

Module & Configuration Design

Canonical layout — shared modules/, one root module per environment, lock file committed:

terraform/
├── modules/{vpc,eks,rds}/         # each: main.tf variables.tf outputs.tf versions.tf
├── environments/{dev,staging,prod}/  # each: main.tf backend.tf terraform.tfvars .terraform.lock.hcl
└── .terraform.lock.hcl

Principles: reusable modules with typed, validated, described inputs; providers pinned in required_providers; remote state with locking; locals for computed/DRY values; documented outputs; lifecycle rules where deletion/replacement risk exists.

Variable validation — validate at the boundary; contains() for enums, length/regex for shape:

variable "environment" {
  type = string
  validation {
    condition     = contains(["dev", "staging", "prod"], var.environment)
    error_message = "Environment must be dev, staging, or prod."
  }
}

Module composition — wire flat modules via input/output, never nest deep (see Anti-Patterns). Version external modules with ~>; pin internal git modules by tag ref=:

module "vpc" { source = "terraform-aws-modules/vpc/aws", version = "~> 5.0" }
module "internal" { source = "git::https://github.com/org/tf-modules.git//vpc?ref=v1.2.3" }

State & Backends

S3 with native locking (no DynamoDB):

terraform {
  backend "s3" {
    bucket       = "myorg-terraform-state"
    key          = "prod/eks/terraform.tfstate"
    region       = "us-west-2"
    encrypt      = true
    kms_key_id   = "arn:aws:kms:us-west-2:123456789012:key/..."
    use_lockfile = true   # native S3 conditional-write lock; no DynamoDB table/IAM
  }
}

Read the full file on GitHub · 466 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 466 lines · 13 tokens per session scan C 12047bde0616

Subscribe to this mod's changes

loom-terraform is a skill published in the GitHub repository cosmix/loom (54 stars, last pushed today), licensed MIT. It adds 13 tokens to every session and 6,381 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.