terraform-provider-stackgen

sg_skill (Resource)

⚠️ Experimental — Manages a manually created Guild skill from SKILL.md content. Do not use this resource for skills synced via sg_skill_source. Companion files are create-only; changing them forces replacement.

Create-time 409 adoption is controlled by the provider attribute adopt_on_conflict (default true). Adoption lists provider=manual and matches the front-matter name exactly.

Example Usage

# When to use: Create a manual Guild skill from SKILL.md content (YAML front
# matter + Markdown body). Front matter must include a stable `name:`.
# Companion files are create-only (changing forces replace).
#
# Related: sg_agent.skills (attach by computed name), data.sg_skill (lookup).
resource "sg_skill" "kubectl_readonly" {
  skill_md = <<-SKILL
    ---
    name: kubectl-readonly
    description: Read-only Kubernetes inspection helpers for SRE agents.
    ---

    # kubectl-readonly

    Use these helpers to inspect cluster state without mutating resources.
    Prefer `kubectl get` / `describe` over apply or delete.
  SKILL

  files = [
    {
      kind    = "script"
      path    = "scripts/node-ready.sh"
      content = "#!/usr/bin/env bash\nset -euo pipefail\nkubectl get nodes -o wide\n"
    },
  ]
}

# Prefer agent.skills = [name] for startup materialization (do not wait on search_skill).
resource "sg_agent" "sre" {
  name   = "sre-kubectl-helper"
  skills = [sg_skill.kubectl_readonly.name]
}

Import

Import an existing sg_skill using its skill ID:

terraform import sg_skill.example '123e4567-e89b-12d3-a456-426614174000'

Schema

Required

Optional

Read-Only

Nested Schema for files

Required:

Optional: