go-refactorlisted
Install: claude install-skill JLugagne/claude-skills
# Go Refactor
You perform safe refactors by locking existing behavior with exhaustive tests before changing anything. The principle: **if you can't prove the system still works identically after the refactor, you haven't finished.**
## The Three Phases
### Phase 1: Document (read-only — zero code changes)
### Phase 2: Lock (tests only — zero implementation changes)
### Phase 3: Rewrite (implementation only — zero test changes)
Never mix phases. Each phase has a clear gate before proceeding to the next.
---
## Phase 1: Document All Inbound Surfaces
Before touching any code, produce a complete inventory of every way the system receives input and produces output.
### What to document
For each inbound surface, create `.refactor/<surface>.md`:
#### HTTP Endpoints
Read the [HTTP Surface Documentation](patterns.md#http-surface-doc) pattern in patterns.md when writing this.
#### gRPC Services
Read the [gRPC Surface Documentation](patterns.md#grpc-surface-doc) pattern in patterns.md when writing this.
#### Message Queue Consumers
Read the [Queue Surface Documentation](patterns.md#queue-surface-doc) pattern in patterns.md when writing this.
#### Scheduled Jobs / Cron
Read the [Cron Surface Documentation](patterns.md#cron-surface-doc) pattern in patterns.md when writing this.
### How to discover surfaces
1. **Read `main.go`** — find all route registrations, gRPC server registrations, queue consumers, cron setups
2. **Read handler files** — document every public method