# Measure Before You Fix

Before fixing a slow/stale/timeout alert, measure the step yourself.

- Repository: https://github.com/garrytan/gbrain (31427 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add garrytan/gbrain --skill measure-before-you-fix -g -a claude-code -y`
Codex: `npx skills add garrytan/gbrain --skill measure-before-you-fix -g -a codex -y`
Cursor: `npx skills add garrytan/gbrain --skill measure-before-you-fix -g -a cursor -y`
Gemini CLI: `npx skills add garrytan/gbrain --skill measure-before-you-fix -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add garrytan/gbrain`

## Description

Before fixing a slow/stale/timeout alert, measure the step yourself. Kill the theory with a stopwatch, not a code change. Measure-first ops triage for temporal alerts (stale, timeout, freshness, wedged, N hours behind) from gbrain doctor, autopilot, sync, and cron monitors, runs BEFORE any timeout raise, threshold change, or pipeline rewrite.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Measure Before You Fix

> **Convention:** see [conventions/brain-first.md](../conventions/brain-first.md), > before re-deriving a diagnosis, `search` the brain for prior incidents of
> the same alert. A recurring alert usually has a recorded verdict already.

Route here on any alert whose claim is **temporal**, "X is stale", "step
timed out", "pipeline wedged", "job is slow", "N hours behind". These alerts
invite an immediate structural fix (raise the timeout, split the step,
reorder the pipeline). Do the measurement first. It is almost always cheaper
than the fix, and it frequently invalidates it. (Routing is a harness
convention, not a mechanical guarantee, the contract below is the
discipline that makes it stick.)

On gbrain surfaces this covers: `gbrain doctor` staleness checks (e.g. sync
freshness, cycle freshness), autopilot cycle alerts, the sync stall watchdog
(`reason: 'stall_timeout'`), and any cron monitor built on top of them.

## The rule

**One stopwatch measurement of the suspect step, before any code change.**

If you cannot state the measured duration of the thing you claim is slow, you
do not yet know the root cause, and any fix you write is a guess wearing a diff.

## Contract

This skill guarantees:

- No structural fix (timeout raise, step split, pipeline reorder, wrapper
  rewrite) is proposed before a measured duration of the blamed step exists.
- The measurement targets the *specific* entity the alert named, not the
  aggregate (`--all` hides which member is slow).
- The alert's threshold is compared against the authoritative one
  (`gbrain doctor`'s warn/fail lines) before the system is declared unhealthy.
- The verdict explicitly distinguishes "needs more time" from "is wedged", they have opposite fixes.
- Read-only: this skill changes no timeouts, thresholds, or code. It produces
  a measurement verdict that sizes the fix; the fix itself is a separate,
  now-informed change.

## Procedure

The rest: https://github.com/garrytan/gbrain/blob/HEAD/plugin-variants/gbrain-coding/skills/measure-before-you-fix/SKILL.md
