harness/plugins/go-tools/claude/skills/go-modify/SKILL.md
Gopls-validated Go code changes — renames, refactoring, multi-file coordinated changes with reference tracking. Includes pre-edit analysis of file constraints, resource lifecycle checks, and static analysis. Use for any non-trivial Go file edits.
npx skillsauth add popoffvg/dotfiles go-modifyInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Modify Go code using gopls MCP tools for analysis and validation.
Use when:
Skip when:
go-understanding skill firstBefore making any changes, read the ENTIRE target file and note:
//go:build integration, //go:build !windows, etc. — your code must respect these// Code generated ... DO NOT EDIT — never edit generated files, edit the generator or template insteadfmt.Errorf wrapping, sentinel errors, custom error types? Match it.context.Context? New functions must follow the same pattern.//nolint:, //lint:ignore — understand why they exist before removing or addingIf your change creates resources, verify cleanup exists:
os.CreateTemp / os.MkdirTemp → defer os.Remove(name) / defer os.RemoveAll(dir)os.Open / os.Create → defer f.Close()sync.WaitGroup → ensure Add/Done/Wait are balancednet.Listener / net.Conn → defer listener.Close()*sql.Rows → defer rows.Close()CLAUDE.md and .claude/rules/ if they existgolangci-lint config (.golangci.yml) for enabled lintersWhen the task is to “cover all reachable methods” or similar:
go_symbol_references, callers/callees, or equivalent) to produce a concrete reachable set.needs verification instead of silently keeping it.Never pause mid-task to ask "shall I proceed?" or similar. When the intent is clear, complete all phases autonomously. Only ask if a destructive ambiguity is discovered (e.g., two symbols with identical names in different packages).
Before modifying any symbol:
mcp gopls go_symbol_references: file="/path/to/file.go" symbol="SymbolName"
Use Edit tool to modify code. Update all references found in step 3.1.
After EVERY edit:
mcp gopls go_diagnostics: files=["/path/to/edited/file.go"]
If diagnostics report errors:
After all edits are complete, before staging:
# Compilation check
go build ./...
# Vet — catches common mistakes (printf args, unreachable code, etc.)
go vet ./...
# Race detector on tests if concurrency is involved
go test -race -count=1 ./affected/package/...
Fix all errors. go vet findings are not optional — they indicate real bugs.
If the project has golangci-lint:
golangci-lint run ./affected/package/...
mcp gopls go_symbol_references — Find all symbol referencesmcp gopls go_diagnostics — Validate changesReport:
go vet / linter resultsEval checklist:
go build ./... pass after all edits were complete?Test inputs:
Can change: pre-edit checklist, gopls validation steps, error recovery instructions, file constraint analysis Cannot change: gopls requirement for multi-file changes, read-before-edit rule, build verification step Min sessions before eval: 5 Runs per experiment: 3
tools
Improve a whole CLAUDE.local.md — the private, per-project rules captured from user corrections. Wraps each conditional rule in a <task-relevant> block so it only surfaces for matching work, merges duplicates, generalizes one-off facts, drops stale entries, and routes raw project facts to engram. Use when the user says "improve claude.local", "clean up the local rules", "claude.local is bloated", or after the Stop hook has appended many rules.
testing
WM pipeline and conventions shared across all phases. Agents must read this before spec, impl, or verify work.
development
One entry point for spec writing, implementation, and bug fixing. Default is new (write spec → grill loop → produce notes → author TODO bodies). Other subcommands: verify (audit), revise (sync to shipped), prototype (settle a decision), code-map (diagram), impl (execute one TODO), fix (analyze cause, correct thoughts, fix behavior), help (this page). Invoke as /code <subcommand>.
development
Red-Green-Refactor cycle for bug fixes. Before fixing a bug, first write a failing test that reproduces it (Red), then make the minimal change to pass (Green), then clean up the code (Refactor). Use on any bug fix, error correction, failing test repair, or when user says "fix this bug".