service-defaults_skill

This skill standardizes observability, health checks, and resilience across Aspire services by providing a shared ServiceDefaults project.
  • Shell

145

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill aaronontheweb/dotnet-skills --skill service-defaults

  • SKILL.md10.2 KB

Overview

This skill creates a shared ServiceDefaults project for Aspire applications, centralizing observability, health checks, resilience, and service discovery configuration. It provides a single AddServiceDefaults() extension that every service calls to get consistent OpenTelemetry, HTTP client resilience, and health endpoints. Using one shared project enforces common behavior across APIs, workers, and hosts.

How this skill works

The skill adds extension methods that register OpenTelemetry (logging, metrics, tracing), default health checks, service discovery, and HTTP client resilience policies on application startup. Services call builder.AddServiceDefaults() during build to wire instrumentation, configure OTLP exporters when an endpoint is available, and apply retry/circuit-breaker handlers to HttpClient. It also supplies MapDefaultEndpoints() to map standardized /health and /alive endpoints after routing.

When to use it

  • Building Aspire-based distributed applications that need consistent defaults
  • You want centralized observability setup for all services (logs, traces, metrics)
  • You need shared liveness/readiness health check configuration
  • When configuring HttpClient resilience (retries, circuit breakers, timeouts)
  • To enable automatic service discovery and name resolution across services

Best practices

  • Maintain a single ServiceDefaults project referenced by every service to keep config consistent
  • Filter health-check routes from tracing to reduce noise in observability
  • Tag health checks (e.g., "live" vs "ready") to separate liveness and readiness probes
  • Protect production health endpoints (internal ports, auth, or rate limits) instead of exposing raw details
  • Register custom ActivitySources for domain or framework libraries (e.g., Akka.NET) to capture meaningful spans

Example use cases

  • API service calls builder.AddServiceDefaults() to enable tracing, metrics, and MapDefaultEndpoints() for probes
  • Worker/service host registers the same defaults so background jobs are instrumented and use service discovery
  • Add database and cache readiness checks (Postgres, Redis) to the shared project so all services expose consistent readiness status
  • Enable OTLP export automatically when OTEL_EXPORTER_OTLP_ENDPOINT is set by the environment or AppHost integration
  • Configure HttpClient to use standard resilience handlers and service-discovery resolution for outbound calls

FAQ

No. Each app calls AddServiceDefaults() during builder setup to register all defaults in one step.

How are health endpoints handled in production?

MapDefaultEndpoints can be adapted: always map probes for Kubernetes but restrict access using internal ports, authorization, or customize response writers to avoid exposing details.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
service-defaults skill by aaronontheweb/dotnet-skills | VeilStrat