Skip to content
cccskills
FreePublished on GitHub

service-registry

Register and retrieve services at runtime using a thread-safe service registry pattern for loose coupling between plugins.

The English summary is being prepared. Showing the original description.

Authula/authula273 stars(GitHub 273 + cccskills 0)

Run score Not tested

See how to install

Files included (1)

  • SKILL.md2.5 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Plugin Service Registry

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

  1. Lazy discovery: Services retrieved when needed, not all upfront
  2. Thread-safe: RWMutex allows concurrent reads, exclusive writes
  3. Type-safe: Use type assertions to convert any back to specific interfaces
  4. 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

  1. Core repositories created (all depend on database)
  2. Core services created and registered
  3. Plugins initialize in order (retrieve core services)
  4. Plugin services registered as created
  5. Routes registered after plugins

See bootstrap.go for implementation.

Code references

Common mistakes

  1. Not checking ok flag on type assertions
  2. Using string literals instead of models.ServiceXxx constants
  3. Registering before implementation complete
  4. Creating circular dependencies between plugins
  5. Assuming services are available in wrong initialization phase

Related skills

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Wire dependencies using constructor-based dependency injection throughout services, repositories, and handlers.

The English summary is being prepared. Showing the original description.

Authula/authula273Updated Oct 24, 2026

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.

The English summary is being prepared. Showing the original description.

Authula/authula273Updated Oct 24, 2026

A relentless interview to sharpen a plan or design.

The English summary is being prepared. Showing the original description.

Authula/authula273Updated Oct 24, 2026

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.

The English summary is being prepared. Showing the original description.

Authula/authula273Updated Oct 24, 2026

Implement HTTP handlers that parse requests, invoke use cases, and format responses following REST conventions.

The English summary is being prepared. Showing the original description.

Authula/authula273Updated Oct 24, 2026

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

The English summary is being prepared. Showing the original description.

Authula/authula273Updated Oct 24, 2026

See all skills by Authula

Report a problem with this skill