agentleFS
hasansezertasanhasansezertasan/infra-copilot/skills/setup/SKILL.md

setup

Skill2 starsChanged 2 months agoMITView on GitHub

Greenfield bootstrap of a Terraform + Cloudflare + GitHub infra repo with either HCP Terraform (cloud block) or object-storage backend (GCS/S3/Azure + GitHub Actions). Wires state, the Cloudflare token, and the GitHub App, then reaches a green first plan on both leaves. Use when nothing is wired up yet. Not for adopting resources that already exist (infra-copilot:import), nor for provisioning new ones in a working repo (infra-copilot:add).

193 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use add-slack, add-parallel and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • MicrosoftSkill

    add-slack

    Add Slack channel integration via Chat SDK.

    Also in 6 projects that use this

  • MicrosoftSkill

    add-parallel

    Also in 5 projects that use this

  • sskarzSkill

    add-telegram-swarm

    Add Agent Swarm (Teams) support to Telegram. Each subagent gets its own bot identity in the group. Requires Telegram channel to be set up first (use /add-telegram). Triggers on "agent swarm", "agent teams telegram", "telegram swarm", "bot pool".

    Also in 5 projects that use this

  • +9 more from microsoft

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 0 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 171 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

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

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

    Respect the actor split: Run AGENT steps yourself. On a HUMAN step, stop, emit the handoff block, wait for done, re-run the check — never …

    line 79
  2. Very specific:

    If the domain/repos already exist, continue with infra-copilot:import to adopt them (plan should then show imports, not creates).

    line 164
  3. Very specific:

    Never fake a HUMAN step. A signup, a dashboard click and a secret paste are the human's, and the agent must never see a pasted secret in …

    line 176
  4. Very specific:

    All org-specific values — HCP org, GitHub org, apex domain, Cloudflare account/zone IDs, managed repos, HCP status-check ID — live in …

    line 194

“Common” is measured: kept by at least 6 in 10 of the 171 edited versions of this file we could read. “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
<!-- AI-RULEZ :: GENERATED FILE — DO NOT EDIT Content-Hash: blake3:49caa2c2987b6abb4b7b2d46a7d6c59e510e65a7a5b532643d438204a7725291 Source-Hash: blake3:3437c8021985fde0d012440ff680b556bdb5cb2d5225aef09511ba92b91f4f6e Schema-Version: v1 -->

infra-copilot: setup

Greenfield bootstrap. You (the agent) execute it end-to-end, pausing only for the steps a human irreducibly must do. This file is a router: the reusable machinery — actor model, handoff block, resume scan, preflight — lives in ../infra-copilot/references/protocol.md; the per-step manifest in ../infra-copilot/references/steps.yaml (phases 0–4); per-provider detail and the canonical docs under ../infra-copilot/references/.

This is a Skill, not a script. There is no setup executable. Drive it by reading this file, the protocol, and the manifest, then running each step. A human invokes it with /infra-setup or by saying "set up the infra."

Scope

setup owns the cold start: from an empty repo to green plans on both leaves.

HCP mode (backend: hcp)

#PhaseActorsDeep dive
0Toolchain + HCP bootstrap — commit reviewed pins, sign up, terraform login, get the pivot tokenHUMAN then AGENT../infra-copilot/references/docs/setup.md#6, ../infra-copilot/references/hcp.md, ../infra-copilot/references/docs/setup.md#1
1HCP workspaces — create cloudflare + github-org, VCS + safety togglesAGENT (API) + HUMAN VCS OAuth../infra-copilot/references/hcp.md, ../infra-copilot/references/docs/setup.md#2
2Cloudflare — mint scoped token, paste into HCP, verifyHUMAN mint/paste, AGENT verify../infra-copilot/references/cloudflare.md
3GitHub — create + install the GitHub App, paste creds into HCPHUMAN create/install/paste, AGENT verify../infra-copilot/references/github.md
4Narrow the credential, then first plan — hand off to a plan-only HCP identity, then init + speculative plan per leaf, read via APIHUMAN handoff, then AGENT../infra-copilot/references/steps.yaml (hcp-apply-scope), ../infra-copilot/references/docs/hcp-api.md

Object-storage mode (backend: object-storage)

#PhaseActorsDeep dive
0Toolchain + state bucket — commit reviewed pins, create versioned bucket, configure backend.tf blocksHUMAN then AGENT../infra-copilot/references/docs/object-storage-state.md#object-storage-backend
1GitHub Actions CI — create plan/apply workflows, configure GitHub Environment protectionAGENT then HUMAN../infra-copilot/references/docs/object-storage-ci.md#github-actions
2Cloudflare — mint scoped token, add CLOUDFLARE_API_TOKEN to GitHub Actions secrets, verifyHUMAN mint/save, AGENT verify../infra-copilot/references/cloudflare.md
3GitHub — create + install GitHub App, add secrets (GH_APP_ID, GH_APP_INSTALLATION_ID, GH_APP_PEM) to GitHub ActionsHUMAN create/install/save, AGENT verify../infra-copilot/references/github.md
4First plan — verify plan-cloudflare and plan-github jobs succeed in GitHub ActionsAGENT../infra-copilot/references/steps.yaml, ../infra-copilot/references/docs/object-storage-ci.md#github-actions

Adopting resources that already exist (a live domain, existing repos)? That's infra-copilot:import (Phase 5), run after this reaches green plans.

⚠️ Pre-existing resources — stop before applying. Unlike the old monolith, setup ends at green speculative plans (phase 4) and does not auto-import. If the phase-4 plan shows resources as will be created that you know already exist live — a domain already serving traffic, repos already on GitHub — do not apply: an apply would recreate or clobber them. Run infra-copilot:import first to adopt them (the plan should then read imports, not creates), and only then apply.

Workflow

  1. Read config first (shared protocol, Step 0). Load .infra-copilot/config.md, or use .claude/infra-copilot.local.md as the migration fallback, and export the org vars. If both are missing → handoff, offer to scaffold, wait. For a new setup, recommend object-storage first. Explain HCP's managed runs and UI, its free tier's 500-resource limit, and this workflow's required paid tier with team management for the plan-only credential, even below 500 resources. Ask for the choice using the shared protocol, then always write backend: object-storage or backend: hcp explicitly. Existing configs without backend stop for the migration handoff; existing cloud {} blocks prompt an offer to record backend: hcp, never an automatic mode switch. See ../infra-copilot/references/config.md.
  2. Bootstrap preflight, then resume scan over phases 0–4 of ../infra-copilot/references/steps.yaml. On a cold repo, check that mise itself is available, then scan toolchain-pin before running the pin-dependent preflight checks. Once it is green, finish preflight, handle the optional repo-config-sync step, print ✓, and continue from hcp-login (HCP mode) or state-bucket (object-storage mode). Full contract: ../infra-copilot/references/protocol.md.
  3. Respect the actor split. Run AGENT steps yourself. On a HUMAN step, stop, emit the handoff block, wait for done, re-run the check — never fake a signup, a dashboard click, or a secret paste.
  4. Route to the deep-dives under ../infra-copilot/references/ for the fine print; don't duplicate them.

Phase notes

HCP mode:

  • Phase 0 — Toolchain + HCP bootstrap. The first HUMAN step chooses exact tool versions, reviews the whole mise.toml, and commits it with mise.lock; this must happen before pin-dependent preflight. If the consuming repository ships an executable scripts/sync-config.sh, stop for a human to review and run it next, then verify its deterministic changes and canonical config were committed together; repositories without the helper skip this step. Then HUMAN signs up + runs terraform login, after which you own the HCP API. Toolchain sequence: ../infra-copilot/references/docs/setup.md#6. HCP commands + verify: ../infra-copilot/references/hcp.md.
  • Phase 1 — HCP workspaces. Two workspaces (cloudflare, github-org), one per leaf. A human does the one-time GitHub↔HCP OAuth (browser); you create both via the API with the right working dir, path-scoped triggers, remote execution, and auto-apply off. create_ws helper + safety rationale: ../infra-copilot/references/hcp.md.
  • Phase 2 — Cloudflare. You can't mint a scoped token from nothing and must never see the plaintext — minting/pasting are HUMAN, verifying is AGENT. ../infra-copilot/references/cloudflare.md.
  • Phase 3 — GitHub. The github-org workspace authenticates as a GitHub App, not a PAT. Creation + install are browser flows; three creds get pasted into HCP. ../infra-copilot/references/github.md.
  • Phase 4 — First plan. Prove every credential end-to-end. Per leaf: terraform init then speculative terraform plan (runs in HCP). A VCS-connected workspace allows plan but blocks apply from the CLI — intentional. Read plans without the UI via ../infra-copilot/references/docs/hcp-api.md. Green on both leaves = credentials proven.

Object-storage mode:

  • Phase 0 — Toolchain + state bucket. Tool versions are committed in mise.toml + mise.lock. HUMAN creates the versioned, private state bucket with locking configured. AGENT writes backend.tf blocks in each leaf pointing to the state bucket. ../infra-copilot/references/docs/object-storage-state.md#object-storage-backend.
  • Phase 1 — GitHub Actions CI. AGENT creates .github/workflows/terraform-plan.yml and terraform-apply.yml. HUMAN restricts the production GitHub Environment to main and adds required reviewers where the plan offers them, or locks an Apply gate decision. ../infra-copilot/references/docs/object-storage-ci.md#github-actions.
  • Phase 2 — Cloudflare. HUMAN mints scoped token and adds CLOUDFLARE_API_TOKEN to GitHub Actions secrets; AGENT verifies. ../infra-copilot/references/cloudflare.md.
  • Phase 3 — GitHub. HUMAN creates/installs GitHub App and adds GH_APP_ID, GH_APP_INSTALLATION_ID, and GH_APP_PEM to GitHub Actions secrets; AGENT verifies. ../infra-copilot/references/github.md.
  • Phase 4 — First plan. Trigger or inspect GitHub Actions plan workflows for cloudflare and github leaves; verify both jobs succeed. Align required status check job names. ../infra-copilot/references/docs/object-storage-ci.md#github-actions.

Validation

Setup is complete when you can report:

  • ✓ .infra-copilot/config.md explicitly records the chosen backend.

For HCP mode (backend: hcp):

  • ✓ mise.toml + mise.lock are reviewed, committed together, exact-pinned, and installable with MISE_LOCKED=1.
  • ✓ HCP org $ORG + project infra reachable via API.
  • ✓ Workspaces cloudflare and github-org exist, VCS-linked, auto-apply off, fork speculative plans off.
  • ✓ Both workspaces use the exact Terraform version committed in mise.toml.
  • ✓ All sensitive vars present (cloudflare_api_token; github_app_id, github_app_installation_id, github_app_pem).
  • ✓ terraform plan green on both leaves.
  • ✓ hcp-apply-scope green — the credential in use cannot apply. It is a HUMAN step like cf-token and gh-app: stop there, hand off, and continue when it turns green. Setup is not complete while the agent still holds the apply-capable user token from terraform login.

For Object-storage mode (backend: object-storage):

  • ✓ mise.toml + mise.lock are reviewed, committed together, exact-pinned, and installable with MISE_LOCKED=1.
  • ✓ State bucket created, versioned, private, with locking configured.
  • ✓ backend.tf blocks configured in each leaf.
  • ✓ GitHub Actions workflows committed (terraform-plan.yml, terraform-apply.yml) and production environment configured.
  • ✓ All sensitive secrets present in GitHub Actions (CLOUDFLARE_API_TOKEN, GH_APP_ID, GH_APP_INSTALLATION_ID, GH_APP_PEM).
  • ✓ GitHub Actions plan workflows green on both leaves (plan-cloudflare, plan-github).
  • ✓ Required status checks in branch protection match workflow job names.

If the domain/repos already exist, continue with infra-copilot:import to adopt them (plan should then show imports, not creates). Otherwise day-to-day work follows your repo's own contributor guide.

Guardrails

setup ends at green speculative plans and does not apply. If a phase-4 plan shows resources as will be created that you know already exist live — a domain already serving traffic, repos already on GitHub — do not apply: an apply would recreate or clobber them. Run infra-copilot:import first, so the plan reads imports, not creates.

Never fake a HUMAN step. A signup, a dashboard click and a secret paste are the human's, and the agent must never see a pasted secret in plaintext. On a red check after a human replies done, re-emit the handoff with what you observed rather than proceeding.

Example

A resumed run prints what is already green and stops at the first red step:

✓ toolchain-pin   ✓ hcp-login   ✓ hcp-signup   ✓ hcp-verify
✓ vcs-connect     ✗ workspaces-create   ← resume here

Everything green means the scope is already done and there is nothing to do.

Configuring for your org

All org-specific values — HCP org, GitHub org, apex domain, Cloudflare account/zone IDs, managed repos, HCP status-check ID — live in .infra-copilot/config.md (schema + export block: ../infra-copilot/references/config.md). Fill it in once and re-run — the resume protocol handles the rest.

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.