Implements ASP.NET Core health checks with readiness/liveness probes and Kubernetes integration. Covers dependency inventory, custom IHealthCheck classes, NuGet packages, and endpoint configuration.
Ships in claude-skills-collection. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
IHealthCheck par dépendance ; package NuGet dédié quand il existe./health/live minimal, /health/ready filtré par tags, /health/full protégé.dotnet add package AspNetCore.HealthChecks.SqlServer
dotnet add package AspNetCore.HealthChecks.Redis
dotnet add package AspNetCore.HealthChecks.RabbitMQ
dotnet add package AspNetCore.HealthChecks.Uris
dotnet add package AspNetCore.HealthChecks.Npgsql # PostgreSQL
dotnet add package AspNetCore.HealthChecks.Kafka
dotnet add package AspNetCore.HealthChecks.UI.Client # UI dashboard optionnel
builder.Services.AddHealthChecks()
// SQL Server — tag "ready" = inclus dans readiness probe
.AddSqlServer(
builder.Configuration.GetConnectionString("Default")!,
name: "sqlserver",
tags: ["db", "ready"],
timeout: TimeSpan.FromSeconds(5))
// Redis
.AddRedis(
builder.Configuration["Redis:ConnectionString"]!,
name: "redis",
tags: ["cache", "ready"],
timeout: TimeSpan.FromSeconds(3))
// RabbitMQ
.AddRabbitMQ(
builder.Configuration["RabbitMQ:Uri"]!,
name: "rabbitmq",
tags: ["messaging", "ready"],
timeout: TimeSpan.FromSeconds(5))
// URL externe — NON incluse dans liveness ni readiness
.AddUrlGroup(
new Uri("https://api.partner.com/ping"),
name: "partner-api",
tags: ["external"],
timeout: TimeSpan.FromSeconds(8))
// Check custom
.AddCheck<DiskSpaceHealthCheck>("disk-space",
tags: ["infra"],
timeout: TimeSpan.FromSeconds(2));
// --- Endpoints ---
// Liveness : aucun check, répond 200 si le process tourne
app.MapHealthChecks("/health/live", new HealthCheckOptions
{
Predicate = _ => false,
ResponseWriter = WriteMinimalResponse
});
// Readiness : seules les dépendances critiques (tag "ready")
app.MapHealthChecks("/health/ready", new HealthCheckOptions
{
Predicate = hc => hc.Tags.Contains("ready"),
ResponseWriter = WriteDetailedResponse
});
// Full : tous les checks, endpoint protégé
app.MapHealthChecks("/health/full", new HealthCheckOptions
{
ResponseWriter = WriteDetailedResponse
}).RequireAuthorization("internal");
public class DiskSpaceHealthCheck(ILogger<DiskSpaceHealthCheck> logger) : IHealthCheck
{
private const long MinFreeBytes = 1_073_741_824; // 1 GB
public Task<HealthCheckResult> CheckHealthAsync(
HealthCheckContext context, CancellationToken ct = default)
{
var drive = new DriveInfo(OperatingSystem.IsWindows() ? "C:\\" : "/");
var free = drive.AvailableFreeSpace;
var data = new Dictionary<string, object>
{
["free_gb"] = Math.Round((double)free / 1_073_741_824, 2),
["drive"] = drive.Name
};
if (free < MinFreeBytes)
{
logger.LogWarning("Disk space low: {FreeGb} GB", data["free_gb"]);
return Task.FromResult(HealthCheckResult.Degraded(
$"Espace disque faible : {data["free_gb"]} GB", data: data));
}
return Task.FromResult(HealthCheckResult.Healthy(null, data));
}
}
static async Task WriteDetailedResponse(HttpContext ctx, HealthReport report)
{
ctx.Response.ContentType = MediaTypeNames.Application.Json;
ctx.Response.StatusCode = report.Status == HealthStatus.Unhealthy ? 503 : 200;
var payload = new
{
status = report.Status.ToString(),
duration = report.TotalDuration.TotalMilliseconds,
checks = report.Entries.Select(e => new
{
name = e.Key,
status = e.Value.Status.ToString(),
duration_ms = e.Value.Duration.TotalMilliseconds,
description = e.Value.Description,
data = e.Value.Data,
error = e.Value.Exception?.Message
})
};
await ctx.Response.WriteAsJsonAsync(payload);
}
static Task WriteMinimalResponse(HttpContext ctx, HealthReport report)
{
ctx.Response.ContentType = MediaTypeNames.Text.Plain;
ctx.Response.StatusCode = report.Status == HealthStatus.Unhealthy ? 503 : 200;
return ctx.Response.WriteAsync(report.Status.ToString());
}
| Probe | Question | Conséquence échec | Endpoint conseillé |
|---|---|---|---|
| startupProbe | L'app a-t-elle fini de démarrer ? | liveness/readiness suspendues | /health/live |
| livenessProbe | Le process est-il fonctionnel ? | Pod redémarré | /health/live |
| readinessProbe | Peut-on envoyer du trafic ? | Pod retiré du LB | /health/ready |
spec:
containers:
- name: payment-api
image: myregistry/payment-api:1.0.0
ports:
- containerPort: 8080
startupProbe:
httpGet:
path: /health/live
port: 8080
initialDelaySeconds: 0
periodSeconds: 3
failureThreshold: 30 # 90 s max pour démarrer
livenessProbe:
httpGet:
path: /health/live
port: 8080
initialDelaySeconds: 0
periodSeconds: 10
failureThreshold: 3
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /health/ready
port: 8080
initialDelaySeconds: 0
periodSeconds: 5
failureThreshold: 3
timeoutSeconds: 5
Degraded pour les seuils d'avertissement ; K8s traite Degraded comme Healthy (HTTP 200).// Exposer les métriques health check pour Prometheus
builder.Services.AddHealthChecks()
// ... checks ...
.ForwardToPrometheus();
app.UseHealthChecksPrometheusExporter("/metrics/health",
options => options.ResultStatusCodes[HealthStatus.Unhealthy] = 503);
Alerte Grafana alerting rule :
# Alerte si un check est Unhealthy depuis > 1 min
health_check_status{status="Unhealthy"} == 1
timeout < timeoutSeconds probe.SELECT 1 ou SELECT TOP 1 1 FROM sysobjects pour SQL Server./health/full exposé publiquement → fuite d'informations sur la topologie interne ; toujours RequireAuthorization.CheckHealthAsync avec vrai await ; ne jamais .Result ou .Wait().IHealthCheck (voir exemple DiskSpace).HealthCheckPublisherHostedService pour publier les résultats en push vers un système de monitoring externe.WebApplicationFactory : forcer Unhealthy via stub et vérifier le HTTP 503.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
.NET, Kubernetes, SQL Server, Redis, RabbitMQ, PostgreSQL, Kafka, Prometheus
/claude-skills-collection:dev-health-check-monitorfrom claude-skills-collection
npx claudepluginhub vantaflow/claude-skills-collection --plugin claude-skills-collection348 skills in this plugin
/agent-a2a-protocol-guideGuide du protocole Agent-to-Agent (A2A) de Google pour l'interopérabilité entre agents IA — découverte, communication et collaboration inter-agents, avec exemples de code, critères de décision et pièges à éviter. Se déclenche avec "A2A", "agent-to-agent", "protocole A2A", "Google A2A", "interopérabilité agents". Also triggers on "agent-to-agent protocol", "agent interoperability", "connect two agents"./agent-agent-observabilityInstrumentation technique d'un agent IA — tracing distribué des appels LLM et outils, spans, métriques custom, corrélation de logs et dashboards de supervision. Pour les alertes et garde-fous de production, voir agent-monitoring-setup. Se déclenche avec "observabilité agent", "tracing agent", "LangSmith", "Langfuse", "OpenTelemetry agent", "spans LLM", "corréler les logs agent". Also triggers on "trace my agent", "LLM tracing", "agent spans"./agent-api-caller-subagentSous-agent spécialisé dans les appels API REST/GraphQL avec retry, auth et transformation de données. Se déclenche avec "sous-agent API", "API caller agent", "agent qui appelle une API", "REST agent", "HTTP agent", "API integration subagent", "external API agent". Also triggers on "subagent that calls an API", "API calling agent", "agent HTTP requests".Other plugins' skills for the same job