Use when someone wants to set up, repair or check specclaw-fleet infrastructure (cluster, image, Key Vault, AzDO pipeline and service connections) so approved changes can run headless.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Setup?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/chan4lk-setup)
---
description: Use when someone wants to set up, repair or check specclaw-fleet infrastructure (cluster, image, Key Vault, AzDO pipeline and service connections) so approved changes can run headless.
---
# specclaw-fleet setup
The goal is a clean `specclaw-fleet doctor`. Run it first, then fix every line that isn't `ok`, in the order printed, and run it again after each fix. Re-running the skill skips work that's already done.
**Record every confirmed value in `.specclaw/config.yaml` as you go**, under `fleet:`. That covers `vault`, `cluster_name`, `image`, `claude_version`, `pipeline` and `pipeline_file`. The connection names go in the pipeline YAML only. After that, `specclaw-fleet doctor`, `trigger`, `optin` and `status` need no env prefix. Which cluster this machine uses is local: write `FLEET_KUBE_CONTEXT` and `KUBECONFIG` (the isolated kubeconfig) to the gitignored `.specclaw/.env`, never to `fleet:`. Never write a secret in `fleet:`: the PAT goes in the gitignored `.specclaw/.env`, and credentials go in Key Vault. Commit the config change, asking before you push.
## Rules
- **Isolate.** Write a dedicated kubeconfig (`kubectl config view --minify --flatten --context <ctx>`) and use a dedicated `AZURE_CONFIG_DIR`. Never switch the operator's current kube context or az account. Their default context may be a production cluster.
- **Ask before anything outward-facing**: Azure resources, role assignments, GHCR pushes or visibility changes, AzDO service connections, pipelines, and pushes to a repo. One question per action, naming exactly what gets created.
- **Credentials are the operator's.** Give `specclaw-fleet login`, PAT entry and agent `config.sh` as exact commands for **a separate, real terminal**. Never run them with `!`: those commands get no TTY, and they hang.
- **Never print a secret.** Read service-principal credentials from `0600` files straight into `kubectl create secret … --from-file`.
## Defaults to confirm up front
- **Mode:** hosted, the default (Microsoft-hosted AzDO agent, remote cluster, public GHCR image), or local (self-hosted agent on this machine, Rancher Desktop).
- **Cluster:** the cluster context, the Azure subscription and resource group (the operator must be able to create resources and role assignments there), the AzDO org and project, and the Claude version to pin (`FLEET_CLAUDE_VERSION`).
- **Identities:** the AzDO identity that work items are assigned to must be the same UPN that is onboarded in the vault. The Azure admin identity may be a different one.
## Fixes, by doctor line
| doctor line | Fix |
|---|---|
| `context` | Make the isolated kubeconfig for the chosen context and set `FLEET_KUBE_CONTEXT`. |
| `namespaces`, `rbac`, `egress`, `netpol` | `kubectl apply -f plugins/specclaw-fleet/k8s/` (`00-namespace.yaml` sorts first). Then wait for the proxy. Probe with a labelled pod: wait about 8 s for kube-router, check the proxy answers and direct egress is refused. |
| `image` | In the specclaw repo, push a `fleet-v<tag>` tag or run the `fleet-image` workflow. On first push, set the GHCR package to **public** (Package settings → Change visibility); ask first. The image contains no Claude binary. Each pod fetches `FLEET_CLAUDE_VERSION` and verifies it against Anthropic's signed manifest. |
| `vault` | `az keyvault create --enable-rbac-authorization true`, then grant yourself `Key Vault Administrator` on it. Create the **writer** service principal with no role and the **dispatch** service principal with `Key Vault Secrets User` on the vault plus `Reader` on the resource group. Then run `specclaw-fleet onboard <upn> --vault <v> --writer <writer-object-id>` for each person. Each person then runs `specclaw-fleet login --agent claude` in a real terminal. |
| `secret:fleet-vault-writer` | Create it from the writer service principal's file: tenant, client id and secret. |
| `secret:fleet-azdo` | Have the operator paste a PAT (Code read/write, Work Items read/write, Build read, Service Connections read; `doctor` and `status` need the last two) at a hidden prompt in a real terminal. One namespace serves every project in the org (each pod takes the project from its clone URL), so the PAT must reach every project whose repos use this fleet. The prompt writes the secret, plus `.specclaw/.env` in the repo, which must be gitignored first. |
| `service-connections` | **Kubernetes:** scheme `Kubernetes`, `authorizationType: Kubeconfig`. Use a kubeconfig with a `kubectl create token fleet-dispatcher --duration=…` token, never an admin kubeconfig, and rotate it before it expires. **ARM:** the dispatch service principal. Enable both for pipelines, and add a **Branch control** check to both, allowing only `refs/heads/main` (plus branch-policy-protected `refs/heads/feature/*` for coordinated features): this, not the YAML, is what stops another branch's pipeline from using them. |
| `bundles` | Optional; it lets `trigger --retry` resume a `push-failed` run from its saved commits. Ask, then `kubectl apply -f plugins/specclaw-fleet/k8s/bundles-pvc.yaml` (applying the whole `k8s/` folder already creates it). Set `fleet.bundle_claim: fleet-bundles` and `fleet.node_label` (required on any cluster size, also one node), which must match exactly one node: the node the claim lives on, once it is bound (`claim … lives on <A>` means move the label to `<A>`). `binds on first use` is ok: a local-path claim binds when the first Job mounts it. With a `fleet.namespace` other than `specclaw-fleet`, replace that name (not `specclaw-fleet-egress`) in the `k8s/` files first: `kubectl apply -n` is refused for a file that names another namespace. |
| `pipeline` | Copy `pipelines/dispatch-hosted.yml` (or `dispatch.yml` for local mode) into the repo and set its variables. `fleetSpecclawRef` must be a **full 40-character commit SHA** of specclaw: the pipeline refuses tag names and verifies the fetched commit. Push after asking, then `az pipelines create --skip-first-run`. A root-level `pool:` cannot use a template expression. | The hosted template also refreshes `.specclaw/STATUS.md` on `main`/`feature/*` after each run and pushes it with `[skip ci]`: grant the repo's **Build Service** identity **Contribute** on the repo (Project Settings → Repositories → Security). On a branch whose policy forbids direct pushes, the step only warns.
## Repo config
Set these in `.specclaw/config.yaml`:
- `azdo.enabled`, plus `org`, `project` and `repo`;
- `azdo.boards.sync: true`, with a `work_item_type` that exists in the process (Basic: `Issue`);
- `azdo.fleet_states` mapped to real states;
- `pr.test_policy` set, so PRs never prompt;
- `git.base_branch`;
- `fleet.postgres_image` (pinned by digest), when the repo's tests need Postgres; set `postgres_port` to the port the tests expect;
- `fleet.push_attempts` (default `4`), when pushes to the remote are flaky; `fleet.bundle_claim` with `fleet.node_label`, see the `bundles` line;
- a `@playwright/test` version equal to the image's `PLAYWRIGHT_VERSION`, when the repo has browser tests.
## Local mode only
Register the agent with `config.sh`, which the operator runs. Then install it with `svc.sh install`: an interactive `run.sh` ignores `.path`, and fleet needs `specclaw-fleet` and `specclaw-sync` on the agent's PATH.
Finish when `doctor` prints `doctor: all checks ok`. Then use `/specclaw-fleet:run`.