/fsh:blacksmithfrom fsh
Migrate a repository's GitHub Actions workflows to Blacksmith runners — inventory every job, move the ones that build, run or test the app (image builds get the sticky-disk Docker actions, a size-capped cache and a Dockerfile audit for cache killers), leave glue, deploy and credential-bound jobs on GitHub, capture a per-step timing baseline, hand off to `deliver --no-merge` with the decision table in the PR, and measure real rebuilds on that PR when the existing runs can't settle it. Use when asked to "move CI to Blacksmith", "cut GitHub Actions spend", "make the image build faster", or right after the Blacksmith app was installed on an org. Args: a repo path (default: the current repo), plus `--audit-only` to print the decision table and write nothing.
Ships in fsh. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
You are running the blacksmith skill. Goal: move the compute in a repo's CI onto Blacksmith runners, move nothing else, and leave behind the numbers that prove it paid off.
The policy below was bought with measurements on an FSH monorepo, recorded in references/policy.md — read it before Phase 2. The short version: CI image builds are bound by moving bytes, not computing them, so bare metal with a local layer cache cut one build 12.4 → 3.6 min (hardware −53%, sticky disk a further −33%). Test and e2e jobs gained 12–44%. Sub-minute glue gained nothing and became one more thing that can wedge a repo. A second repo added the other half: its layer cache had been missing on every build because of the Dockerfile itself, which no runner fixes — so this skill audits the Dockerfile too, and measures before it merges.
Blacksmith is the house route; running our own runners was weighed and rejected. Don't re-litigate it here.
The Blacksmith GitHub App must be installed on the org. Their runners register through GitHub's org-level runner API; without the app every blacksmith-* job queues until GitHub times it out instead of failing fast.
ORG=$(gh repo view --json owner -q .owner.login)
gh api "/orgs/$ORG/installations" -q '.installations[].app_slug' | grep -qx blacksmith-sh && echo installed
That endpoint needs admin:org, which most tokens lack: a 404 means unknown, not missing. Then look for evidence instead — another repo in the org already running blacksmith-* jobs (gh search code 'runs-on: blacksmith-' --owner "$ORG" -L 5), and, once the PR is pushed, its first blacksmith-* job leaving QUEUED within a minute. Proven missing → stop and say so (app.blacksmith.sh, org scope, all repos or this one). --audit-only may continue; a write run may not.
gh auth status must pass; actionlint must be on PATH (brew install actionlint) for Phase 4.
Ownership (git remote -v). In a client's repo, every migrated job's secrets will be read on a third party's hardware — a subprocessor question, not a technical one. Proceed, but the report names those jobs (Phase 2 "ask" list) so the owner can veto.
"${CLAUDE_SKILL_DIR}/scripts/inventory.sh" [repo-path] | tee /tmp/blacksmith-inventory.md
"${CLAUDE_SKILL_DIR}/scripts/ci-timing.sh" | tee /tmp/blacksmith-baseline.txt
"${CLAUDE_SKILL_DIR}/scripts/step-timing.sh" --workflow <each slow workflow> | tee -a /tmp/blacksmith-steps.txt
"${CLAUDE_SKILL_DIR}/scripts/build-steps.sh" --run <a recent image-build run> --job <its build job>
inventory.sh — one row per job: current label, mapped label, timeout, the signals it classifies on, and a suggested verdict with its reason. Suggestions are heuristics; you judge every row, and REVIEW rows you read in full.ci-timing.sh — wall-clock and priced cost per workflow and runner label over the last 14 days. This is the "before". Reusable workflows report no runs of their own — their jobs bill under the caller — so the numbers sit on calling workflows.step-timing.sh — per job and per step: n, median, min–max over successful runs. The "after" is judged per step against this, not per workflow: a workflow average hides that the build got faster while a cleanup or an upload did not.build-steps.sh — inside one image build: the slowest BuildKit steps, and whether each dependency-install step was CACHED. Read it before Phase 3. Installs that ran on a build that changed no lockfile mean the Dockerfile invalidates them on every commit — fix that in the Dockerfile audit, or the sticky disk caches nothing that matters. A slowest step that isn't compute (a source-map or artifact upload, the registry push) goes in the report by name: a runner won't fix it, and it can be the cheapest win in the repo — one upload was 75% of an app's build.uses: ./.github/workflows/x.yml has no runs-on; the edit lands in the callee. A callee shared by preview and prod callers moves both — fine for a build, and a deploy callee stays anyway.One question decides most rows: does this job build, run or test the app, and take long enough to matter? Yes → migrate. No → stay.
Migrate — same vCPU count, never re-sized, so the before/after measures hardware and not sizing:
| Job shape | Also |
|---|---|
Docker image build (docker/setup-buildx-action + docker/build-push-action) | swap to the Blacksmith actions, Phase 3 |
| Unit / lint / typecheck / build (a toolchain setup step, no services) | — |
Tests with services: containers | — |
Browser e2e (Playwright, container: images) | — |
A long CPU-bound step inside a deploy workflow (e.g. eas update, which bundles before it uploads) | move that job only; its kubectl siblings stay |
Stay — leave the YAML untouched, give the reason in the table:
if: always() joiners, notify-failure, PR commenters, paths-filter jobs, cancel-workflows, labelers, deployment bookkeeping, config computation. Seconds of runtime, so nothing to gain — and the merge gate in particular should sit on the most boring infrastructure available.kubectl rollout status, Cloud Run deploys, health checks, cron pollers. Faster cores buy nothing, and there is no reason to hand a third-party runner the cluster kubeconfig for no gain.self-hosted or an unknown custom label. It is on that hardware for a reason — cluster LAN, on-disk kubeconfig.KUBECONFIG pointing at a file on the runner, a WireGuard or tailscale/headscale join into someone's LAN, SSH to a host that allowlists the runner's IP. The LAN case is the one that gets missed: the job looks like an ordinary e2e suite, and the route it opens is the client's network.paths: and hasn't run in 60+ days — the inventory flags these). Listing itself is normal; dormancy is the problem: your edit runs it for the first time in months, and a pre-existing failure then looks like yours. If it fails on something unrelated to runners, revert that file to byte-identical, report the failure, and don't fix it here — not even with a comment in the file, because the comment is an edit and re-fires it.Ask once, in a single AskUserQuestion, with the numbers beside each item:
templates/build-job.yml) — a reusable build workflow only when several workflows already share one build. If declined, the job stays.google-github-actions/auth with workload identity, OIDC → kubeconfig). Default: migrate — that trade has been accepted in-house — but list them explicitly so a client-repo owner can say no.--audit-only stops here: print the decision table and the baseline, write nothing.
Labels. Match on vCPU, keep the OS version:
| From | To |
|---|---|
ubuntu-latest, ubuntu-24.04 | blacksmith-2vcpu-ubuntu-2404 |
ubuntu-22.04 | blacksmith-2vcpu-ubuntu-2204 |
ubuntu-latest-{4,8,16}-cores | blacksmith-{4,8,16}vcpu-ubuntu-2404 |
ubuntu-24.04-arm | blacksmith-2vcpu-ubuntu-2404-arm |
windows-latest / macos-latest | blacksmith-2vcpu-windows-2025 / blacksmith-6vcpu-macos-latest |
Image builds. Changing runs-on alone does not enable layer caching. Replace both Docker actions and delete the external cache:
# Mounts the org's sticky disk as the buildkit layer store, so a restore is a
# local NVMe read rather than a registry pull. `cache-key` namespaces these
# layers away from every other image in the org and is deliberately a constant —
# buildkit invalidates layers itself; keying on the Dockerfile's contents would
# discard the whole cache on every edit.
- name: Set up Docker Buildx (Blacksmith sticky disk)
uses: useblacksmith/setup-docker-builder@v2
with:
cache-key: {{REPO}}-{{BUILD_TARGET}} # e.g. myrepo-web: one per Dockerfile + target
# No cache-from/cache-to: the sticky disk replaces them, and exporting to the
# registry as well would re-incur the network cost the disk exists to remove.
- name: Build and push
uses: useblacksmith/build-push-action@v2
with: # context, file, target, push, tags, build-args, platforms: unchanged
# Bounds what the sticky disk carries into the next run (billed per GB-month) and
# leaves both sizes in the job summary, so the cap is checkable from the run instead
# of the vendor's dashboard. Runs before the disk is committed at job end, and only
# after a successful build — a failed build leaves one run's worth behind, which the
# next successful build prunes. Never fails the job: an uncapped cache costs money,
# not correctness.
- name: Cap the Docker layer cache
continue-on-error: true
timeout-minutes: 5
run: |
set -euo pipefail
size() { docker buildx du | tail -2 | sed 's/^/ /'; } # Reclaimable, Total
before=$(size)
# 30 decimal GB spelled in bytes: buildx reads a `30gb` suffix as 30 GiB.
# --max-used-space needs buildx 0.17+ (the builder action ships 0.23). On an
# older pin, fall back to the deprecated --keep-storage and say so.
if ! pruned=$(docker buildx prune --force --max-used-space 30000000000 2>&1); then
echo "::warning::buildx prune --max-used-space unsupported; using --keep-storage"
pruned=$(docker buildx prune --force --keep-storage 30000000000 2>&1)
fi
printf '### Docker layer cache\nBefore:\n%s\nPruned: %s\nAfter:\n%s\n' \
"$before" "$(echo "$pruned" | tail -1)" "$(size)" >> "$GITHUB_STEP_SUMMARY"
cache-key names one sticky disk. Make it one per Dockerfile + target, shared by every workflow and environment that builds it — preview, dev and prod builds of one Dockerfile differ only in build args, so they share every install layer, and a PR build starts from the layers main left. Never a deploy name: a per-PR image name (app-pr-123) mints one disk per PR, each starting cold and each billed. Two genuinely different images get two keys.
Size cap. setup-docker-builder@v2 has no size input (v1's max-cache-size-mb is gone; v2 garbage-collects by age only), and storage is what turned one month's bill up 25%: $205 of sticky disk inside a $425 invoice, 277 GB retained across three keys that all looked active. 30 decimal GB is the house number — one full cold build of a Node app leaves 12.4 GB, so it keeps a set plus the last change, and it is what the capped repos run today. --max-used-space is a target for reclaimable cache, not a promise about disk size: the capped repo reads 28.75 GB on attach, 32.04 after a build, 28.1 after the prune. Raise it per image if build-steps.sh shows installs re-running after a prune.
Cadence decides whether the disk is worth anything. Blacksmith evicts layers that go unused — documented at 8 days, observed at 72 h in a job log. A repo that builds an image less often than that is cold on every build: it keeps the hardware gain, the cache gains nothing, and the disk bills only for the days it survives in between. One repo whose image builds land days to weeks apart reported cached=0 on three consecutive builds across three images, and never appeared in the paid-storage inventory. So: run build-steps.sh on two consecutive real builds before promising cache gains in the PR, and skip the size cap where nothing accumulates to cap. What is left on such a repo is the cold build itself — the two bloat items in the Dockerfile audit below are then the only lever.
"Free runner disk space" steps (rm -rf /usr/share/dotnet …, docker system prune -af) existed for GitHub's 14 GB root disk. With the sticky-disk builder, BuildKit writes to its own disk, not the root disk, and the root disk on a 2-vCPU runner had 80 GB free. Keeping the step is harmless — 0.2 min on Blacksmith against 2.4 on GitHub — but it guards nothing in a job that builds through setup-docker-builder; drop it there, keep it where a job still builds through the local daemon. Multi-platform builds: one job per platform on the matching runner (…-arm for arm64), no QEMU.
Dockerfile audit. The sticky disk only keeps layers the Dockerfile lets survive. Before the swap, check every stage the build uses:
ARGs go last. A changed ARG value misses the cache at every RUN after its declaration, used or not. An ARG GIT_SHA / RELEASE / VERSION near the top of a stage re-runs that stage's dependency install on every commit. Declare it immediately before its first use, ideally as the stage's last instructions.RUN yarn install && yarn cache clean (or npm ci && npm cache clean, pip install --no-cache-dir) with RUN --mount=type=cache,target=<the tool's cache dir> <install>. Confirm the dir in the base image (yarn config get cacheFolder — Yarn 4: /root/.yarn/berry/cache). Cache mounts live on the sticky disk too, so a lockfile change re-links from disk instead of downloading everything..next/cache/turbopack, .turbo, .vite, __pycache__) are COPYd into the final image unless the build deletes them in the same RUN. They are paid for twice: in the registry push, and in every pull.chown -R a tree you just copied. RUN adduser … && chown -R app:app /app rewrites every file into a new layer, so the image carries a second copy of node_modules and the build output — 44-47 s per build in two repos, before the larger push it causes. Create the user before the content lands and use COPY --chown= / COPY --from=builder --chown=; chown one path only if something genuinely must be writable.cache-to: …,mode=min exports only the final stage's layers, so builder stages were always rebuilt; docker build --cache-from <image>:latest reuses nothing unless that image was pushed with inline cache metadata. Either way the "before" was a cold build, and the baseline says so.Each fix is an ordinary Dockerfile change that helps on any runner; it ships in this PR because the cache is the point of the migration. build-steps.sh on the second warm build is the proof: install steps CACHED.
Splitting a fused build + deploy job (if the "ask" said yes): templates/build-job.yml is the new build job on Blacksmith; the old job keeps everything after the image, stays on GitHub and gains needs: [build]. Then:
env: to the workflow level, so both jobs read the same values. Values a step writes to $GITHUB_ENV (an image tag) are per job — repeat that step in build.…:${{ github.sha }}), not a job output, so re-running the deploy job alone still finds it.notify-failure and any if: always() joiner: add build to needs: and to the condition.build needs no environment: — and shouldn't get one, since an environment means a second deployment record and a second approval on protected environments. If the condition names the environment (assertion.environment), build must carry it.Dependency caches in CI jobs. Where a test job has none, adding one is fine (see Don't). One trap: actions/setup-node's cache: yarn runs before corepack enable, so it asks the runner's preinstalled Yarn 1 for its folder and caches the wrong directory. For Yarn 2+, use actions/cache on ~/.yarn/berry/cache keyed on the lockfile(s).
Every migrated job gets timeout-minutes if it lacks one. A stuck VM on either vendor otherwise burns GitHub's 6-hour default. Value: 1.5 × the slowest healthy run in the baseline, rounded up, minimum 10 — not the slowest run outright, which may be the very stall you are removing.
.github/actionlint.yaml from templates/actionlint.yaml, {{LABELS}} = the labels you introduced (one - line each); no repo has one before this, so create it. actionlint otherwise reads the labels as typos.
Don't:
runner: inputs or if: startsWith(inputs.runner, 'blacksmith') dual paths. That is pilot scaffolding; the PR is the rollback unit, and the in-house pilot deleted exactly this once the decision was made.actions/cache steps or the caching in setup-node/setup-* — they work transparently on Blacksmith, and useblacksmith/cache is deprecated. Adding one where a job has none is fine.actions/checkout for useblacksmith/checkout unless the clone itself takes minutes (multi-GB repos).runs-on swaps. One comment on each Docker-builder swap is the only prose this change needs.# actionlint: no NEW findings. Most repos carry shellcheck notes already, so "clean" is the
# wrong bar — compare against the base branch, line numbers stripped.
lint() { actionlint -oneline 2>&1 | sed -E 's/:[0-9]+:[0-9]+:/:/' | sort; }
git worktree add -q /tmp/blacksmith-base "origin/$(gh repo view --json defaultBranchRef -q .defaultBranchRef.name)"
(cd /tmp/blacksmith-base && lint) > /tmp/al-base.txt; git worktree remove --force /tmp/blacksmith-base
lint > /tmp/al-after.txt; comm -13 /tmp/al-base.txt /tmp/al-after.txt # empty, or each line explained
grep -rn 'cache-from\|cache-to' .github/workflows # none left on migrated builds
grep -rn 'runs-on:' .github/workflows | grep -v blacksmith # exactly the "stay" rows
git diff --stat # exactly the "migrate" files (+ actionlint.yaml)
git diff --quiet -- <every dormant workflow left alone> # byte-identical
# If you push-measured (Phase 5): the perturbation file and its commits are gone again.
git log --oneline "origin/$(gh repo view --json defaultBranchRef -q .defaultBranchRef.name)..HEAD" \
| grep -ci 'measurement rebuild' # 0
The diff must reconcile with the decision table line for line. A file in the diff that isn't in the table, or vice versa, is a mistake — find it before delivering. A new actionlint line is acceptable only when it is an existing finding carried into a copied step (a split job repeating a >> $GITHUB_ENV step) — say so in the PR.
Hand off with /deliver --no-merge. The "after" normally comes from runs that happen anyway: re-run ci-timing.sh and step-timing.sh a week later and compare per job and per step, n ≥ 5. Push-measure on the PR only when that cannot answer the question — the Dockerfile audit changed something and the install states have to prove it, or the repo builds too rarely to accumulate a comparable sample. Each run is a real build and, on a fused or preview-deploying workflow, a real deployment: five runs is five of those, plus any re-runs. In a repo we don't own, ask before pushing them. When you do measure:
M="${CLAUDE_SKILL_DIR}/scripts/measure.sh"
"$M" --workflow <pr-triggered workflow> --file <path inside the build context> --label cold --runs 1
"$M" --workflow <pr-triggered workflow> --file <same path> --label after --runs 5
"$M" --summary
--file must sit inside the build context and not be .dockerignored, so each push invalidates COPY . . like a real PR (hard rule 6). The script refuses to run without an open PR on the branch, and runs strictly one at a time.build-steps.sh exposed — commit it, then start a new --label. Never two changes in one series.--file before review and squash-merge, so the measurement commits never reach the default branch.PR body, in the house format, carrying these under its sections:
ci-timing.sh and step-timing.sh output in fenced blocks, the measure.sh --summary table if you measured, plus how to judge: re-run the same commands a week after merge; compare per job and step against its own baseline, on n ≥ 5, never on one run. Two in-house samples of the same job spanned 27%.:buildcache / :cache tags are now neither written nor read and can be reaped; deploy-path builds no longer refresh them. A split job creates its deployment record only after a successful build.build-steps.sh named.After merge, three signals, in order: blacksmith-* jobs leave QUEUED within a minute (the app works); the service-container test job passes (the environment is drop-in); on the image build's second run, build-steps.sh shows the install steps CACHED (the disk works — "faster than the first run" is too weak a test: it passes on hardware alone while a Dockerfile still misses every layer). If jobs sit in QUEUED, the app isn't installed — cancel them rather than let them time out.
if: always() gate. Seconds of runtime, and it protects main.cache-key, and never key it on a deploy name. A constant per Dockerfile + target; buildkit owns invalidation. A per-PR or per-environment key is one cold, billed disk each.runner inputs, no label-guarded dual step paths. Revert the PR to roll back.measure.sh does it), measure that, remove the perturbation.references/policy.md (opens in a new tab)scripts/build-steps.sh (opens in a new tab)scripts/ci-timing.sh (opens in a new tab)scripts/inventory.sh (opens in a new tab)scripts/measure.sh (opens in a new tab)scripts/step-timing.sh (opens in a new tab)templates/actionlint.yaml (opens in a new tab)templates/build-job.yml (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub fullstackhouse/skills --plugin fsh35 skills in this plugin
/brainstormDivergent conversation before any artifact exists — question the idea, weigh alternatives including building nothing, then converge on one routed next step (drop it, park it as a ticket, kick off implementation, or bug-hunt) with a handoff brief. Use when the user says "should we build this", "I have an idea", "let's think this through", or "is this worth doing". Read-only until the routing is confirmed./broRestate the last message in plain human language, with no jargon./bug-huntReproduce, diagnose, and fix a reported bug via a triage → reproduce → diagnose → failing-test → fix → verify loop. Forbids speculative fixes that paper over symptoms. Files a tracker task on give-up./claude-desktop-handoffHand one GUI-only step to Claude Desktop running on the same machine, over a shared temp directory, so this session can keep working autonomously instead of stopping. Use when the step needs the user's own logged-in browser (a vendor console with no API, an OAuth app registration, an SSO-gated admin page, anything behind a password manager or passkey), this session is non-interactive (Conductor, `-p`, cloud) or has only a headless browser, and Claude Desktop is installed on this machine — that last fact is what picks this skill over its sibling. Prints one prompt for the user to paste into Claude Desktop; the two sessions then talk through files, so Desktop can ask a question mid-task and get an answer without the user relaying it. Use `desktop-handoff` instead when the hand might be a different runtime, a different OS, or not Claude at all./decideWork through the decisions a session has left open — one at a time, each briefed on its own (what's at stake first, then the detail), facts looked up instead of asked, 1-2 alternatives plus the status quo as the last lettered option, one recommendation — then stop and wait for the answer before raising the next. Records each answer where the project keeps decisions before moving on. Use when the user asks "what's still open / what's left to decide", "co do decyzji", "present each one separately and ask me", "walk me through them one by one", or when a long session is ending with deferred choices nobody ever answered. `grill-me` interrogates a plan the user brought; this one empties a queue the work produced./deliverDeliver the work on the current branch, or an existing PR, to a level — run all relevant local checks (lint/typecheck/tests), get the change reviewed and fixed locally through the review-loop skill before anything is pushed, open or update a PR, work the CI loop, then stop at `ready` with a Next moves block offering each level the repo's own workflows reach (e.g. dev, staging, prod). `--pr <N> --to <level>` carries out the owner's chosen move: it is resumable, re-runs only the steps whose proof no longer matches the PR's patch-id, merges, and promotes the merge up to that level. Supports --base to target a branch other than the repo default (stacked PRs), --bot-review / --no-bot-review to force a PR bot's on-record review on or off, and --review-rounds N (0-10) to cap the local review loop — 0 skips it. CI is slow and a bot reviewer is slower; do not lean on either as a first pass. `--merge-only --pr <N> --expect-head <sha>` is a deprecated alias of `--pr <N> --to <first level>`, kept for one release.