--- name: remove-feature description: TRIGGER when user asks to remove, delete, or drop an endpoint, config, metric, ticker, or event from a microservice. --- **CRITICAL**: Read and analyze this microservice before starting. Do NOT explore or analyze other microservices. The instructions in this skill are self-contained to this microservice. **CRITICAL**: A feature lives by hand in `myserviceapi/definition.go` (its `define.*` var and In/Out structs), `service.go` (its handler), and `service_test.go` (its test). Remove it from those, then run `cmd/genservice`. ## Workflow Copy this checklist and track your progress: ``` Removing a feature of a microservice: - [ ] Step 1: Remove the declaration from definition.go - [ ] Step 2: Remove the handler from service.go - [ ] Step 3: Remove the test from service_test.go - [ ] Step 4: Remove unused custom types - [ ] Step 5: Generate the boilerplate - [ ] Step 6: Housekeeping ``` Search for `MARKER: FeatureName` within the microservice's directory to locate the feature's hand-written code. The markers in the generated files can be ignored - those files are regenerated in Step 5. #### Step 1: Remove the Declaration from `definition.go` Delete the feature's `define.*` var (the whole `var FeatureName = define.X{ ... }` block) and its In/Out struct types from `myserviceapi/definition.go`. These all carry `// MARKER: FeatureName`. #### Step 2: Remove the Handler from `service.go` Delete the feature's handler in `service.go` (carrying `// MARKER: FeatureName`): - A function, web, task, inbound event, or ticker has a handler method. - A workflow has a graph builder method. - A callback config has an `OnChangedFeatureName` method; an observable metric has an `OnObserveFeatureName` method. - An outbound event, a non-callback config, and a non-observable metric have no handler in `service.go`; also remove any call sites that trigger the event or record the metric. #### Step 3: Remove the Test from `service_test.go` Delete the feature's test function (e.g. `TestMyService_FeatureName`) from `service_test.go`. #### Step 4: Remove Unused Custom Types If the removed feature used non-primitive custom types defined in the `myserviceapi` directory, and those types are no longer used elsewhere by the microservice, remove their definitions. #### Step 5: Generate the Boilerplate From the microservice's directory, run the generator. It regenerates `client.go`, `intermediate.go`, `mock.go`, `mock_test.go`, and `manifest.yaml` without the removed feature. ```shell go run github.com/microbus-io/fabric/cmd/genservice . ``` Then verify the microservice compiles with `go vet ./...` from the project root. #### Step 6: Housekeeping Follow the `housekeeping` skill.