The Craftsman standard for production infrastructure — deployment, env/config, CI/CD, IaC, health/readiness, scaling, platform/edge rate limiting, build/release, rollback. Use WHENEVER work touches infra: deploy, CI gates, env vars, IaC, load failures, platform rate limiting, pooling runtime constraints, or production runtime. Trigger on "deploy this", "set up CI", "add rate limiting", "configure env vars", or "why did it fall over under load". Owns the platform layer — see "Scope boundaries" in the body for handoffs to craft-backend, craft-security, craft-db, craft-testing, and craft-observability.
This skill encodes one engineer's standard for shipping and running services reliably, applied the
same way across every repo. The method and opinions live here; the project specifics
(hosting platform, CI system, IaC tool, env-var schema) live in the target repo's code and config —
always discover them, never assume or hardcode.
Operating principle — discover before you build
Different repos already have different pieces in place. Before adding anything, spend a couple of
minutes mapping what exists so you extend rather than duplicate or conflict:
Env-var schema (env.ts, config.ts, .env.example, zod schemas) → which vars are required,
which are optional, where validation happens.
Health/readiness endpoints (/health, /ready, /api/healthz) and how they're registered.
IaC files (terraform/, pulumi/, cdk/, fly.toml, vercel.json, render.yaml) → existing
resource definitions to extend rather than replace.
State what you found, then propose the smallest set of additions that closes the gaps.
The infra layers (work in this order)
Config — all configuration flows through a validated env schema that fails closed on missing
required values. A missing prod var should crash at startup, not surface as a 500 at runtime.
See references/config.md.
Build & release — builds are reproducible and produce immutable artifacts; the release
process is documented and automated enough that any team member can trigger it. See
references/build-release.md.
CI/CD — gates (lint, typecheck, tests, build) block merge; deploys are automated and
reversible. Manual prod edits are the failure mode, not the workflow. See references/ci-cd.md.
Runtime health — every service exposes health and readiness probes; graceful shutdown drains
in-flight requests; connection pools are sized and scoped to the runtime model (serverless vs
long-lived). See references/runtime-health.md.
Scale & resilience — timeouts, retries with backoff, circuit breakers, and capacity limits
that match the actual runtime model. Serverless runtimes do not guarantee shared or durable
in-process state across invocations/instances — warm instances may reuse module-scope state but
this is neither guaranteed nor shared globally and can disappear at any time. Anything that
assumes a long-lived process (in-memory pools, local metrics registries) needs a flag or
replacement. See references/scale-resilience.md.
Standing opinions (the non-negotiables)
These are the judgments that make output consistent across repos — apply them unless the user
overrides:
Config is validated and fails closed. Every required env var is declared in a schema; if it's
missing the process refuses to start rather than limping along and erroring at the call site. This
is the single highest-leverage infra habit.
CI gates are required before merge. Lint, typecheck, tests, and a production build must all
pass. A CI pipeline that only runs on deploy (not on PR) is too late to catch regressions cheaply.
Deploys are automated and reversible. No manual production edits — they're untracked and
unreviewable. Every deploy path has a documented rollback step (previous image tag, Vercel
instant rollback, Terraform state revert, etc.).
Serverless runtimes are ephemeral. In-process pools, singleton metrics registries, and
circuit-breaker state all evaporate between invocations. Flag any tool or library that assumes a
long-lived process and propose the serverless-appropriate alternative before wiring it in.
Every service has health and readiness endpoints. Health says "I am alive"; readiness says "I
am ready to serve traffic". They are not the same check. Load balancers and orchestrators need
both.
Workflow
Discover — map the existing pipeline, env schema, health endpoints, and IaC (above) and
report gaps.
Propose — ordered by the five layers, smallest viable additions first.
Implement — against the repo's existing pipeline and conventions, not a greenfield ideal.
Verify — run the CI pipeline end-to-end, hit the health endpoints, and walk through a
rollback path. Infrastructure you haven't seen work isn't done.
Scope boundaries
This skill owns the platform layer: how the app is built, shipped, configured, and kept standing.
Hand off at these lines:
Rate-limit ownership, so the same gap isn't emitted four times: INFRA owns platform/edge
capacity throttling; the route middleware mechanism → craft-backend; login-abuse policy →
craft-security; LLM spend and token limits → craft-ai.
Connection-pool sizing → craft-db. This skill owns the runtime constraints the platform
imposes on pooling (serverless concurrency, instance count).
CI split: the pipeline mechanism is owned here; which suites gate merge → craft-testing.
A suite that exists but isn't wired into CI is an INFRA finding; a missing suite is a TEST finding.
When craft-audit plans an infra pass for a scope, it turns this checklist into the plan.md
todo list — the checklist is owned by this skill, not improvised by the orchestrator. Tailor to what
discovery found: skip a step that genuinely doesn't apply with a one-line reason; never silently drop
one. Emit findings using craft-audit workspace.md → "Canonical findings.md emission format"
(authority). Heading grammar (variables required — do not hardcode NNN/severity/status):
## <scopeLabel>-INFRA-<NNN> · severity <🔴|🟡|🟢> · status <open|fixed|wontfix (reason)|regressed|fixed (merged into <ID>)>
Example only: ## <scopeLabel>-INFRA-001 · severity 🔴 · status open
Required fields under each heading, in order, with these exact labels:
**What breaks (plain language):** · **Technical:** · **Fix:** · **Fingerprint:** ·
**Last-checked:** (optional **Confidence:** — verified | inferred | unverified-from-repo, absent
means verified — then optional **Fix-attempt:** only from craft-fix).
Assign sequential NNN per (scope, domain); judge severity with craft-audit prioritization.md.
Forbidden: ### headings; ## ID · 🔴 · open shorthand; severity/status as body bullets.
Map what infra already exists (pipeline, env schema, health endpoints, IaC) before judging —
flag assumptions made without reading the repo's actual config → SKILL.md (Operating principle)
Verify config flows through a validated env schema that fails closed; bad if a missing required
prod var surfaces as a runtime 500 instead of a startup crash → references/config.md
Verify the sending domain has SPF/DKIM/DMARC records set and actually verified (not just pasted
into DNS); bad if transactional email like password resets can silently land in spam →
references/config.md
Confirm billing alerts (and hard spend caps where offered) are set up on every metered provider
before launch; bad if an unauthenticated route can hit a metered/LLM API with no rate limit and
no one would notice the bill until it arrived → references/config.md
Check builds are reproducible and produce immutable, content-addressed artifacts promoted across
environments; bad if each env rebuilds from source or the release is undocumented → references/build-release.md
Confirm CI gates (lint, typecheck, tests, build) block merge on PRs; bad if gates only run on
deploy or merge can land red. TEST ↔ INFRA handoff: TEST owns which suites must gate merge
and what "green" means (including e2e strategy); INFRA owns CI pipeline mechanism (when/how
jobs run, secrets, deploy gates). Missing e2e suite → TEST finding; e2e exists but is not
wired into CI → INFRA finding (TEST may note and route) → references/ci-cd.md
Trace every required gate's trigger, job/step if:, needs, matrix, and secret/environment
branches in both trusted and restricted PR contexts; flag a gate that is success/skipped while
every substantive step was bypassed as vacuously green → references/ci-cd.md
Confirm deploys are automated with a documented one-step rollback per path; bad if prod is
edited manually or no rollback path is written down → references/ci-cd.md
Verify the team knows to roll back first and diagnose after, and that a status page exists; bad
if the instinct under pressure is to hotfix forward on a broken deploy, or an incident floods
the support inbox with "is it down?" messages → references/ci-cd.md
Verify every service exposes distinct health and readiness probes and drains in-flight requests
on SIGTERM; bad if one endpoint conflates "alive" with "ready to serve" → references/runtime-health.md
Check connection pools are sized and scoped to the runtime model; bad if a long-lived in-process
pool is assumed under serverless and exhausts under load → references/runtime-health.md
Verify outbound calls have timeouts, retries with backoff+jitter, and circuit breakers matching
the runtime; bad if ephemeral runtimes rely on in-process breaker/metrics state → references/scale-resilience.md
Confirm one load-test pass ran against the critical path before first real traffic; bad if the
first real traffic spike is also the first time the app has seen concurrent load →
references/scale-resilience.md
Confirm staging environment matches production config (same infra provider, same env var
surface); bad if staging runs on a different platform or is missing required vars that exist
in production → references/build-release.md
Verify an automated post-deploy gate runs in CI: health probe returns 200, at least one
critical API path succeeds, and error rate stays below baseline for 5 minutes after deploy;
bad if this requires manual checks or the pipeline declares success without confirming the
deployed service is actually handling traffic → references/ci-cd.md
1---2name: craft-infra3description: The Craftsman standard for production infrastructure — deployment, env/config, CI/CD, IaC, health/readiness, scaling, platform/edge rate limiting, build/release, rollback. Use WHENEVER work touches infra: deploy, CI gates, env vars, IaC, load failures, platform rate limiting, pooling runtime constraints, or production runtime. Trigger on "deploy this", "set up CI", "add rate limiting", "configure env vars", or "why did it fall over under load". Owns the platform layer — see "Scope boundaries" in the body for handoffs to craft-backend, craft-security, craft-db, craft-testing, and craft-observability.4---56# Infra Craft78This skill encodes one engineer's standard for shipping and running services reliably, applied the9same way across every repo. The **method and opinions** live here; the **project specifics**10(hosting platform, CI system, IaC tool, env-var schema) live in the target repo's code and config —11always discover them, never assume or hardcode.1213## Operating principle — discover before you build1415Different repos already have different pieces in place. Before adding anything, spend a couple of16minutes mapping what exists so you extend rather than duplicate or conflict:1718- `package.json` / lockfile → build tooling, runtime adapters (e.g. `@vercel/node`, `fly` CLI hints,19 serverless framework packages).20- CI config files (`.github/workflows/`, `.circleci/`, `Jenkinsfile`, `.gitlab-ci.yml`) → existing21 gates, deploy steps, environment secrets.22- Env-var schema (`env.ts`, `config.ts`, `.env.example`, `zod` schemas) → which vars are required,23 which are optional, where validation happens.24- Health/readiness endpoints (`/health`, `/ready`, `/api/healthz`) and how they're registered.25- IaC files (`terraform/`, `pulumi/`, `cdk/`, `fly.toml`, `vercel.json`, `render.yaml`) → existing26 resource definitions to extend rather than replace.2728State what you found, then propose the smallest set of additions that closes the gaps.2930## The infra layers (work in this order)31321. **Config** — all configuration flows through a validated env schema that fails closed on missing33 required values. A missing prod var should crash at startup, not surface as a 500 at runtime.34 See `references/config.md`.352. **Build & release** — builds are reproducible and produce immutable artifacts; the release36 process is documented and automated enough that any team member can trigger it. See37 `references/build-release.md`.383. **CI/CD** — gates (lint, typecheck, tests, build) block merge; deploys are automated and39 reversible. Manual prod edits are the failure mode, not the workflow. See `references/ci-cd.md`.404. **Runtime health** — every service exposes health and readiness probes; graceful shutdown drains41 in-flight requests; connection pools are sized and scoped to the runtime model (serverless vs42 long-lived). See `references/runtime-health.md`.435. **Scale & resilience** — timeouts, retries with backoff, circuit breakers, and capacity limits44 that match the actual runtime model. Serverless runtimes do not guarantee shared or durable45 in-process state across invocations/instances — warm instances may reuse module-scope state but46 this is neither guaranteed nor shared globally and can disappear at any time. Anything that47 assumes a long-lived process (in-memory pools, local metrics registries) needs a flag or48 replacement. See `references/scale-resilience.md`.4950## Standing opinions (the non-negotiables)5152These are the judgments that make output consistent across repos — apply them unless the user53overrides:5455- **Config is validated and fails closed.** Every required env var is declared in a schema; if it's56 missing the process refuses to start rather than limping along and erroring at the call site. This57 is the single highest-leverage infra habit.58- **CI gates are required before merge.** Lint, typecheck, tests, and a production build must all59 pass. A CI pipeline that only runs on deploy (not on PR) is too late to catch regressions cheaply.60- **Deploys are automated and reversible.** No manual production edits — they're untracked and61 unreviewable. Every deploy path has a documented rollback step (previous image tag, Vercel62 instant rollback, Terraform state revert, etc.).63- **Serverless runtimes are ephemeral.** In-process pools, singleton metrics registries, and64 circuit-breaker state all evaporate between invocations. Flag any tool or library that assumes a65 long-lived process and propose the serverless-appropriate alternative before wiring it in.66- **Every service has health and readiness endpoints.** Health says "I am alive"; readiness says "I67 am ready to serve traffic". They are not the same check. Load balancers and orchestrators need68 both.6970## Workflow71721. **Discover** — map the existing pipeline, env schema, health endpoints, and IaC (above) and73 report gaps.742. **Propose** — ordered by the five layers, smallest viable additions first.753. **Implement** — against the repo's existing pipeline and conventions, not a greenfield ideal.764. **Verify** — run the CI pipeline end-to-end, hit the health endpoints, and walk through a77 rollback path. Infrastructure you haven't seen work isn't done.7879## Scope boundaries8081This skill owns the platform layer: how the app is built, shipped, configured, and kept standing.82Hand off at these lines:8384- **Rate-limit ownership, so the same gap isn't emitted four times:** INFRA owns platform/edge85 capacity throttling; the route *middleware* mechanism → `craft-backend`; login-abuse *policy* →86 `craft-security`; LLM spend and token limits → `craft-ai`.87- **Connection-pool sizing** → `craft-db`. This skill owns the runtime constraints the platform88 imposes on pooling (serverless concurrency, instance count).89- **CI split:** the pipeline *mechanism* is owned here; *which suites gate merge* → `craft-testing`.90 A suite that exists but isn't wired into CI is an INFRA finding; a missing suite is a TEST finding.91- **Observability** (Sentry, Grafana, SLOs, alerting) → `craft-observability`.92- **Whole-project readiness** → `craft-audit`.9394## Reference index9596Read the one matching the current task — they hold the concrete setup, not this overview:9798- `references/config.md` — env-var schema patterns, fail-closed validation, typed config object, environment-tier separation (secret values and rotation → `craft-security` → `secrets.md`)99- `references/build-release.md` — reproducible builds, immutable artifacts, release process100- `references/ci-cd.md` — gate ordering, deploy automation, rollback patterns, CI secrets injection, OIDC workload identity101- `references/runtime-health.md` — health/readiness probes, graceful shutdown, connection pooling102- `references/scale-resilience.md` — timeouts, retries, circuit breakers, serverless capacity limits103- `references/iac.md` — infrastructure-as-code: platform-native config quickstarts (Fly.io, Render, Railway, Vercel), Terraform/Pulumi state backends, plan-in-CI gate, apply-only-from-main convention104105## Audit checklist (for craft-audit)106107When `craft-audit` plans an infra pass for a scope, it turns this checklist into the `plan.md`108todo list — the checklist is owned by this skill, not improvised by the orchestrator. Tailor to what109discovery found: skip a step that genuinely doesn't apply with a one-line reason; never silently drop110one. Emit findings using craft-audit `workspace.md` → "Canonical findings.md emission format"111(authority). Heading grammar (variables required — do not hardcode NNN/severity/status):112113`## <scopeLabel>-INFRA-<NNN> · severity <🔴|🟡|🟢> · status <open|fixed|wontfix (reason)|regressed|fixed (merged into <ID>)>`114115Example only: `## <scopeLabel>-INFRA-001 · severity 🔴 · status open`116117Required fields under each heading, in order, with these exact labels:118`**What breaks (plain language):**` · `**Technical:**` · `**Fix:**` · `**Fingerprint:**` ·119`**Last-checked:**` (optional `**Confidence:**` — `verified | inferred | unverified-from-repo`, absent120means `verified` — then optional `**Fix-attempt:**` only from craft-fix).121Assign sequential NNN per (scope, domain); judge severity with craft-audit `prioritization.md`.122Forbidden: `###` headings; `## ID · 🔴 · open` shorthand; severity/status as body bullets.123124- [ ] Map what infra already exists (pipeline, env schema, health endpoints, IaC) before judging —125 flag assumptions made without reading the repo's actual config → `SKILL.md` (Operating principle)126- [ ] Verify config flows through a validated env schema that fails closed; bad if a missing required127 prod var surfaces as a runtime 500 instead of a startup crash → `references/config.md`128- [ ] Verify the sending domain has SPF/DKIM/DMARC records set and actually verified (not just pasted129 into DNS); bad if transactional email like password resets can silently land in spam →130 `references/config.md`131- [ ] Confirm billing alerts (and hard spend caps where offered) are set up on every metered provider132 before launch; bad if an unauthenticated route can hit a metered/LLM API with no rate limit and133 no one would notice the bill until it arrived → `references/config.md`134- [ ] Check builds are reproducible and produce immutable, content-addressed artifacts promoted across135 environments; bad if each env rebuilds from source or the release is undocumented → `references/build-release.md`136- [ ] Confirm CI gates (lint, typecheck, tests, build) block merge on PRs; bad if gates only run on137 deploy or merge can land red. **TEST ↔ INFRA handoff:** TEST owns which suites must gate merge138 and what "green" means (including e2e strategy); INFRA owns CI pipeline mechanism (when/how139 jobs run, secrets, deploy gates). Missing e2e *suite* → TEST finding; e2e exists but is *not140 wired into CI* → INFRA finding (TEST may note and route) → `references/ci-cd.md`141- [ ] Trace every required gate's trigger, job/step `if:`, `needs`, matrix, and secret/environment142 branches in both trusted and restricted PR contexts; flag a gate that is success/skipped while143 every substantive step was bypassed as vacuously green → `references/ci-cd.md`144- [ ] Confirm deploys are automated with a documented one-step rollback per path; bad if prod is145 edited manually or no rollback path is written down → `references/ci-cd.md`146- [ ] Verify the team knows to roll back first and diagnose after, and that a status page exists; bad147 if the instinct under pressure is to hotfix forward on a broken deploy, or an incident floods148 the support inbox with "is it down?" messages → `references/ci-cd.md`149- [ ] Verify every service exposes distinct health and readiness probes and drains in-flight requests150 on SIGTERM; bad if one endpoint conflates "alive" with "ready to serve" → `references/runtime-health.md`151- [ ] Check connection pools are sized and scoped to the runtime model; bad if a long-lived in-process152 pool is assumed under serverless and exhausts under load → `references/runtime-health.md`153- [ ] Verify outbound calls have timeouts, retries with backoff+jitter, and circuit breakers matching154 the runtime; bad if ephemeral runtimes rely on in-process breaker/metrics state → `references/scale-resilience.md`155- [ ] Confirm one load-test pass ran against the critical path before first real traffic; bad if the156 first real traffic spike is also the first time the app has seen concurrent load →157 `references/scale-resilience.md`158- [ ] Confirm staging environment matches production config (same infra provider, same env var159 surface); bad if staging runs on a different platform or is missing required vars that exist160 in production → `references/build-release.md`161- [ ] Verify an automated post-deploy gate runs in CI: health probe returns 200, at least one162 critical API path succeeds, and error rate stays below baseline for 5 minutes after deploy;163 bad if this requires manual checks or the pipeline declares success without confirming the164 deployed service is actually handling traffic → `references/ci-cd.md`
Run npx skillmds@latest add gul-labs/craft-infra in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
The Craftsman standard for production infrastructure — deployment, env/config, CI/CD, IaC, health/readiness, scaling, platform/edge rate limiting, build/release, rollback. Use WHENEVER work touches infra: deploy, CI gates, env vars, IaC, load failures, platform rate limiting, pooling runtime constraints, or production runtime. Trigger on "deploy this", "set up CI", "add rate limiting", "configure env vars", or "why did it fall over under load". Owns the platform layer — see "Scope boundaries" in the body for handoffs to craft-backend, craft-security, craft-db, craft-testing, and craft-observability. It is listed under DevOps & Infra on SkillMD.
This skill has not completed SkillMD's automated safety review yet. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
gul-labs (@gul-labs) published this skill. Their other Agent Skills are listed on their SkillMD profile.