Skip to content
Skills Library
Programming · Analysis

triaging-go-data-races

/triaging-go-data-races

Groups and ranks Go data race reports from `go test -race` or `go run -race` output, then finds the shared variable and missing synchronization for each one. Use when the user has "WARNING: DATA RACE" output, a CI log where tests failed with "race detected during execution of test", asks why the race detector fails, or wants to know if a branch adds new data races.

Repository
racesift ↗
Licence
MIT
Last repository change
08.11.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 08.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Groups and ranks Go data race reports from `go test -race` or `go run -race` output, then finds the shared variable and missing synchronization for each one. Use when the user has "WARNING: DATA RACE" output, a CI log where tests failed with "race detected during execution of test", asks why the race detector fails, or wants to know if a branch adds new data races.

Triggers from the description

WARNING: DATA RACErace detected during execution of test
Original author description

Groups and ranks Go data race reports from `go test -race` or `go run -race` output, then finds the shared variable and missing synchronization for each one. Use when the user has "WARNING: DATA RACE" output, a CI log where tests failed with "race detected during execution of test", asks why the race detector fails, or wants to know if a branch adds new data races.

How it works

  1. Get the output
  2. Run the tool
  3. Check each race in the code
  4. Report
  5. Don't
Original SKILL.md headings · 44 lines, 451 words
SKILL.md preview
---
name: triaging-go-data-races
description: Groups and ranks Go data race reports from `go test -race` or `go run -race` output, then finds the shared variable and missing synchronization for each one. Use when the user has "WARNING: DATA RACE" output, a CI log where tests failed with "race detected during execution of test", asks why the race detector fails, or wants to know if a branch adds new data races.
---

# Triaging Go data races

The race detector prints one long report per race it sees, and the same race often repeats across tests. Group them first with the bundled tool. It only reads text and needs Go installed.

## Get the output

If the user has a log or CI output, save it to a file and use that. Otherwise run the tests, narrowed to the package in question when you know it:

    go test -race ./... 2>&1 | tee /tmp/race.log

`go test -json` output and GitHub Actions logs, with their timestamps, also work. `-race` needs cgo on some platforms. If it fails to build, say so rather than guessing.

## Run the tool

    go run "${CLAUDE_PLUGIN_ROOT}/scripts/racesift.go" review /tmp/race.log

It prints each distinct race once, ranked by how many tests hit it, with both code locations, the tests, where each goroutine started, and hints (`RS101` to `RS108`). "Lines in more than one race" lists code that shows up in several races. Start there, because one missing lock often causes several races. Add `--json` for structured output.

To check a branch, run the tests on both and compare. Races are matched by the functions involved, so line changes elsewhere don't make an old race look new:

    go run "${CLAUDE_PLUGIN_ROOT}/scripts/racesift.go" compare base.log head.log

## Check each race in the code

Hints are leads from the stack shape, not proof. For each race:

1. Read both locations. Name the variable or field they share, and say which goroutines touch it.
2. Find the missing happens-before link: a lock one side forgets, a field read before `wg.Wait`, a value captured by a closure, or a struct replaced while in use.
3. When a side has no frame from the user's code (`RS108`), use where its goroutine started and the other side to find it. Say that the location is inferred.
4. When every frame is in `_test.go` files (`RS107`), check whether the test itself is wrong before changing the code under test.

## Report

1. List races worst first: those hit by the most tests, or on hot lines. Give `file:line` for both sides and the shared variable.
2. Propose the smallest fix in the project's style: a mutex the type already has, an `atomic` type, a channel, or a copy before starting the goroutine.
3. After a fix, suggest rerunning with `go test -race -count=5` on that package. One clean run doesn't prove a race is gone.

## Don't

- Don't edit code unless the user asks.
- Don't suggest `time.Sleep`, retries, or skipping `-race` to make a race go away.
- Don't say code is race free because nothing was reported. The race detector only sees races that happen during that run.

Versions

The database has no other skills named triaging-go-data-races.

Database snapshot: 13.11.2026 · package version 6db5245da704 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100erigon-test-race
    Run Erigon tests with Go race detector to find data races and concurrency bugs. Use this for concurrency-sensitive changes (parallel executor, p2p, txpool). Takes 30-60 minutes.
  • 100race-condition-test-author
    Build deterministic race-condition tests - identify shared mutable state, drive interleavings via barriers / latches / manual scheduling; use ThreadSanitizer (clang `-fsanitize=thread`) for C/C++ data race detection; run the Go race detector end-to-end (`go test -race`, GORACE…
  • 100swift-actor-persistence
    Thread-safe data persistence in Swift using actors — in-memory cache with file-backed storage, eliminating data races by design. Use when persisting data in Swift and a data race or thread-safety problem needs designing out.
  • 90race-conditions
    Diagnose data races by reasoning about happens-before order, running sanitizers, and stressing the timing until the bug shows. Use when a bug appears only under load, only sometimes, or vanishes when you add a print statement.
  • 100go
    Use when writing Go services, CLIs, or libraries. Covers idiomatic error wrapping, goroutine and context discipline, interface design, table-driven tests, and the race detector. Trigger on "goroutine leak", "how should i wrap this error in go", "race detector is flagging this",…
  • 100race-condition-test-author
    Use when a bug only appears under load on shared in-process state (cache, counter, pool, lazy singleton), or a race needs a regression test before the fix. Forces interleavings with barriers and latches, and runs ThreadSanitizer, go test -race with goleak, or jcstress for the JVM.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.