In short.
golang-refactoring is an instruction pack for Go developers using AI coding assistants, but its staged process requires tooling, test preparation and repeated human approvals. It explains how to map affected callers, choose mechanical transformations, preserve old type names during package moves, and separate structural changes from behavior changes. Its strongest contribution is connecting Go-specific techniques to an explicit delivery sequence. Its safety guarantees remain documentation claims: reflection, incomplete coverage, manual transformations and inconsistent risk examples require judgment. Nothing was executed, so compatibility, correctness, performance and operating costs remain unassessed.
Researched and written by an AI model and checked by a second AI model. How it works
The scope is the complete skills/golang-refactoring folder at revision d68d80aec298e1b74b37c2a472c002b5217248b3: SKILL.md and all five reference Markdown files. The repository-root LICENSE is included as the related notice above that folder. Other repository skills, linked documentation, external tool code and downstream Go projects are excluded. All supplied files were read as source evidence. Installation, assistant loading, commands, refactoring behavior, tests and benchmarks were not executed; operational outcomes remain unassessed.
The overview
What the resource is
golang-refactoring is a loadable instruction skill in samber/cc-skills-golang. It identifies samber as its author, declares skill version 1.1.1 and skill-library-version 0.20.0, and targets Claude Code, Codex or similar assistants working on Go projects.
The resource consists of SKILL.md and five reference documents covering refactoring patterns, tools, testing, package structure and staged delivery. Original source: [https://github.com/samber/cc-skills-golang/tree/main/skills/golang-refactoring].
Where it fits
The skill is most useful when an existing Go codebase needs coordinated restructuring: renaming shared symbols, extracting responsibilities, moving types or untangling package dependencies. It connects each change to tool choice, affected callers, verification and review order.
Its main tradeoff is coordination overhead. Larger refactors use an integration branch, separate worktrees and pull requests, delegated changes, and human approval between merges. The documentation supports the usefulness of this structure, but provides no measured evidence that it reduces defects or saves time.
Who it is for
The intended users are Go developers and maintainers who work with a coding assistant and can review changes to tests, APIs and package boundaries. Experienced developers get specific transformation commands and migration recipes; beginners get explanations of code smells, type aliases and tests that record existing behavior.
Beginners still need practical Go, testing and Git knowledge. Teams also need review capacity for the staged process. The skill itself advises postponing broad refactoring when there is no concrete purpose, review time is scarce, or critical code lacks tests.
What it covers
The skill directs an assistant through symbol renaming, function extraction and inlining, selected signature changes, file and package restructuring, import-cycle repair and gradual API migration. Its catalog connects common problems, such as long functions and repeated conditionals, to Go-specific techniques.
For repeated edits, it describes a progression from gofmt -r to type-aware eg templates, statement-level gopatch patches and custom go/analysis fixers. Several transformations remain manual, and package splitting is described as experimental. These are documented procedures rather than demonstrated execution capabilities.
Using it
What it needs
The stated core requirements are a Go project, Go tooling, gopls and Git. The full staged workflow also assumes worktrees, subagents, an approval interface and pull requests; its GitHub examples use gh. Optional tools include golangci-lint, benchstat, deadcode, eg and gopatch.
No supported minimum Go or gopls version matrix is supplied. Some procedures depend on version-specific or experimental actions. The declared tool permissions and assistant features are harness-specific, so equivalent behavior across Claude Code, Codex and other assistants is not established.
How it works
Its core loop is to understand affected code, establish tests, perform one small tool-driven change, verify it and commit it separately. Before editing, the assistant is instructed to map references and callers, list atomic changes, classify their risks and obtain approval.
Testing effort depends on the affected code's coverage: roughly 80% or more permits broader mechanical work, roughly 40–80% calls for targeted tests first, and below 40% or uncovered changed lines calls for characterization tests that record current behavior. These are the author's planning thresholds. The document acknowledges that Go measures statement coverage, which does not prove every branch or behavior is tested.
For staged delivery, dependencies determine order, overlapping changes run sequentially, and workspace-wide renames run alone. Structural changes and changes to observable behavior belong in separate pull requests.
Getting started
Obtain the complete skill folder and preserve the relative references directory when making it available to an assistant. A fixed source snapshot is available at [https://github.com/samber/cc-skills-golang/tree/d68d80aec298e1b74b37c2a472c002b5217248b3/skills/golang-refactoring]. The supplied files do not establish a harness-specific installation command or directory.
The skill gives go install golang.org/x/tools/gopls@latest as its gopls installation command. Because @latest does not pin a tool version, repeatable use requires choosing compatible versions explicitly. Full gopls and MCP setup is delegated to a separate golang-gopls skill whose contents are outside this resource.
A documented example
For a hypothetical move from oldpkg.OldName to newpkg.NewName, the documented recipe puts the real definition in newpkg and leaves type OldName = newpkg.NewName in oldpkg with a deprecation comment. Callers migrate incrementally; the alias is removed after migration and the required approval. The equals sign makes the old name an alias rather than a separate named type.
The proposed verification after each step is go build ./..., go vet ./... and go test ./.... Concurrency changes add race detection, while hot paths add before-and-after benchmarks compared with benchstat. This is an illustrative procedure; no successful migration or verification result is established.
Assessment & evidence
Limits and unresolved questions
The documentation describes Rename and Inline as preserving behavior by construction, but also identifies limits around reflection, templates and struct tags. Extraction requires closer inspection and may lose comments. Passing compilation and tests does not establish that all externally visible behavior survived.
Risk examples are not fully consistent: the catalog classifies Extract Function/Method as Medium, while the workflow's sample inventory labels an extraction Low. The coverage percentages are heuristics, and characterization tests preserve existing behavior even when that behavior contains defects.
Some catalog advice needs additional semantic judgment. Replace Temp with Query proposes recomputing an expression previously evaluated once; preserving behavior requires checking repeated evaluation and side effects. This concern follows from the described transformation, rather than from an observed failure.
Runtime compatibility, transformation correctness and performance remain unassessed. The files contain no execution results demonstrating reliable operation across the named assistant environments.
Why the approach may help
The strongest rationale is matching safeguards to the actual change. Mapping callers exposes dependencies, mechanical tools reduce repetitive editing, tests record behavior, and separate commits let reviewers evaluate one concern at a time. Together, these practices make individual steps easier to inspect and reverse.
The Go-specific guidance adds substance: consumer-defined interfaces can remove concrete package dependencies, while aliases support gradual type-name migration. These mechanisms explain the approach's potential value, but the available material does not quantify their results when directed by this skill.
Other approaches to consider
For an isolated rename or inline operation, developers can use the documented gopls actions directly through their editor or command line. The workflow also acknowledges that small, independent pull requests can land directly on trunk; its integration branch model is a deliberate choice for coordinated staged work.
For adjacent needs, the source points to golang-naming for naming choices, golang-project-layout for target package structure and golang-modernize for language-version idioms. Those companion skills are outside the supplied scope, so their contents and suitability are unknown.
Available source evidence
The available source material contains SKILL.md, references/catalog.md, references/go-tooling.md, references/safety-net.md, references/structural.md and references/workflow.md, plus the repository-root LICENSE. It supports analysis of the skill's instructions, examples, declared dependencies and redistribution terms.
All supplied files identify revision d68d80aec298e1b74b37c2a472c002b5217248b3. The main instruction file is available at [https://raw.githubusercontent.com/samber/cc-skills-golang/d68d80aec298e1b74b37c2a472c002b5217248b3/skills/golang-refactoring/SKILL.md]. External tool implementations, linked companion skills and projects using the skill are outside this material. Nothing was installed or executed, and no test or benchmark results are available.
Access & freshness
Costs and effort
No purchase price, subscription price or measured operating cost is stated. The MIT licence grants reuse rights, but does not establish the cost of the assistant, model usage, CI or computing resources used alongside the skill. Those costs are unknown.
The process requires time for test preparation, delegated work, verification and human review. No token counts, execution durations, cost comparisons or measured savings are supplied.
Licence and redistribution
SKILL.md declares MIT licensing, and the repository licence names Samuel Berthe as the 2026 copyright holder. It permits use, copying, modification, distribution, sublicensing and sale, subject to retaining the copyright and permission notice in copies or substantial portions.
The six selected Markdown files can be redistributed with the repository LICENSE retained. The licence disclaims warranties and liability. It does not establish licensing terms for separately obtained assistants or external tools. Original notice: [https://raw.githubusercontent.com/samber/cc-skills-golang/d68d80aec298e1b74b37c2a472c002b5217248b3/LICENSE].
Version and currency
The supplied snapshot was captured on 16 November 2026 at 08:55:36.235 UTC from revision d68d80aec298e1b74b37c2a472c002b5217248b3. Its metadata declares skill version 1.1.1 and library version 0.20.0; these declarations do not establish a publication date or supported-tool matrix.
The references discuss Go 1.26 and 1.27 tooling changes and experimental gopls actions. Their availability should be confirmed against the chosen toolchain. The contents of the moving main branch after this snapshot are unknown.
Practical next steps
For an initial adoption, obtain the complete pinned folder, confirm that the assistant can load its references, and check the required gopls actions against the project's toolchain. Begin with a bounded change whose purpose, affected callers and existing tests are clear.
Use the skill's planning gate before edits. Confirm that tests exercise the touched paths, inspect generated diffs and dynamic references, and resolve the inconsistent extraction risk labels before relying on them. For a staged refactor, allocate reviewer time and agree on its integration branch and per-change approval process.
