state-management

state-management is a skill for Claude Code from sawrus/agent-guides. It costs 24 tokens per session (1,078 once invoked), scanned A, original, MIT.

A guide to managing Terraform state, the record Terraform uses to track the real infrastructure it controls. It covers remote storage, separate state for environments and components, locking, imports, moves, and careful state edits.

In plain words
What is it for?
Use it when setting up S3, GCS, or Terraform Cloud backends; fixing state locks; importing existing resources; separating environments; or moving and removing resources from state.
Why use it?
It helps prevent conflicting changes, lost resource tracking, and unsafe manual fixes when infrastructure is managed by multiple people or deployments.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it when setting up S3, GCS, or Terraform Cloud backends; fixing state locks; importing existing resources; separating environments; or moving and removing resources from state.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sawrus/agent-guides/state-management
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 sawrus/agent-guides --skill state-management
Clone the repo
git clone --depth 1 https://github.com/sawrus/agent-guides

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 state-management

README.md
[![agentmods](https://agentmods.dev/badge/skills/sawrus/agent-guides/state-management.svg)](https://agentmods.dev/skills/sawrus/agent-guides/state-management)
Your own site
<a href="https://agentmods.dev/skills/sawrus/agent-guides/state-management"><img src="https://agentmods.dev/badge/skills/sawrus/agent-guides/state-management.svg" alt="Measured on agentmods" height="20"></a>
Per session 24 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,078 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00024 $0.01078
Opus 5 $0.00012 $0.00539
Sonnet 5 $0.00005 $0.00216
Haiku 4.5 $0.00002 $0.00108

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

Security

Grade A, and why

state-management scanned grade A with 0 findings 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 8d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

areas/devops/infrastructure/skills/state-management/SKILL.md · 160 lines

How it starts

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

Skill: Terraform State Management

Expertise: Remote backends, state isolation, import, mv, rm, state surgery, cross-stack references.

When to load

When setting up a new Terraform backend, debugging state lock, importing manually-created resources, or safely moving resources between state files.

Backend Setup Patterns

# AWS S3 + DynamoDB lock
terraform {
  backend "s3" {
    bucket         = "mycompany-terraform-state"
    key            = "${var.environment}/${var.component}/terraform.tfstate"
    region         = "us-east-1"
    encrypt        = true
    kms_key_id     = "alias/terraform-state"
    dynamodb_table = "terraform-state-lock"
  }
}

# GCS (GCP) — built-in locking, no separate lock table needed
terraform {
  backend "gcs" {
    bucket = "mycompany-terraform-state"
    prefix = "${var.environment}/${var.component}"
  }
}

# Terraform Cloud / HCP Terraform
terraform {
  cloud {
    organization = "mycompany"
    workspaces { name = "production-network" }
  }
}

State Isolation (per environment × component)

state/
├── staging/
│   ├── network/terraform.tfstate
│   ├── k8s-cluster/terraform.tfstate
│   └── databases/terraform.tfstate
└── production/
    ├── network/terraform.tfstate
    ├── k8s-cluster/terraform.tfstate
    └── databases/terraform.tfstate

Rule: Staging and production must use separate state files (separate key/prefix, ideally separate bucket).

Cross-Stack Values (avoid terraform_remote_state)

# ✅ Publish outputs to SSM Parameter Store
resource "aws_ssm_parameter" "vpc_id" {
  name  = "/${var.environment}/network/vpc_id"
  type  = "String"
  value = aws_vpc.this.id
}

# ✅ Consume in another stack via data source
data "aws_ssm_parameter" "vpc_id" {
  name = "/${var.environment}/network/vpc_id"
}

resource "aws_subnet" "app" {
  vpc_id = data.aws_ssm_parameter.vpc_id.value
}

State Import (bring unmanaged resource under TF control)

# 1. Write the resource block in .tf first
resource "aws_s3_bucket" "legacy" {
  bucket = "my-legacy-bucket"
}

# 2. Import the existing resource
terraform import aws_s3_bucket.legacy my-legacy-bucket

# 3. Run plan — should show no changes if .tf matches reality
terraform plan   # should be: "No changes."

Read the full file on GitHub · 160 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. 8d ago First seen · 160 lines · 24 tokens per session scan A f2835318784e

Subscribe to this mod's changes

state-management is a skill published in the GitHub repository sawrus/agent-guides (17 stars, last pushed 7d ago), licensed MIT. It adds 24 tokens to every session and 1,078 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

shipping-and-launch

Prepares production launches. Use when preparing to deploy to production. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.

addyosmani/agent-skills · 45 tokens

aws-serverless

Specialized skill for building production-ready serverless applications on AWS. Covers Lambda functions, API Gateway, DynamoDB, SQS/SNS event-driven patterns, SAM/CDK deployment, and cold start optimization.

sickn33/agentic-awesome-skills · 45 tokens

apify-actor-development

Important: Before you begin, fill in the generatedBy property in the meta section of .actor/actor.json. Replace it with the tool and model you're currently using, such as "Claude Code with Claude Sonnet 4.5". This helps Apify monitor and improve AGENTS.md for specific AI tools and models.

sickn33/agentic-awesome-skills · 71 tokens

aws-serverless-eda

AWS serverless and event-driven architecture expert based on Well-Architected Framework. Use when building serverless APIs, Lambda functions, REST APIs, microservices, or async workflows.

sickn33/agentic-awesome-skills · 42 tokens

appdeploy

Deploy web apps with backend APIs, database, and file storage. Use when the user asks to deploy or publish a website or web app and wants a public URL. Uses HTTP API via curl.

sickn33/agentic-awesome-skills · 42 tokens

aws-cdk-development

AWS Cloud Development Kit (CDK) expert for building cloud infrastructure with TypeScript/Python.

sickn33/agentic-awesome-skills · 24 tokens