skills/diagnose/SKILL.md
Diagnose a runtime bug by sweeping the observability logs (Cloudflare Workers logs, Sentry, PostHog) using the shared trace_id, and if the logs don't capture what's needed, ADD structured logging at the failure point + in the request context, deploy (remote) or run locally, and have the user reproduce. Use whenever the user mentions logs, a bug, an issue, "why did X fail / not work", "check the logs", "it works on desktop but not mobile", a stack trace, an error code, or a flaky/intermittent failure. Auto-pick this before guessing at a fix.
npx skillsauth add RonanCodes/ronan-skills diagnoseInstall 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.
When the user reports a bug, an error, or "why did X fail", do NOT jump to a speculative fix. Run this loop:
Grep the failing path. Form a concrete hypothesis about WHERE and WHY. Note the exact signal you'd need from logs to confirm (an id, a resolved value, a branch taken).
Source creds from ~/.claude/.env (see /ro:env for which keys). Correlate with the trace_id if the app has it (the x-dataforce-trace-id pattern), and pivot to the PostHog session replay for front-end repros.
observability: { enabled: true } in wrangler.jsonc (else wrangler tail is LIVE-only; you can't see the past).
wrangler tail for a live repro; for history use the observability telemetry API:
POST https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/workers/observability/telemetry/query (filter by worker + time + a needle like the error code).GET https://de.sentry.io/api/0/projects/<org>/<project>/issues/?statsPeriod=24h with Authorization: Bearer $SENTRY_AUTH_TOKEN. NOTE: handled { ok:false } error envelopes are NOT exceptions — they won't be in Sentry. Only thrown/captured errors are.GET https://eu.posthog.com/api/projects/<id>/events/?limit=N with Authorization: Bearer $POSTHOG_PERSONAL_API_KEY. Find the user's event (e.g. chat_message_sent) near the failure time; grab $session_id → replay URL https://eu.posthog.com/project/<id>/replay/<session_id>.Add structured logging that captures exactly the signal you needed in step 1:
userId, orgId, trace_id. Then add a targeted log(...).info('<event>', { ...resolved values, branch taken }) at the decision point, and a warn at the failure point (error code + scope).Then choose where to reproduce:
pnpm dev (tee logs to .dev-logs/), reproduce locally, read the logs. Suggest this when the failure isn't environment-specific.Ask the user which, if it's genuinely ambiguous; otherwise infer (mobile/prod → remote).
After the re-run, read the new logs, confirm the hypothesis, ship the real fix (often the instrumentation PR already contains it), and keep the useful logs.
A repo is "diagnosable" when it has, by default:
trace_id + userId + tenant/orgId.observability: { enabled: true } (historical Workers logs), Sentry, and PostHog wired.
When diagnosing in a repo that lacks these, propose adding them — it's the difference between "add a log and redeploy" (minutes) and "guess". Reference the dataforce trace_id implementation (issue #288) as the template./ro:env — which credential for which log source./ro:posthog, /ro:sentry — deeper per-tool operations./ro:cf-ship — deploy the instrumentation so a remote repro can be re-run.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.