AGENT SKILL

plugin-architecture

Build pluggable authentication features using the plugin system with initialization, migrations, routes, and service registration.

License 许可
Apache-2.0
最近更新
2026-11-04
Stars
★ 41
Forks
0

01 前言 Front Matter

name
plugin-architecture
description
Build pluggable authentication features using the plugin system with initialization, migrations, routes, and service registration.

03 SKILL.md 正文

Plugin Architecture & Lifecycle

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

  1. Interface-driven: Plugins implement optional interfaces
  2. Composition: Dependencies via context, not inheritance
  3. Self-contained: Each plugin has its own services, repositories, handlers
  4. Lazy initialization: Heavy operations in Init(), not constructors
  5. Event-driven: Plugins hook into core events
  6. 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

  1. Initializing in constructor instead of Init()
  2. Not retrieving services from registry (use Get with type assertion)
  3. Forgetting type assertions on service retrieval
  4. Registering services with wrong names
  5. Not implementing Close()
  6. Direct plugin-to-plugin dependencies instead of service registry
  7. Not handling initialization errors

References

04 同仓库更多 Skills

CliqRelay
CliqRelay/cliqrelay

typst

Typst document creation and package development. Use when: (1) Working with .typ files, (2) User mentions typst, typst.toml, or typst-cli, (3) Creating or using Typst packages, (4) Developing document templates, (5) Converting Markdown/LaTeX to Typst

★ 41
CliqRelay
CliqRelay/cliqrelay

shadcn

Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI. Provides project context, component docs, and usage examples. Applies when working with shadcn/ui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for "shadcn init", "create an app with --preset", or "switch to --preset".

★ 41
CliqRelay
CliqRelay/cliqrelay

handoff

Compact the current conversation into a handoff document for another agent to pick up.

★ 41
CliqRelay
CliqRelay/cliqrelay

grilling

Grill the user relentlessly about a plan, decision, or idea. Use when the user wants to stress-test their thinking, or uses any 'grill' trigger phrases.

★ 41
CliqRelay
CliqRelay/cliqrelay

grill-me

A relentless interview to sharpen a plan or design.

★ 41
CliqRelay
CliqRelay/cliqrelay

dont-waffle

Use this skill when answering questions, explaining concepts, writing technical responses, reviewing code, or helping with development tasks. Communicate in clear, simple, standard English. Keep answers concise and focused, remove unnecessary filler and repetition, explain technical ideas in plain language, and structure information so it is easy to read and understand. When showing code, present it clearly with enough context for the developer to understand what it does and where it belongs.

★ 41