platform-skills / rules
Cursor rule61 starsChanged 2 months agoApache-2.0View on GitHub
Terraform module and resource generation rules — blast radius, IAM least privilege, SOC 2 defaults
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,531 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository7 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/keda.mdcCursor rule
- .cursor/rules/kubernetes.mdcCursor rule
- .cursor/rules/platform-skills.mdcCursor rule
- platform-skillsSkill
- platform-skillsSkill
The file
We split this terraform.mdc into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
Every Terraform module must have: main.tf, variables.tf, outputs.tf, versions.tf, README.md.
- Distinctive: line 103
Before every destructive operation, state:
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
---
description: Terraform module and resource generation rules — blast radius, IAM least privilege, SOC 2 defaults
globs: ["**/*.tf", "**/*.tfvars"]
alwaysApply: false
---
# Terraform Rules
## Module structure
Every Terraform module must have: `main.tf`, `variables.tf`, `outputs.tf`, `versions.tf`, `README.md`.
## Variable validation — always include
```hcl
variable "environment" {
type = string
validation {
condition = contains(["dev", "staging", "production"], var.environment)
error_message = "environment must be dev, staging, or production"
}
}
```
## Pipeline order — enforce all gates before plan
`terraform fmt -check` → `terraform validate` → `tflint` → `checkov`/`tfsec` → `plan`
## IAM — never generate wildcards
```hcl
# ❌ Never
statement {
actions = ["*"]
resources = ["*"]
}
# ✅ Always
statement {
actions = ["s3:GetObject", "s3:ListBucket"]
resources = ["arn:aws:s3:::my-bucket", "arn:aws:s3:::my-bucket/*"]
}
```
## Tagging — always enforce at provider level
```hcl
provider "aws" {
default_tags {
tags = { env = var.environment, team = var.team, managed-by = "terraform" }
}
}
```
## SOC 2 — never generate
- `publicly_accessible = true` on RDS, Redshift, OpenSearch
- `encrypted = false` on any storage (S3, EBS, RDS, DynamoDB, ElastiCache, EFS)
- `is_multi_region_trail = false` on CloudTrail
- `enable_log_file_validation = false` on CloudTrail
- `skip_final_snapshot = true` on production databases
- `deletion_protection = false` on production databases
- `enable = false` on GuardDuty
- `:latest` image tags in any resource
## SOC 2 — always generate on data resources
```hcl
resource "aws_kms_key" "..." {
enable_key_rotation = true # CC6.7
deletion_window_in_days = 30
}
resource "aws_cloudtrail" "..." {
is_multi_region_trail = true # CC7.2
enable_log_file_validation = true
kms_key_id = aws_kms_key.cloudtrail.arn
}
resource "aws_db_instance" "..." {
storage_encrypted = true
backup_retention_period = 35 # A1.2
deletion_protection = true
skip_final_snapshot = false
multi_az = true
}
```
## State backend — always encrypt
```hcl
terraform {
backend "s3" {
encrypt = true
kms_key_id = var.kms_key_arn
dynamodb_table = "terraform-state-lock"
}
}
```
## Blast radius note
Before every destructive operation, state:
- What gets replaced (forces new resource)
- What downstream resources depend on it
- Mid-apply failure impact
- Rollback path
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

