Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
itallstartedwithaidea avatar

Service Discovery

  • 53 installs
  • 31 repo stars
  • Updated April 12, 2026
  • itallstartedwithaidea/agent-skills

Design and implement registry-based service discovery, health checks, and client-side load balancing for microservices without hardcoded URLs.

About

service-discovery is an Agent Skills entry from itallstartedwithaidea that explains how cloud-native apps replace brittle hardcoded service URLs with a living registry. Solo builders running multiple APIs, workers, or edge nodes learn self-registration on startup, continuous health verification, and consumer-side instance selection—the same conceptual stack popularized by Nacos-style systems. The skill is architectural and procedural rather than a single-vendor install script: it helps you and your coding agent reason about registration payloads, liveness signals, and discovery clients before you commit to Consul, Eureka, Nacos, or a managed mesh. Use it when topology changes often—autoscaling, multi-region, or frequent redeploys—and you need failover and routing to follow reality. It complements Build backend service design and Operate monitoring because registry health is both an integration contract and a production signal. Intermediate builders comfortable with HTTP services and containers get the most value; it is not a substitute for reading your chosen registry’s official SDK docs end to end.

  • Self-registration, health checking, and client-side discovery as three complementary patterns
  • Nacos-inspired dynamic registry as single source of truth for topology
  • Supports ephemeral instances, scaling, regional deploys, and failover without static URLs
  • Frames zero-downtime deploys and region-aware routing as outcomes of live registry state

Service Discovery by the numbers

  • 53 all-time installs (skills.sh)
  • +3 installs in the week ending Aug 2, 2026 (Skillselion tracking)
  • Ranked #708 of 1,039 Cloud & Infrastructure skills by installs in the Skillselion catalog
  • Security screen: CRITICAL risk (skills.sh audit)
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/itallstartedwithaidea/agent-skills --skill service-discovery

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs53
repo stars31
Security audit2 / 3 scanners passed
Last updatedApril 12, 2026
Repositoryitallstartedwithaidea/agent-skills

What it does

Design and implement registry-based service discovery, health checks, and client-side load balancing for microservices without hardcoded URLs.

Files

SKILL.mdMarkdownGitHub ↗

Service Discovery

Part of Agent Skills™ by googleadsagent.ai™

Description

Service Discovery implements dynamic service registry, health check monitoring, and intelligent load balancing patterns inspired by Nacos for cloud-native applications. Services register themselves on startup, announce their capabilities and health status, and are discovered by consumers without hardcoded addresses. The registry becomes the single source of truth for the service topology.

In microservice and edge-distributed architectures, services are ephemeral. Instances scale up and down, deploy across regions, and fail independently. Hardcoded service URLs create brittle coupling that breaks under any topology change. Service discovery replaces static configuration with a living registry that reflects the actual state of the system at any moment.

This skill covers three complementary patterns: self-registration (services announce themselves), health checking (the registry verifies liveness), and client-side discovery (consumers query the registry and select instances). Together, these patterns enable zero-downtime deployments, automatic failover, and region-aware routing without manual configuration changes.

Use When

  • Building microservice architectures with dynamic scaling
  • Implementing health-check-driven load balancing
  • Replacing hardcoded service URLs with dynamic discovery
  • Supporting blue-green or canary deployments
  • Building multi-region applications with region-aware routing
  • Integrating multiple Workers or services that need to find each other

How It Works

sequenceDiagram
    participant S as Service Instance
    participant R as Service Registry
    participant C as Consumer
    participant H as Health Checker

    S->>R: Register(name, address, metadata)
    R->>R: Store in registry
    loop Every 10s
        H->>S: Health check (HTTP/TCP)
        S->>H: 200 OK / Healthy
        H->>R: Update health status
    end
    C->>R: Discover("payment-service")
    R->>C: [instance-1:8080, instance-2:8080]
    C->>C: Select instance (round-robin/weighted)
    C->>S: Send request to selected instance

Services register on startup and deregister on shutdown. The health checker continuously verifies liveness. Consumers query the registry and apply a load-balancing strategy to select an instance.

Implementation

interface ServiceInstance {
  id: string;
  name: string;
  address: string;
  port: number;
  metadata: Record<string, string>;
  health: "healthy" | "degraded" | "unhealthy";
  lastHeartbeat: number;
}

class ServiceRegistry {
  private instances = new Map<string, ServiceInstance[]>();

  register(instance: ServiceInstance): void {
    const existing = this.instances.get(instance.name) ?? [];
    existing.push({ ...instance, lastHeartbeat: Date.now() });
    this.instances.set(instance.name, existing);
  }

  deregister(serviceName: string, instanceId: string): void {
    const existing = this.instances.get(serviceName) ?? [];
    this.instances.set(
      serviceName,
      existing.filter(i => i.id !== instanceId)
    );
  }

  discover(serviceName: string): ServiceInstance[] {
    const instances = this.instances.get(serviceName) ?? [];
    return instances.filter(i => i.health === "healthy");
  }

  heartbeat(serviceName: string, instanceId: string): void {
    const instances = this.instances.get(serviceName) ?? [];
    const instance = instances.find(i => i.id === instanceId);
    if (instance) instance.lastHeartbeat = Date.now();
  }

  pruneStale(maxAgeMs: number = 30_000): void {
    const cutoff = Date.now() - maxAgeMs;
    for (const [name, instances] of this.instances) {
      this.instances.set(
        name,
        instances.filter(i => i.lastHeartbeat > cutoff)
      );
    }
  }
}

function loadBalance(instances: ServiceInstance[]): ServiceInstance {
  const weights = instances.map(i =>
    i.health === "healthy" ? 100 : i.health === "degraded" ? 25 : 0
  );
  const totalWeight = weights.reduce((sum, w) => sum + w, 0);
  let random = Math.random() * totalWeight;
  for (let i = 0; i < instances.length; i++) {
    random -= weights[i];
    if (random <= 0) return instances[i];
  }
  return instances[0];
}

Best Practices

  • Implement graceful deregistration on service shutdown signals (SIGTERM)
  • Use heartbeat TTL (30s default) to automatically prune unresponsive instances
  • Include metadata in registrations (version, region, capabilities) for smart routing
  • Implement circuit breakers on the consumer side to handle discovery failures
  • Cache discovery results locally with short TTL to reduce registry load
  • Monitor registry size and health check latency as infrastructure metrics

Platform Compatibility

PlatformSupportNotes
CursorFullConfig + code generation
VS CodeFullMicroservice tooling
WindsurfFullCloud-native support
Claude CodeFullArchitecture guidance
ClineFullService scaffolding
aiderPartialCode-level support only

Related Skills

  • Cloudflare Workers
  • Configuration Management
  • Observability
  • Sandbox Hardening

Keywords

service-discovery nacos health-check load-balancing microservices registry cloud-native dynamic-routing

---

© 2026 googleadsagent.ai™ | Agent Skills™ | MIT License

Related skills

FAQ

Is Service Discovery safe to install?

skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.