Index of every page on this site: llms.txt
All skills
gillmacedo avatar

/triaging-go-data-races

@197596d
Run it yourself

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.

  • 1 file
  • 3 KB
  • Updated 3 weeks ago
  • GitHub
Use this Skill: https://skilld.dev/gh/gillmacedo/racesift/triaging-go-data-races

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈98 tokens for metadata: the name and description. ≈651 when used: this file.

Description uses 4.9% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈392 characters, or 4.9%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

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.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 197596d. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 3 weeks ago

README badge

README badge for gillmacedo/racesift