skills/infra-docs/SKILL.md
--- name: infra-docs description: Generate (and refresh) architect-grade living documentation of an app's deployed cloud infrastructure. Discovers the real, live resources (not just what's in config) — Cloudflare Workers + D1 + R2 + Secrets Store + Workers AI + Durable Objects + Zero Trust/Access + cron, or Fly/Vercel equivalents — reads the codebase to map data flows, and writes a multi-document set under docs/infrastructure/ with C4-style architecture diagrams, per-resource detail, mermaid seq
npx skillsauth add RonanCodes/ronan-skills skills/infra-docsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Produce the documentation a new architect joining the project would want on day one: what cloud resources exist, why each one, how data and auth flow between them, where the security boundaries are, and how to rebuild it from nothing. The point is understanding, not an inventory dump.
Two hard rules:
wrangler.jsonc/fly.toml/vercel.json for intent, then query the provider (wrangler / CF API / flyctl) for what is actually deployed: resource IDs, regions, table counts, sizes, deployment versions, routes, Access apps. Config drifts from reality; the doc must reflect reality and flag drift.wrangler secret / env)./ro:cf-ship, /ro:gh-ship, /ro:fly-deploy), run this to capture the freshly-stood-up infrastructure while it's fresh. This should be a standing step of standing up any new app.<!-- HAND-EDITED --> blocks.ls wrangler.jsonc wrangler.toml fly.toml vercel.json 2>/dev/null
wrangler.*): the main case. Note name, main, compatibility_date, triggers.crons, vars, and every binding block (d1_databases, r2_buckets, kv_namespaces, secrets_store_secrets, durable_objects, ai, queues, services, hyperdrive, vectorize).fly.toml): apps, machines, volumes, Postgres, secrets.vercel.json / project): functions, env, integrations.Cloudflare (use the deploy token from ~/.claude/.env or the project's configured token; export CLOUDFLARE_API_TOKEN=... CLOUDFLARE_ACCOUNT_ID=...):
pnpm exec wrangler deployments list # current version, history
pnpm exec wrangler d1 list # databases
curl .../accounts/$ACC/d1/database/$ID # region, num_tables, file_size
pnpm exec wrangler r2 bucket list # buckets
pnpm exec wrangler secrets-store store list --remote # secret stores (NOT values)
curl .../accounts/$ACC/access/apps # Zero Trust / Access apps + policies
curl .../accounts/$ACC/workers/subdomain # workers.dev hostname
# routes / custom domains, queues, DO classes as applicable
Record IDs, regions, sizes, the deployed version hash, the live hostname(s), and the Access AUD/team domain. Note any binding present in config but missing live (or vice versa) as drift.
Find the real flows, don't invent them:
main): the fetch handler, scheduled handler (cron), middleware (auth/JWT), DO classes.Identify the 4-8 flows worth a sequence diagram (typical: user-auth/login, primary write path, primary read path, any background/cron job, any AI/model call, any file-upload path, any payment/webhook path).
docs/infrastructure/Create these (merge/skip per what the app actually has). Lead each with a one-line "generated by /ro:infra-docs on <date>, reflects live state" note.
README.md — the entry point. A C4-style System Context + Container diagram (mermaid flowchart), a one-paragraph "what this app is", and a resource inventory table (resource | id | region | purpose | limits/tier). Link to the other docs.resources.md — one section per cloud resource. For each: what it is, why it's used (the decision), its live ID/name/region, its config, relevant limits + cost tier, and how to inspect it (the exact wrangler/curl command). This is the "what exists and why" reference.data-flows.md — a mermaid sequence diagram per key flow from step 3, each with a prose walkthrough naming the participants (browser, edge/Access, Worker, D1, R2, AI, DO, cron). This is the "how it works" doc.security.md — the security architecture: the auth gate (edge + in-Worker), identity, the encryption model (what's encrypted vs plaintext and why, key hierarchy, where keys live), secret management, and an honest threat model + boundary (what it protects against, what it explicitly does not). Reuse any boundary statement already in the repo README/ADRs rather than re-deriving.runbook.md — operational: how to deploy, how to provision the whole thing from scratch in a clean account (ordered commands), the token/scope requirements, env vars, how to roll back a deploy, how to rotate secrets, and the smoke test that proves the gate works.Use mermaid for all diagrams (renders on GitHub). Prefer flowchart for topology, sequenceDiagram for flows, erDiagram for the data model if the app owns its schema. Keep diagrams readable: 5-12 nodes, not everything at once.
<!-- HAND-EDITED START --> / <!-- HAND-EDITED END --> verbatim.KV binding with no live namespace").Commit under the repo's convention (emoji + conventional: 📝 docs:). Respect any commit-timestamp rules in the repo/global CLAUDE.md. Do NOT commit secret values (step 0 rule).
This skill is meant to run automatically once an app is live. Recommended wiring:
/ro:cf-ship, /ro:gh-ship, /ro:fly-deploy: after the post-deploy smoke check passes, if docs/infrastructure/ is absent (first deploy) OR the deploy changed bindings, invoke /ro:infra-docs. First deploy → always generate./ro:app-polish: include "infrastructure docs present + current" as a checklist item./ro:cf-ship / /ro:gh-ship / /ro:fly-deploy — the deploy skills that should call this at their tail on first deploy./ro:generate-spec / /ro:compare-codebase-to-spec — spec-level docs (intended behaviour); this skill is the infrastructure-level companion (what's actually deployed)./ro:doc-standards — house style for docs; follow it for prose./ro:security-audit — the security doc here describes the model; that skill scans for leaks.development
--- name: worktree description: Coordinate multiple agents on one repo via a worktree-lock pool, so two agents never clobber each other's working tree. Acquire the first free slot (main, then beta/gamma… worktrees, created on demand), work there on your own branch, release when you've pushed. Use before modifying any repo that might be in use by another agent (factory, dataforce, etc.), or whenever you're told a repo is being worked on. Backed by `ro worktree`. category: development argument-hin
testing
--- name: ship description: Ship a feature branch the local-CI-first way — run the full local gate, push, open a PR, squash-merge, then deploy, without waiting on GitHub Actions. Use when a branch is ready for main and you want it merged and deployed now. Reads CI policy from `ro ci` (default skips remote CI because GitHub Actions billing keeps hitting limits). Sibling to /ro:gh-ship (waits on GitHub checks) and /ro:cf-ship (the deploy half). Triggers on "ship it", "ship this", "merge and deploy
testing
--- name: setup-logging description: Set up (or audit) the observability stack in a TanStack Start + Cloudflare Workers app so it is "diagnosable by default" — structured logging (logtape) with a request context carrying trace_id + userId + tenant/orgId, a trace_id propagated FE→BE→logs→Sentry→PostHog, Cloudflare Workers observability enabled, and Sentry + PostHog wired. Two modes: `setup` (wire it into an app) and `audit` (check an existing app + report gaps). Use when scaffolding a new app, wh
development
Manage credentials INSIDE the active ~/.claude/.env file — read which token/account to use for a given app (Simplicity vs Dataforce vs Ronan-personal), add or update a secret WITHOUT it passing through the chat (an interactive Terminal window prompts for it), and track secrets that were exposed in a transcript so they get rotated. Sibling to /ro:context (which switches WHICH env file is active). Use when the user wants to add an API key/token/secret, asks "which credential do I use for X", needs the env organized/labelled, or a secret was pasted into the chat and should be rotated.