en un clic
add-microservice
// TRIGGER when user asks to create, scaffold, or initialize a new microservice. Creates the full directory structure including service.go, intermediate.go, client.go, mock.go, manifest.yaml, and test scaffolding.
// TRIGGER when user asks to create, scaffold, or initialize a new microservice. Creates the full directory structure including service.go, intermediate.go, client.go, mock.go, manifest.yaml, and test scaffolding.
TRIGGER when user asks to add a workflow step, task endpoint, or workflow phase. Tasks are handlers that read/write shared state via workflow.Flow. Affects intermediate.go, *api/client.go, mock.go, manifest.yaml.
TRIGGER when user asks to define a workflow graph, orchestrate tasks, or create a multi-step agentic workflow. Defines task transitions and conditions. Affects intermediate.go, *api/client.go, mock.go, manifest.yaml.
Called by upgrade-microbus. Upgrades the project from v1.35.x to v1.36.0. Removes graph.DeclareInputs / graph.DeclareOutputs and workflow.FilterState (subgraph boundaries are now pass-through). Workflow authors who need narrower contracts at a subgraph boundary bracket the subgraph with Before<NodeName> / After<NodeName> adapter tasks using the new flow.Delete / flow.Clear / flow.Keep / flow.Transform primitives (see .claude/rules/workflows.txt for the convention).
Run after completing any change to a microservice. Vets compilation, updates manifest.yaml, documentation, version, and topology diagram. Skip if the skill you just followed already includes housekeeping as a final step.
Performs an architectural review of a microservice-based system built on the Microbus framework. Examines service boundaries, dependencies, coupling, API design, resilience, data ownership, observability, security, and operational concerns. Produces a structured report with findings and recommendations.
Performs a thorough review of a single Microbus microservice. Checks for completeness, framework compliance, code quality, security, test coverage, documentation, API design, and data access performance. Produces a structured report with findings and recommendations.
| name | add-microservice |
| description | TRIGGER when user asks to create, scaffold, or initialize a new microservice. Creates the full directory structure including service.go, intermediate.go, client.go, mock.go, manifest.yaml, and test scaffolding. |
CRITICAL: Do NOT explore or analyze other microservices unless explicitly instructed to do so. The instructions in this skill are self-contained to this microservice.
Copy this checklist and track your progress:
Creating a new microservice:
- [ ] Step 1: Determine the name and description
- [ ] Step 2: Create a directory structure
- [ ] Step 3: Prepare coding agent files
- [ ] Step 4: Prepare endpoints.go
- [ ] Step 5: Prepare client.go
- [ ] Step 6: Prepare embed.go
- [ ] Step 7: Prepare service.go
- [ ] Step 8: Prepare intermediate.go
- [ ] Step 9: Generate mock.go
- [ ] Step 10: Prepare service_test.go
- [ ] Step 11: Prepare manifest.yaml
- [ ] Step 12: Add to main app
- [ ] Step 13: Propose features
Determine the name of the microservice. Use only letters a through z and A through Z.
The templates in this skill use myservice, myserviceapi, MyService and TestMyService as placeholders that are based on the name of the microservice.
Determine a Go-style description for the microserice in the form MyService is X.
Each microservice must be placed in a separate directory. Create a new directory for the new microservice. Use the name of the microservice in lowercase as the name of the new directory name.
In smaller projects, place the new directory under the root directory of the project. In larger projects, consider using a nested directory structure to group similar microservices together.
mkdir -p myservice
Create two subdirectories.
apiresourcesmkdir -p myservice/myserviceapi
mkdir -p myservice/resources
The directory structure should look like this.
myproject/
└── myservice/
├── myserviceapi/
└── resources/
IMPORTANT: File names in the following steps are relative to the new myservice directory, unless indicated otherwise.
File preparation steps can be performed in parallel.
Create CLAUDE.md with the hostname as an H1 heading:
# my.service.hostname
Create PROMPTS.md with the prompt used to create this microservice. Rephrase the language to include context that was not made explicit in the original prompt. The intent is to maintain an auditable trail of the prompts, and to allow a future agent to reproduce the functionality of the microservice from these prompts.
Save the prompt as follows.
## Prompt title
Prompt comes here...
endpoints.goCreate myserviceapi/endpoints.go with the content of the template endpoints.go located in the directory of this skill.
Hostname constant holds the hostname in which this microservice will be addressable. It must be unique across the application. Use reverse domain notation based on the module path, up to and including the name of the project. For example, if the module path is github.com/mycompany/myproject/some/path/myservice, set the hostname to myservice.path.some.myproject. Only letters a-z, numbers 0-9, hyphens - and the dot . separator are allowed in the hostnameDef struct holds the routing identity (Method and Route) of each endpoint. Add-feature skills append Foo = Def{Method: ..., Route: ...} lines to the var (...) block. The endpoint name, description, and input/output schemas live with the svc.Subscribe(...) call in intermediate.go, not in this fileclient.goCreate myserviceapi/client.go with the content of the template client.go located in the directory of this skill. No edits required - this file holds the type-safe client/multicast/trigger/hook/executor proxies and shared marshaling helpers.
embed.goCreate resources/embed.go with the following content verbatim.
package resources
import "embed"
//go:embed *
var FS embed.FS
service.goCreate service.go with the content of the template service.go located in the directory of this skill.
Service to describe this particular microservice. The provided value is a template. Do not copy it verbatimintermediate.goCreate intermediate.go with the content of the template intermediate.go located in the directory of this skill.
svc.SetDescriptionmock.goRun go run github.com/microbus-io/fabric/cmd/genmock --path . from the microservice's directory.
service_test.goCreate service_test.go with the content of the template service_test.go located in the directory of this skill.
manifest.yamlLook in go.mod and identify the current version of the github.com/microbus-io/fabric dependency. This is the framework version. Set it in manifest.yaml next. When working inside the fabric repository itself, there is no such dependency. Use instead the latest version you can find in any other manifest.yaml in the project.
Create manifest.yaml with the following content.
general:
hostname: myservice.myproject.mycompany
description: MyService does X.
package: github.com/mycompany/myproject/myservice
frameworkVersion: 1.23.0
Find main/main.go relative to the project root. Add the new microservice to the app in the main function. Add the appropriate import statement at the top of the file.
import (
// ...
"github.com/mycompany/myproject/myservice"
)
func main() {
// ...
app.Add(
// HINT: Add solution microservices here
myservice.NewService(),
)
// ...
}
Ask the user if they'd like you to propose a design for the microservice. If the user declines, skip the remainder of this step.
Use the context provided by the user and propose a set of features for this microservice for each of the following categories. You may engage the user and ask for additional information if required.
http.ResponseWriter/http.Request handlers for serving HTML, files, or custom HTTP responsesAppend the proposed design to CLAUDE.md under the following heading, then show it to the user. Ask the user if they'd like you to implement any of the features. Do not implement without explicit approval from the user.
## Agent Design Proposal
*This section is the original pre-development proposal. It reflects the intended design at the time of creation and may not match the current implementation.*