Plugin Service Registry
SkillDev toolsRegister and retrieve services at runtime using a thread-safe service registry pattern for loose coupling between plugins.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Plugin Service Registry skill
What this skill tells your AI
The instructions your AI receives, as published by cliqrelay/cliqrelay in .agents/skills/backend/service-registry/SKILL.md and read by ahel’s review.
When to use this skill
- Register services created by plugins for other plugins to discover
- Retrieve services from the registry in plugin initialization
- Enable loose coupling between plugins via service lookup
- Access core services (User, Account, Session, etc.) in plugins
Key principles
- Lazy discovery: Services retrieved when needed, not all upfront
- Thread-safe: RWMutex allows concurrent reads, exclusive writes
- Type-safe: Use type assertions to convert
anyback to specific interfaces - Named services: Service IDs are constants from models/services.go
Pattern
Services are registered in plugin Init() methods using the registry interface:
// Get a core service
service, ok := ctx.ServiceRegistry.Get(models.ServiceXxx.String()).(ServiceInterface)
if !ok {
return errors.New("service not available")
}
// Register your plugin's service
ctx.ServiceRegistry.Register(models.ServicePlugin.String(), myService)
Always check the ok flag on type assertions. Store retrieved services in plugin struct for internal use.
Service initialization order
- Core repositories created (all depend on database)
- Core services created and registered
- Plugins initialize in order (retrieve core services)
- Plugin services registered as created
- Routes registered after plugins
See bootstrap.go for implementation.
Code references
- Registry interface: models/plugin.go
- Registry implementation: internal/plugins/service_registry.go
- Service IDs: models/services.go
- Example usage: plugins/email-password/plugin.go
Common mistakes
- Not checking
okflag on type assertions - Using string literals instead of
models.ServiceXxxconstants - Registering before implementation complete
- Creating circular dependencies between plugins
- Assuming services are available in wrong initialization phase
Related skills
- plugin-architecture - Plugin lifecycle
- dependency-injection - Wiring core services
- services-and-interfaces - Service patterns
Signals
- GitHub stars
- 40
- Forks
- 1
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
service-registry-cliqrelay- Source
- github.com/cliqrelay/cliqrelay