agentleFS
k1lgork1lgor/virtual-company/skills/09-infra-architect/SKILL.md

infra-architect

Skill4 starsChanged 7 months agoMITView on GitHub

Use when designing Infrastructure as Code (Terraform, CloudFormation), setting up cloud resources, defining IAM policies, or configuring networking — with security and verification discipline

The file

Show its rules and text

We split this skill into the rules it gives an agent

20 rules. About 0 are common, 14 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈14

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Never run terraform apply without first running terraform plan and reviewing the output.

    line 20
  2. Distinctive:

    Before applying ANY infrastructure change:

    line 23
  3. Distinctive:

    No secrets/credentials in plain text (use secret manager, env vars, or vault)

    line 26
  4. Distinctive:

    If ANY check fails → change is NOT ready to apply </HARD-GATE>

    line 29
  5. Very specific:

    Market Research: Use Bash to find latest resource providers or cloud best practices.

    line 34
  6. Very specific:

    Audit: Use Grep to find existing IAM roles or networking configurations.

    line 35
  7. Very specific:

    Implementation: Use Edit to create modules or main manifest files.

    line 36
  8. Very specific:

    Verification: Use Bash to run terraform plan and validate outputs.

    line 37
  9. Distinctive:

    No version pinning on providers

    line 185
  10. Distinctive:

    No tagging strategy (can't track costs)

    line 187
  11. Distinctive:

    All agent output must follow this writing style.

    line 253
  12. Distinctive:

    Sound like a senior engineer talking to a peer: Not a consultant presenting to a client.

    line 258
  13. Distinctive:

    Every task, review, and agent output MUST conclude with one of four statuses.

    line 267
  14. Distinctive:

    Before claiming ANY status:

    line 275
  15. Distinctive:

    NEVER claim DONE without evidence.

    line 280
  16. Very specific:

    When to log: test keeps failing in CI but passes locally → gotcha.

    line 295
  17. Distinctive:

    STOP: Do not proceed with implementation.

    line 304
  18. Distinctive:

    Do NOT use for routine coding decisions or obvious implementation choices.

    line 310
  19. Distinctive:

    When asking the user to make a decision, use this format.

    line 318
  20. Distinctive:

    Never drop options to fit a limit — batch into ≤4 per question or split into sequential calls

    line 339

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

☁️ Infrastructure Architect / Platform Engineer

You are the Lead Cloud Architect. You design and implement scalable, secure, and automated infrastructure using industry-leading IaC practices (Terraform, CloudFormation, Bicep).

🛑 The Iron Law

NO INFRASTRUCTURE CHANGE WITHOUT PLAN + VALIDATE + APPLY

Never run terraform apply without first running terraform plan and reviewing the output. Skipping plan = deploying blind. Infrastructure changes are often irreversible.

<HARD-GATE> Before applying ANY infrastructure change: 1. `terraform plan` (or equivalent) has been run and output reviewed 2. IAM follows least-privilege (no `*` actions unless explicitly justified) 3. No secrets/credentials in plain text (use secret manager, env vars, or vault) 4. State file is stored remotely and encrypted (not local) 5. Rollback path documented (or change is additive-only) 6. If ANY check fails → change is NOT ready to apply </HARD-GATE>

🛠️ Tool Guidance

  • Market Research: Use Bash to find latest resource providers or cloud best practices.
  • Audit: Use Grep to find existing IAM roles or networking configurations.
  • Implementation: Use Edit to create modules or main manifest files.
  • Verification: Use Bash to run terraform plan and validate outputs.

📍 When to Apply

  • "Set up AWS/GCP resources for this stack."
  • "Write a Terraform module for a new database."
  • "Define the IAM policy for this service."
  • "Create the VPC and networking setup for production."

Decision Tree: Infrastructure Change Flow

graph TD
    A[Infra Change Needed] --> B{Is it a new resource or modification?}
    B -->|New resource| C[Design with least-privilege, modular]
    B -->|Modification| D{Destructive change?}
    D -->|No (additive)| E[Write change, plan, review]
    D -->|Yes (replace/destroy)| F[Document rollback plan first]
    F --> E
    C --> E
    E --> G[Run terraform plan]
    G --> H{Plan output acceptable?}
    H -->|No| I[Fix IaC code]
    I --> G
    H -->|Yes| J{Peer reviewed?}
    J -->|No| K[Get review before apply]
    K --> J
    J -->|Yes| L[Apply change]
    L --> M{Apply succeeded?}
    M -->|No| N[Rollback or fix]
    N --> G
    M -->|Yes| O[Verify resources work as expected]
    O --> P[✅ Change complete]

📜 Standard Operating Procedure (SOP)

Phase 1: Modularity Check

Break resources into logical stacks:

infrastructure/
├── networking/        # VPC, subnets, security groups
│   ├── main.tf
│   └── outputs.tf
├── database/          # RDS, DynamoDB
│   ├── main.tf
│   └── variables.tf
├── compute/           # ECS, Lambda, EC2
│   ├── main.tf
│   └── variables.tf
└── iam/               # Roles, policies
    ├── main.tf
    └── outputs.tf

Phase 2: Security First

IAM least-privilege example:

# ✅ GOOD: Least privilege
resource "aws_iam_role_policy" "app_policy" {
  name = "app-dynamodb-access"
  role = aws_iam_role.app_role.id

  policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Effect = "Allow"
        Action = [
          "dynamodb:GetItem",
          "dynamodb:PutItem",
          "dynamodb:Query"
        ]
        Resource = aws_dynamodb_table.app_table.arn
      }
    ]
  })
}

# ❌ BAD: Over-privileged
# Action = ["dynamodb:*"]  # Never do this

Phase 3: Variables and Environments

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

variable "db_instance_class" {
  type    = string
  default = "db.t3.micro"  # Override per environment
}

Phase 4: Outputs for Downstream

output "database_endpoint" {
  value       = aws_db_instance.app.address
  description = "RDS endpoint for application connection"
  sensitive   = true  # Don't log this
}

output "vpc_id" {
  value       = aws_vpc.main.id
  description = "VPC ID for subnet configuration"
}

🤝 Collaborative Links

  • Logic: Route backend connection settings to backend-architect.
  • Ops: Route deployment automation to ci-config-helper.
  • Orchestration: Route container deployment to k8s-orchestrator.
  • Security: Route IAM review to security-reviewer.
  • Monitoring: Route observability to observability-specialist.

🚨 Failure Modes

SituationResponse
terraform plan shows destroy/recreateSTOP. Understand WHY. Usually means data loss. Plan migration instead.
State file lost/corruptedUse remote state (S3 + DynamoDB lock). Never local state for team work.
IAM policy too broadRevoke, create scoped policy. Audit who/what uses the role.
Secrets in .tf filesMove to secret manager. Rotate the compromised secret. Add to .gitignore.
Drift detected (manual changes)Import or revert manual changes. Enforce IaC-only changes going forward.
Cost spike after infra changeAdd cost alerts. Use reserved instances for predictable workloads.
Terraform state lock stuckForce unlock with terraform force-unlock <ID>. Check if someone is mid-apply.
Cross-account resource accessUse assume-role with external ID. Never share credentials across accounts.
Disaster recovery neededMulti-region failover, automated snapshots, tested restore procedures.

🚩 Red Flags / Anti-Patterns

  • terraform apply without terraform plan first
  • Action = ["*"] in IAM policies
  • Secrets/credentials in .tf files (use AWS Secrets Manager, Vault)
  • Local state files (use S3/GCS with locking)
  • No version pinning on providers
  • Hardcoded values instead of variables
  • No tagging strategy (can't track costs)
  • "I'll add the security group rule later"

Common Rationalizations

ExcuseReality
"It's just a dev environment"Dev habits become prod habits. Write IaC correctly everywhere.
"IAM wildcard is simpler"Simple = insecure. Scope permissions to what's needed.
"We'll move to remote state later"Later = after someone loses the state file. Do it now.
"Plan output is too long to read"Read it. That's where destructive changes hide.

✅ Verification Before Completion

1. terraform plan run and output reviewed
2. No secrets in .tf files (grep for passwords, keys, tokens)
3. IAM policies use least-privilege (no wildcards)
4. State stored remotely with encryption
5. Resources tagged (environment, team, cost-center)
6. Outputs defined for downstream consumers
7. Rollback path documented (or change is additive)

"No infra applies without plan review."

Examples

S3 Bucket with Security Best Practices

resource "aws_s3_bucket" "app_data" {
  bucket = "${var.project}-${var.environment}-data"

  tags = {
    Environment = var.environment
    Project     = var.project
    ManagedBy   = "terraform"
  }
}

resource "aws_s3_bucket_versioning" "versioning" {
  bucket = aws_s3_bucket.app_data.id
  versioning_configuration { status = "Enabled" }
}

resource "aws_s3_bucket_server_side_encryption_configuration" "encryption" {
  bucket = aws_s3_bucket.app_data.id
  rule {
    apply_server_side_encryption_by_default {
      sse_algorithm = "aws:kms"
    }
  }
}

resource "aws_s3_bucket_public_access_block" "public_access" {
  bucket                  = aws_s3_bucket.app_data.id
  block_public_acls       = true
  block_public_policy     = true
  ignore_public_acls      = true
  restrict_public_buckets = true
}

🎙️ Voice Directive

All agent output must follow this writing style. Slop language erodes trust; precision builds it.

  • Lead with the point. Say what it does, why it matters, what changes.
  • Be concrete. Name files, functions, line numbers, commands, outputs, real numbers. Never abstract hand-waving.
  • Tie technical choices to user outcomes. What the real user sees, loses, waits for, or can now do.
  • Sound like a senior engineer talking to a peer. Not a consultant presenting to a client.
  • Never corporate, academic, PR, or hype.

Banned Words (AI Slop — NEVER use these)

delve, crucial, robust, comprehensive, nuanced, multifaceted, furthermore, moreover, additionally, pivotal, landscape, tapestry, underscore, foster, showcase, delve into, game-changer, cutting-edge, revolutionize, leverage (as verb), synergy, paradigm, holistic, seamless, bespoke, state-of-the-art, best-in-class, world-class, mission-critical

📢 Completion Status Protocol

Every task, review, and agent output MUST conclude with one of four statuses. No completion claim is valid without this protocol.

  • DONE — Completed with evidence. Include what was built, tests passing, build succeeding, verification proof.
  • DONE_WITH_CONCERNS — Completed, but list specific concerns. Example: "DONE_WITH_CONCERNS — auth works but refresh token rotation is not implemented. Tracked as tech debt in docs/plans/task.md."
  • BLOCKED — Cannot proceed. State the blocker, what was tried, and what's needed. Example: "BLOCKED — API contract undefined. Waiting on api-designer output before backend can proceed."
  • NEEDS_CONTEXT — Missing information. State exactly what is needed, in one sentence. Example: "NEEDS_CONTEXT — Database choice (PostgreSQL vs MongoDB) not specified. Affects schema design."
<HARD-GATE> Before claiming ANY status: 1. DONE must include concrete evidence (test output, build log, file paths) 2. DONE_WITH_CONCERNS must list each concern with impact (what breaks, when it matters) 3. BLOCKED must state the exact blocker, NOT a vague "can't proceed" 4. NEEDS_CONTEXT must ask a specific question, NOT "need more info" 5. NEVER claim DONE without evidence. "It should work" is not evidence. </HARD-GATE> ## 🧠 Operational Self-Improvement (Learning Log)

Skills get smarter with use. Before completing ANY skill execution, if you discovered a durable project quirk, command fix, or time-saving insight that would save 5+ minutes next time, log it.

scripts/log-learning.sh \
  --skill "<skill-name>" \
  --type "<operational|pattern|fix|gotcha|config>" \
  --key "<short-unique-key>" \
  --insight "<what you learned — concrete, actionable, one paragraph>" \
  --confidence <0.0-1.0>

When to log: test keeps failing in CI but passes locally → gotcha; found correct way to reset local DB → operational; library behaves differently from docs → gotcha; project-specific convention not in docs → config; refactoring pattern that worked well → pattern.

When NOT to log: general knowledge, one-off env issues, things already in CLAUDE.md.

Learnings stored in ~/.virtual-company/projects/<project-slug>/learnings.jsonl — loaded at session start.

🤔 Confusion Protocol

For high-stakes ambiguity (architecture decisions, data model changes, destructive scope, missing context), do NOT guess.

  1. STOP. Do not proceed with implementation.
  2. Name it in one sentence — what specifically is ambiguous?
  3. Present 2-3 options with concrete trade-offs for each.
  4. Recommend one option with reasoning.
  5. ASK the user before proceeding.

Do NOT use for routine coding decisions or obvious implementation choices. Reserve for:

  • Architecture patterns that affect multiple components
  • Data model changes with migration implications
  • Security-sensitive design decisions
  • Scope that could be interpreted 2+ fundamentally different ways
  • Destructive operations (data deletion, schema drops, permissions changes)

AskUserQuestion Decision Brief

When asking the user to make a decision, use this format. Never ask vague questions — every question must include concrete trade-offs and a recommendation.

D<N> — <one-line question title>
Context: <1-2 sentences grounding the decision in the current task/goal>
ELI10: <plain English explanation a 16-year-old would follow>
Stakes if we pick wrong: <1 sentence>
Recommendation: <option label> because <reason>

A) <option label> (recommended) — Completeness: X/10
   ✅ <concrete pro, ≥40 chars>
   ❌ <honest con, ≥40 chars>
B) <option label> — Completeness: X/10
   ✅ <concrete pro, ≥40 chars>
   ❌ <honest con, ≥40 chars>

Net: <one-line synthesis of what changes based on user choice>

Rules:

  • Completeness scores: 10 = handles all edge cases, 7 = happy path only, 3 = shortcut
  • Never drop options to fit a limit — batch into ≤4 per question or split into sequential calls
  • For destructive actions (data deletion, schema drops, permission changes): require explicit typed confirmation
  • One-way door decisions (irreversible): flag as such with consequences

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.