golang-refactoring
Refactor Go Code with Tests and Human Review
Large Go refactors can break callers, hide behavior changes, and create conflicting pull requests. This skill guides tool-driven changes with targeted tests and staged human review.
Install with my Agent
Copy this request to your Agent. It includes the canonical Skill page and manifest.
Review the Skillstore skill "golang-refactoring" from https://skillstore.io/skills/samber-golang-refactoring.md and its manifest at https://skillstore.io/api/skills/samber-golang-refactoring/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.Your Agent should still show its plan and request any confirmation required by the security policy.
Agent-readable resources
Use these links when an AI agent, crawler, or script needs clean context instead of reading the full page.
Test it
Using "golang-refactoring". Plan extracting validation from a long order-processing function with limited tests.
Expected outcome:
- Assessment: affected validation paths need characterization tests before extraction.
- Plan: capture current success and failure results, then extract only the validation responsibility.
- Verification: review the extraction diff and run build, vet, and targeted tests.
- Checkpoint: obtain approval before editing; keep behavior changes outside this refactor.
Using "golang-refactoring". Plan moving a public invoice type into a billing package without breaking callers.
Expected outcome:
- Assessment: inspect callers, package dependencies, exported methods, and reflection-sensitive uses.
- Stage one: introduce the type in the destination and preserve the old name through a compatibility alias.
- Stage two: migrate callers incrementally in reviewed pull requests.
- Stage three: remove the deprecated alias only after reference checks and the required compatibility review.
Security Audit
SafeAll 52 static findings are false positives involving Markdown formatting, documentation links, Go examples, or legitimate refactoring tools. No evidence found of malicious prompt injection, credential theft, or unauthorized data transfer in the six reviewed files. Tool installation, repository edits, test execution, and pull request creation remain operational actions requiring appropriate permissions and review.
Risk Factors
๐ Filesystem access (3)
โก Contains scripts (1)
โ๏ธ External commands (31)
๐ Network access (2)
Share & cite this report
Share the versioned assessment report, neutral badge, embed card, and citations. Skillstore reports evidence without deciding whether this Skill is safe.
Copy report link
https://skillstore.io/skills/samber-golang-refactoring/audits/1?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown badge
[](https://skillstore.io/skills/samber-golang-refactoring?utm_source=security_passport_badge)HTML badge
<a href="https://skillstore.io/skills/samber-golang-refactoring?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/samber-golang-refactoring/security.svg" alt="Skillstore security assessment" loading="lazy"></a>Embed card
<iframe src="https://skillstore.io/embed/skills/samber-golang-refactoring.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>Academic citations (APA ยท BibTeX ยท CFF)
APA citation
samber. (2026). golang-refactoring security audit report (audit version 1) [Author version 1.1.1]. Skillstore. https://skillstore.io/skills/samber-golang-refactoring/audits/1BibTeX citation
@techreport{samber-samber-golang-refactoring-2026,
author = {samber},
title = {golang-refactoring security audit report (audit version 1)},
institution = {Skillstore},
year = {2026},
number = {1},
url = {https://skillstore.io/skills/samber-golang-refactoring/audits/1},
note = {Author version 1.1.1}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "golang-refactoring security audit report (audit version 1)"
version: "1.1.1"
type: report
authors:
- name: "samber"
date-released: "2026-10-18"
url: "https://skillstore.io/skills/samber-golang-refactoring/audits/1"
identifiers:
- type: other
value: "skillstore:samber-golang-refactoring:audit:1"
description: "Skillstore immutable audit report identifier"
Skillstore Score
Why this score Evidence Confidence: MediumWhat You Can Build
Split an Overgrown Function
Assess affected code, add missing tests, and extract a focused helper without combining the change with a feature.
Migrate a Shared Package
Plan compatibility aliases, caller migration, dependency ordering, and staged reviews for a type moved between packages.
Coordinate a Multi-Step Refactor
Build a change inventory, isolate worktrees, and schedule independent pull requests without parallelizing overlapping symbol edits.
Try These Prompts
Inspect [symbol] and propose a safe rename to [new name]. Identify references, reflection risks, and verification steps. Wait for approval before editing.
Plan extracting [responsibility] from [function]. Measure affected coverage, propose missing tests, and choose a gopls action. Present the plan before changing code.
Plan moving [type] from [old package] to [new package]. Include aliases, import-cycle checks, external caller risks, and incremental migration checkpoints.
Create an inventory for [refactoring goal]. Classify risk and structural versus behavioral changes. Order dependencies, identify parallel work, and define tests and approval gates.
Best Practices
- Approve a refactoring inventory before editing and request new approval when the scope or risk changes.
- Measure coverage on affected paths and add characterization tests before restructuring poorly tested code.
- Keep each change atomic, inspect tool-generated diffs, and verify build, tests, reflection-sensitive references, and relevant benchmarks.
Avoid
- Mixing a rename or package move with a bug fix or feature in the same pull request.
- Running a workspace-wide rename concurrently with other changes that could touch the same symbols.
- Treating passing tests or a mechanical rewrite as proof that reflection, external consumers, and security behavior remain unchanged.
Frequently Asked Questions
Which AI tools can use this skill?
What dependencies are required?
Can it refactor code without tests?
Does gopls guarantee every change is safe?
How does it handle public type moves?
Does the workflow merge changes automatically?
Developer Details
Author
samberLicense
MIT
Author version
v1.1.1
Skillstore revision
r1
Ref
cfb259a07b8f54bbd5254a63daaa42c5bab0ff20
Maintenance freshness
10/18/2026
Usage
0 downloads ยท 0 views
File structure
๐ references/
๐ catalog.md
๐ go-tooling.md
๐ safety-net.md
๐ structural.md
๐ workflow.md
๐ SKILL.md