| name | rename-sql-object |
| description | TRIGGER when user asks to rename the object type or struct used by a SQL CRUD microservice. |
CRITICAL: Read and analyze this microservice before starting. Do NOT explore or analyze other microservices unless explicitly instructed to do so. The instructions in this skill are self-contained to this microservice.
IMPORTANT: MyNoun, MyNounKey, mynoun, and mynounapi are placeholders for the actual object, its key, directory, and API package of the microservice.
Workflow
Copy this checklist and track your progress:
Renaming the object:
- [ ] Step 1: Read Local CLAUDE.md File
- [ ] Step 2: Update Type Definitions
- [ ] Step 3: Update References
- [ ] Step 4: Alias the Old Type Definitions
- [ ] Step 5: Housekeeping
Step 1: Read Local CLAUDE.md File
Read the local CLAUDE.md file in the microservice's directory. It contains microservice-specific instructions that should take precedence over global instructions.
Step 2: Update Type Definitions
Find the struct definition of MyNounKey in mynounapi/objectkey.go and rename it to the new name MyNewNounKey.
Find the struct definition of MyNoun in mynounapi/object.go and rename it to the new name MyNewNoun.
Step 3: Update References
Update only the hand-written files; the generated files (mynounapi/client.go, intermediate.go, mock.go, mock_test.go, manifest.yaml) are regenerated from definition.go in Step 5.
Search the hand-written files in mynounapi/ (definition.go and the sibling type files) for references to MyNounKey and MyNoun, and update to MyNewNounKey and MyNewNoun. In definition.go this covers the In/Out struct fields that carry the object/key types (e.g. Obj *MyNoun, ObjKey MyNounKey).
Search the microservice's other hand-written files (service.go, service_test.go) for mynounapi.MyNounKey and mynounapi.MyNoun, and update them.
Search other microservices that consume this type for mynounapi.MyNounKey and mynounapi.MyNoun and update their hand-written definition.go/service.go; their generated files are regenerated by their own housekeeping. The aliases added in Step 4 keep everything compiling in the meantime.
Step 4: Alias the Old Type Definitions
This step intentionally reintroduces the old type names as deprecated aliases for backwards compatibility.
Add a type alias of the old object key to the new object key in mynounapi/objectkey.go
type MyNounKey = MyNewNounKey
Add a type alias of the old object to the new object in mynounapi/object.go
type MyNoun = MyNewNoun
Step 5: Housekeeping
Follow the housekeeping skill. The renamed object type is referenced by definition.go, so the boilerplate regeneration (genservice) re-emits client.go/intermediate.go/mock.go/mock_test.go/manifest.yaml with the new name.