env-detectivelisted
Install: claude install-skill 0xmortuex/claude-code-skills
# env-detective
When the same commit behaves differently in two places, the code is the one thing you can rule out. The bug lives in the delta between the environments — and staring harder at the code (the instinctive move) cannot find it. The method: **enumerate the delta, rank it by base rates, and binary-search it with experiments.** Never speculate when you can diff.
## Step 1: pin down the actual failure
Get the *exact* failing output from the failing environment — the full CI log for the failing step, not the user's summary of it. Confirm both sides really run the same commit (`git rev-parse HEAD` vs the sha CI checked out — "it fails on CI" regularly turns out to be "CI runs main, I'm on my branch"). Note *what kind* of failure: different test result, compile error, missing file, hang, crash. Each points at a different slice of the delta.
## Step 2: enumerate the delta — collect facts, not vibes
Gather the same facts from both sides (locally: run the commands; for CI: read the workflow file, the runner image docs, and add a debug step printing them if needed):
- **Toolchain versions**: language runtime, package manager, compiler, relevant CLIs (`node -v`, `python -V`, `rustc -V`…). Minor versions count.
- **Dependency state**: does the lockfile fully pin, and does the failing side actually install from it (`npm ci` vs `npm install`)? Any `latest` tags, floating ranges, or caches restoring stale deps?
- **The tracked-files gap**: `git status --ignored` locally. CI