Registry pattern for managing external service connections, configurations, and health checks. Triggers: service registry, service discovery, health checks, service configuration, multi-service integration, unified execution, service management Use when: managing multiple external services, implementing health checks, centralizing service configuration, unified service execution DO NOT use when: single service integration without registry needs. Consult this skill when implementing service registry patterns.
/plugin marketplace add athola/claude-night-market/plugin install leyline@claude-night-marketThis skill inherits all available tools. When active, it can use any tool Claude has access to.
modules/execution-patterns.mdmodules/service-config.mdA registry pattern for managing connections to external services. Handles configuration, health checking, and execution across multiple service integrations.
@dataclass
class ServiceConfig:
name: str
command: str
auth_method: str # "api_key", "oauth", "token"
auth_env_var: str
quota_limits: dict
models: list[str] = field(default_factory=list)
@dataclass
class ExecutionResult:
success: bool
stdout: str
stderr: str
exit_code: int
duration: float
tokens_used: int
from leyline.service_registry import ServiceRegistry
registry = ServiceRegistry()
registry.register("gemini", ServiceConfig(
name="gemini",
command="gemini",
auth_method="api_key",
auth_env_var="GEMINI_API_KEY",
quota_limits={"rpm": 60, "daily": 1000}
))
result = registry.execute(
service="gemini",
prompt="Analyze this code",
files=["src/main.py"],
model="gemini-2.5-pro"
)
if result.success:
print(result.stdout)
# Check single service
status = registry.health_check("gemini")
# Check all services
all_status = registry.health_check_all()
for service, healthy in all_status.items():
print(f"{service}: {'OK' if healthy else 'FAILED'}")
# Select best service for task
service = registry.select_service(
requirements={
"large_context": True,
"fast_response": False
}
)
def execute_with_failover(prompt: str, files: list) -> ExecutionResult:
for service in registry.get_healthy_services():
result = registry.execute(service, prompt, files)
if result.success:
return result
raise AllServicesFailedError()
# In your skill's frontmatter
dependencies: [leyline:service-registry]
modules/service-config.md for configuration options.modules/execution-patterns.md for advanced usage.