Plugin Architecture & Lifecycle
SkillSecurityBuild pluggable authentication features using the plugin system with initialization, migrations, routes, and service registration.
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 Architecture & Lifecycle skill
What this skill tells your AI
The instructions your AI receives, as published by cliqrelay/cliqrelay in .agents/skills/backend/plugin-architecture/SKILL.md and read by ahel’s review.
When to use this skill
- Create new authentication plugins (OAuth2, Magic Link, JWT, etc.)
- Extend authentication with custom features
- Define plugin configuration and metadata
- Handle plugin initialization, migrations, and lifecycle
- Provide HTTP routes through a plugin
- Hook into core authentication events
Key principles
- Interface-driven: Plugins implement optional interfaces
- Composition: Dependencies via context, not inheritance
- Self-contained: Each plugin has its own services, repositories, handlers
- Lazy initialization: Heavy operations in Init(), not constructors
- Event-driven: Plugins hook into core events
- Service registry: Plugins register services for other plugins
Pattern
Plugin lifecycle:
- Define metadata (ID, name, version)
- Implement Init to retrieve services, create repositories/services
- Implement optional Routes, Migrations, Middleware
- Register custom services with registry
- Implement Close for cleanup
Example
See plugins/email-password/plugin.go for:
- EmailPasswordPlugin metadata and Init pattern
- Service retrieval and registration
- Routes definition and handler wiring
- Lifecycle management (Close)
Common mistakes
- Initializing in constructor instead of Init()
- Not retrieving services from registry (use Get with type assertion)
- Forgetting type assertions on service retrieval
- Registering services with wrong names
- Not implementing Close()
- Direct plugin-to-plugin dependencies instead of service registry
- Not handling initialization errors
References
- plugins/email-password/plugin.go - Email-password plugin
- plugins/jwt/plugin.go - JWT plugin
- internal/bootstrap/plugin_factory.go - Plugin factory
Signals
- GitHub stars
- 40
- Forks
- 1
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
plugin-architecture- Source
- github.com/cliqrelay/cliqrelay