Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Guides safe, behavior-preserving Go refactoring using gopls, gofmt -r, eg, gopatch and go/analysis fixers, landed as small stacked PRs.
57% 83%+26 ptsof test cases passed
Passed 19 of 23 test cases with the skill, and 13 of 23 without it.
3 of 3 safety checks passed
8 agent runs
1 forkA fork is a copy of this skill that someone made so they could edit it for their own use. The original doesn't change.
This file is the tool reference for samber/cc-skills-golang@golang-refactoring: every mechanical-rewrite tool worth reaching for, from the primary actuator (gopls) down to hand-rolled go/analysis fixers, ordered so you can pick the least-powerful tool that solves the problem. See catalog.md for which tool maps to which Fowler refactoring, and workflow.md for how a tool-driven step fits into the staged-PR process.
refactor.rewrite.* family.Tool: line on each entry in catalog.md for which gopls action maps to which refactoring.samber/cc-skills-golang@golang-gopls — this file covers the tools that skill doesn't.When a change recurs across many call sites, reach for a generated rewrite tool instead of hand-editing each one. The tools below are ordered by increasing power — start at the top and move down only when the current tool's limits block the rewrite you need.
gofmt -r — syntactic, single-expressiongofmt -r 'bytes.Compare(a, b) == 0 -> bytes.Equal(a, b)' -w file.go
gofmt -r 'bytes.Compare(a, b) != 0 -> !bytes.Equal(a, b)' -w file.go
gofmt -s -w file.go # -s additionally simplifies (e.g. s[a:len(s)] -> s[a:])
gofmt -l . # list non-conforming files — useful as a CI gate
gofmt -d file.go # show the diff without writing
bytes.Compare call on a []byte, but not a look-alike function of the same name from another package" — that distinction needs eg.eg — type-aware, example-basedgolang.org/x/tools/cmd/eg rewrites by example, à la Refaster: a template file declares before/after functions of identical type, each with a single-expression body.
// template.go
package template
import (
"errors"
"fmt"
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.