infra-setup
Skill2 starsChanged 26 days 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-skills:infra-import), nor for provisioning new ones in a working repo (infra-skills:infra-add).
2 other projects use a version of this.
Adopted by
Most recently taken up by
- hasansezertasan/infra-skillsword for word, first seen Oct 20, 2026
- BatiVoiceAI/saas-factorytheir own version, first seen Jul 15, 2026
Other versions2 projects use a version of this.
Word for word · 1
- hasansezertasan/infra-skills★ 2100% same
Edited · 0
None found.
Wrote their own version · 1
- BatiVoiceAI/saas-factory★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- infra-addSkill
- infra-importSkill
- infra-pruneSkill
- infraSkill
- infra-statusSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 are 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.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 82
Never edit a file the Template owns.
- Very specific: line 102
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 …
- Very specific: line 117
Phase 1 — HCP workspaces: Only HCP-routed bootstrap leaves get workspaces (cloudflare for Cloudflare, github-org for GitHub).
- Distinctive: line 187
If the domain/repos already exist, continue with infra-skills:infra-import to adopt them (plan should then show imports, not creates).
- Very specific: line 199
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 …
- Very specific: line 217
All org-specific values — HCP org, GitHub org, apex domain, Cloudflare account/zone IDs, managed repos, HCP status-check ID — live in the …
≈ “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.
Files
<!--
AI-RULEZ :: GENERATED FILE — DO NOT EDIT
Content-Hash: blake3:5489b040c8d6be73f846297ffa11796f4a0a3d236cbe4eff885a11e66a6eabbe
Source-Hash: blake3:68a46b64e70180566a5d1ebf9d0d4a9e0e15ab0076377348ec74a1267ef0ecb1
Schema-Version: v1
-->infra-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/references/protocol.md; the per-step manifest in
../infra/references/steps.yaml (phases 0–4); per-provider detail and
the canonical docs under ../infra/references/.
This is a Skill, not a script. There is no
setupexecutable. Drive it by reading this file, the protocol, and the manifest, then running each step. A human invokes it with/infra-skills:infra-setupor by saying "set up the infra."
Scope
setup owns the cold start: from an empty repo to green plans on both leaves.
The mode sections below describe each implementation's duties for the leaves routed to
it, not a repository-wide either/or. Load and validate leaf_backends with the default
in config before preflight. In mixed repositories, establish both service prerequisites,
configure only each service's effective bootstrap subset, and verify credentials/plans
on each leaf's selected implementation. Additional providers join the service inventory
but their leaf setup remains Phase 6. Do not recreate or reconnect a migrated HCP leaf.
Synchronize Actions' static CLOUDFLARE_BACKEND and GITHUB_BACKEND values with effective
config in the cutover PR and verify plan/apply workflow agreement before proceeding.
For existing HCP state, follow
the migration runbook,
not a fresh backend initialization. See
operation selection.
HCP implementation (effective HCP leaves)
| # | Phase | Actors | Deep dive |
| 0 | Toolchain + HCP bootstrap — commit reviewed pins, sign up, terraform login, get the pivot token | HUMAN then AGENT | ../infra/references/docs/setup.md#6, ../infra/references/hcp.md, ../infra/references/docs/setup.md#1 |
| 1 | HCP workspaces — create cloudflare + github-org, VCS + safety toggles | AGENT (API) + HUMAN VCS OAuth | ../infra/references/hcp.md, ../infra/references/docs/setup.md#2 |
| 2 | Cloudflare — mint scoped token, paste into HCP, verify | HUMAN mint/paste, AGENT verify | ../infra/references/cloudflare.md |
| 3 | GitHub — create + install the GitHub App, paste creds into HCP | HUMAN create/install/paste, AGENT verify | ../infra/references/github.md |
| 4 | Narrow the credential, then first plan — hand off to a plan-only HCP identity, then init + speculative plan per leaf, read via API | HUMAN handoff, then AGENT | ../infra/references/steps.yaml (hcp-apply-scope), ../infra/references/docs/hcp-api.md |
Object-storage implementation (effective object-storage leaves)
| # | Phase | Actors | Deep dive |
| 0 | Toolchain + state bucket — commit reviewed pins, create versioned bucket, configure backend.tf blocks | HUMAN then AGENT | ../infra/references/docs/object-storage-state.md#object-storage-backend |
| 1 | GitHub Actions CI — create plan/apply workflows, configure GitHub Environment protection | AGENT then HUMAN | ../infra/references/docs/object-storage-ci.md#github-actions |
| 2 | Cloudflare — mint scoped token, add CLOUDFLARE_API_TOKEN to GitHub Actions secrets, verify | HUMAN mint/save, AGENT verify | ../infra/references/cloudflare.md |
| 3 | GitHub — create + install GitHub App, add secrets (GH_APP_ID, GH_APP_INSTALLATION_ID, GH_APP_PEM) to GitHub Actions | HUMAN create/install/save, AGENT verify | ../infra/references/github.md |
| 4 | First plan — verify plan-cloudflare and plan-github jobs succeed in GitHub Actions | AGENT | ../infra/references/steps.yaml, ../infra/references/docs/object-storage-ci.md#github-actions |
Adopting resources that already exist (a live domain, existing repos)? That's infra-skills:infra-import (Phase 5), run after this reaches green plans.
⚠️ Pre-existing resources — stop before applying. Unlike the old monolith,
setupends at green speculative plans (phase 4) and does not auto-import. If the phase-4 plan shows resources aswill be createdthat 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-skills:infra-import first to adopt them (the plan should then read imports, not creates), and only then apply.
Workflow
Render the Template, or resume (shared protocol, Step 0). On a directory with no
.copier-answers.ymland no README Config block, runtemplate-render: read the Template's currentcopier.yml, ask its questions, render with the pinned Copier and commit the answers file. A repo is rendered when it has a committed answers file and a README Config block; it resumes, and is never re-scaffolded. A Config block without an answers file (or the reverse) is not rendered: hand off, never render over it. Never edit a file the Template owns. Then runtemplate-contract: an older tag proposes the Template'scopier update, a bare commit hands off.Then read config. Load the Config block from the root
README.mdand export the org vars. A legacy.infra-copilot/directory or.claude/infra-copilot.local.md→ unsupported, stop. No Config block → handoff, 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 and record it as the Template'sbackendanswer (object-storageorhcp), explicit and never defaulted.backendsits outside the customization markers, so you never write it yourself. Existing configs withoutbackendstop for the migration handoff; existingcloud {}blocks prompt an offer for the human to recordbackend: hcp, never an automatic mode switch. See../infra/references/config.md.- Bootstrap preflight, then resume scan over phases 0–4 of
../infra/references/steps.yaml. On a cold repo, check thatmiseitself is available, then scantoolchain-pinandbackend-cli-pinbefore running the pin-dependent preflight checks. Once both are green, finish preflight, print✓, and continue through every selected service's bootstrap members. Full contract:../infra/references/protocol.md. - Respect the actor split. Run
AGENTsteps yourself. On aHUMANstep, stop, emit the handoff block, wait fordone, re-run thecheck— never fake a signup, a dashboard click, or a secret paste. - Route to the deep-dives under
../infra/references/for the fine print; don't duplicate them.
Phase notes
HCP mode:
- Phase 0 — Toolchain + HCP bootstrap. The first
HUMANstep chooses exact tool versions, reviews the wholemise.toml, and commits it withmise.lock; this must happen before pin-dependent preflight. ThenHUMANsigns up + runsterraform login, after which you own the HCP API. Toolchain sequence:../infra/references/docs/setup.md#6. HCP commands + verify:../infra/references/hcp.md. - Phase 1 — HCP workspaces. Only HCP-routed bootstrap leaves get workspaces
(
cloudflarefor Cloudflare,github-orgfor GitHub). A human does the one-time GitHub↔HCP VCS connection (browser); create the selected subset via the API with the right working dir, path-scoped triggers, remote execution, and auto-apply off.create_wshelper + safety rationale:../infra/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 isAGENT.../infra/references/cloudflare.md. - Phase 3 — GitHub. The
github-orgworkspace authenticates as a GitHub App, not a PAT. Creation + install are browser flows; three creds get pasted into HCP.../infra/references/github.md. - Phase 4 — First plan. Prove every credential end-to-end. Per leaf:
terraform initthen speculativeterraform plan(runs in HCP). A VCS-connected workspace allowsplanbut blocksapplyfrom the CLI — intentional. Read plans without the UI via../infra/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.HUMANcreates the versioned, private state bucket with locking configured.AGENTwritesbackend.tfblocks in each leaf pointing to the state bucket.../infra/references/docs/object-storage-state.md#object-storage-backend. - Phase 1 — GitHub Actions CI.
AGENTcreates.github/workflows/terraform-plan.ymlandterraform-apply.yml.HUMANrestricts theproductionGitHub Environment tomainand adds required reviewers where the plan offers them, or locks anApply gatedecision.../infra/references/docs/object-storage-ci.md#github-actions. - Phase 2 — Cloudflare.
HUMANmints scoped token and addsCLOUDFLARE_API_TOKENto GitHub Actions secrets;AGENTverifies.../infra/references/cloudflare.md. - Phase 3 — GitHub.
HUMANcreates/installs GitHub App and addsGH_APP_ID,GH_APP_INSTALLATION_ID, andGH_APP_PEMto GitHub Actions secrets;AGENTverifies.../infra/references/github.md. - Phase 4 — First plan. Trigger or inspect GitHub Actions plan workflows for
cloudflareandgithubleaves; verify both jobs succeed. Align required status check job names.../infra/references/docs/object-storage-ci.md#github-actions.
Validation
Setup is complete when you can report:
- ✓ The README Config block explicitly records the chosen
backend.
For every effective HCP leaf and the shared HCP service:
- ✓
mise.toml+mise.lockare reviewed, committed together, exact-pinned, and installable withMISE_LOCKED=1. - ✓ HCP org
$ORG+ projectinfrareachable via API. - ✓ Every HCP-routed bootstrap workspace exists, VCS-linked, auto-apply off, fork speculative plans off.
- ✓ Each selected workspace uses the exact Terraform version committed in
mise.toml. - ✓ Its required variables are present:
cloudflare_api_tokenonly for HCP-routed Cloudflare;github_app_id,github_app_installation_id,github_app_pemonly for HCP-routed GitHub. - ✓
terraform planis green on every HCP-routed bootstrap leaf. - ✓
hcp-apply-scopegreen — the credential in use cannot apply. It is aHUMANstep likecf-tokenandgh-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 fromterraform login.
For every effective object-storage leaf and the shared runner service:
- ✓
mise.toml+mise.lockare reviewed, committed together, exact-pinned, and installable withMISE_LOCKED=1. - ✓ State bucket created, versioned, private, with locking configured.
- ✓
backend.tfblocks configured in each object-storage-routed bootstrap leaf. - ✓ GitHub Actions workflows committed (
terraform-plan.yml,terraform-apply.yml) and production environment configured. - ✓ Required Actions secrets are present:
CLOUDFLARE_API_TOKENonly for runner-routed Cloudflare;GH_APP_ID,GH_APP_INSTALLATION_ID,GH_APP_PEMonly for runner-routed GitHub. - ✓ Each object-storage-routed bootstrap leaf's plan job is green (
plan-cloudflareorplan-github). - ✓ Required status checks in branch protection match workflow job names.
If the domain/repos already exist, continue with infra-skills:infra-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-skills:infra-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 hereEverything 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 the README Config block (schema +
export block: ../infra/references/config.md). The Template answers (orgs, domain, account IDs, managed_repos) change only through the
Template's update flow; fill in the customization region once and re-run —
the resume protocol handles the rest.
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.

