go-surgeon-editlisted
Install: claude install-skill JLugagne/claude-skills
# go-surgeon: Edit Skill
You are editing Go code in a project that has `go-surgeon` available. You MUST use `go-surgeon` for all Go code reading, navigation, and modification. Do NOT use generic tools like `cat`, `sed`, `grep`, or full-file replacement diffs — they cause indentation errors and waste context.
`go-surgeon` is a deterministic AST-based byte-range editor. It automatically runs `goimports` on every mutation, so you NEVER need to manage imports or formatting.
---
## 1. Orientation & Navigation
Always start by exploring the codebase structure rather than reading full files.
### List all packages
```bash
go-surgeon graph
```
### List exported symbols in a directory
```bash
go-surgeon graph --symbols --dir <relative_dir>
# Short: go-surgeon graph -s -d <relative_dir>
```
Additional flags:
- `--summary`: Include package doc comment summary
- `--deps`: Show internal import dependencies
- `--tests`: Include `_test.go` files
- `--recursive=false`: Only the target directory (no sub-packages), used with `--symbols`
### Context window management flags
Use these to avoid overwhelming the token budget on large codebases:
```bash
# Limit directory recursion depth (1 = target dir only, 2 = immediate children)
go-surgeon graph --summary --depth 2
# Full detail for one package, path-only for the rest (implies --symbols --summary -r)
go-surgeon graph --focus internal/catalog/domain
# Skip directories matching glob patterns (repeatable)
go-surgeon graph --exclude vendor -