golang-goplslisted
Install: claude install-skill reagin/agent-skills
# Working with gopls
Use gopls for semantic Go information that text search cannot reliably provide. Treat its command line and settings as versioned interfaces: inspect the installed version and built-in help before relying on a particular command or option.
## Diagnose workspace context first
Read go.mod, go.work, build tags, generated-code instructions, editor settings, and the relevant package layout. Then determine:
- which directory is the intended workspace root;
- whether the file belongs to a loaded module;
- the active Go toolchain, GOOS, GOARCH, and build tags;
- whether generated files or missing private modules prevent loading;
- whether the host already exposes gopls-backed definition, reference, diagnostic, or rename operations.
Many apparent language-server failures are module-loading failures. Reproduce with the repository's ordinary Go commands before changing gopls configuration.
## Choose the narrowest semantic operation
Use the semantic surface already exposed by the host. If more than one is available, choose by input and result shape:
- host LSP operations fit questions that already have a file position;
- gopls MCP operations, when exposed, fit name-, package-, or file-oriented queries;
- the gopls CLI is useful for one-shot checks and scripted fallbacks.
Read [references/capability-matrix.md](references/capability-matrix.md) for concrete mappings. Inspect `gopls version`, `gopls help`, and the host's actual tool list before relying on a comma