Skip to content

Add implementing-health-checks skill#88

Closed
mrsharm wants to merge 1 commit intodotnet:mainfrom
mrsharm:musharm/implementing-health-checks-skill
Closed

Add implementing-health-checks skill#88
mrsharm wants to merge 1 commit intodotnet:mainfrom
mrsharm:musharm/implementing-health-checks-skill

Conversation

@mrsharm
Copy link
Copy Markdown
Member

@mrsharm mrsharm commented Feb 23, 2026

Summary

Adds the implementing-health-checks skill that teaches ASP.NET Core health check configuration for Kubernetes deployments.

Eval Results

Skill Test Baseline With Skill Δ Verdict
implementing-health-checks Add health checks with Kubernetes probes 4.0/5 4.3/5 +0.3
implementing-health-checks Health check skill should not activate for monitoring setup 2.7/5 3.7/5 +1.0

Overall improvement: +17.2% (3 runs)
Model: claude-opus-4.6 | Judge: claude-opus-4.6

What the Skill Teaches

  • Liveness vs readiness vs startup probe differences and when to use each
  • Custom health checks for dependencies (SQL Server, Redis, external APIs)
  • IHealthCheck implementation with degraded status patterns
  • Kubernetes YAML probe configuration (initialDelaySeconds, periodSeconds, failureThreshold)
  • Health check UI and detailed JSON output configuration

Why This Skill Passes

The model confuses liveness and readiness probe semantics (putting dependency checks on liveness causes unnecessary pod restarts). This skill teaches the correct probe-to-check mapping and the specific K8s YAML configuration.

Files

  • src/dotnet/skills/implementing-health-checks/SKILL.md
  • src/dotnet/tests/implementing-health-checks/eval.yaml

Teaches ASP.NET Core health check configuration for Kubernetes:
liveness vs readiness vs startup probes, custom health checks for
dependencies (SQL, Redis, external APIs), and K8s YAML configuration.

Eval results: +33.1% improvement over baseline (threshold: 10%)
Includes eval.yaml with K8s probe scenario + negative test.
Copilot AI review requested due to automatic review settings February 23, 2026 14:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a new implementing-health-checks skill that teaches ASP.NET Core health check configuration for Kubernetes deployments, with a reported +33.1% improvement in evaluation metrics.

Changes:

  • Adds comprehensive skill documentation covering liveness, readiness, and startup probes with proper separation of concerns
  • Includes code examples for health check registration, custom health checks, response formatters, and Kubernetes probe configuration
  • Provides eval.yaml tests with positive scenario (Kubernetes health checks) and negative scenario (ensuring skill doesn't activate for APM/monitoring requests)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/dotnet/skills/implementing-health-checks/SKILL.md Complete skill documentation with workflow steps, code examples, Kubernetes YAML configuration, and common pitfalls table
src/dotnet/tests/implementing-health-checks/eval.yaml Test scenarios validating proper liveness/readiness separation and skill activation boundaries

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// Startup: Kubernetes startupProbe hits this
app.MapHealthChecks("/healthz/startup", new HealthCheckOptions
{
Predicate = _ => true,
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The startup probe configuration uses Predicate = _ => true, which executes ALL registered health checks including database, Redis, and external API dependency checks. This contradicts Kubernetes best practices: startup probes should check the same thing as liveness probes (process health only), not readiness checks (dependencies). The current implementation means if any dependency is unavailable during the 150-second startup window, Kubernetes will kill the pod rather than marking it as "not ready". Consider changing to Predicate = check => check.Tags.Contains("live") to align with the liveness/readiness separation pattern explained in Step 2.

Suggested change
Predicate = _ => true,
Predicate = check => check.Tags.Contains("live"),

Copilot uses AI. Check for mistakes.
Comment on lines +56 to +64
tags: new[] { "ready" })
.AddRedis(
redisConnectionString: builder.Configuration.GetConnectionString("Redis")!,
name: "redis",
tags: new[] { "ready" })
.AddUrlGroup(
new Uri("https://api.external-service.com/health"),
name: "external-api",
tags: new[] { "ready" });
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Common Pitfalls section recommends adding timeout parameters to health check registrations, but the example code in Step 2 doesn't include any timeout parameters. For consistency and to demonstrate best practices, consider adding timeout parameters to the health check registrations in Step 2. For example: .AddSqlServer(connectionString: ..., name: "database", tags: new[] { "ready" }, timeout: TimeSpan.FromSeconds(5))

Suggested change
tags: new[] { "ready" })
.AddRedis(
redisConnectionString: builder.Configuration.GetConnectionString("Redis")!,
name: "redis",
tags: new[] { "ready" })
.AddUrlGroup(
new Uri("https://api.external-service.com/health"),
name: "external-api",
tags: new[] { "ready" });
tags: new[] { "ready" },
timeout: TimeSpan.FromSeconds(5))
.AddRedis(
redisConnectionString: builder.Configuration.GetConnectionString("Redis")!,
name: "redis",
tags: new[] { "ready" },
timeout: TimeSpan.FromSeconds(5))
.AddUrlGroup(
new Uri("https://api.external-service.com/health"),
name: "external-api",
tags: new[] { "ready" },
timeout: TimeSpan.FromSeconds(5));

Copilot uses AI. Check for mistakes.
### Step 1: Add the health checks packages

```bash
dotnet add package Microsoft.Extensions.Diagnostics.HealthChecks
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package Microsoft.Extensions.Diagnostics.HealthChecks is already included in ASP.NET Core framework references and doesn't need to be explicitly installed. While this line isn't harmful, it's redundant and could be removed to avoid confusion.

Suggested change
dotnet add package Microsoft.Extensions.Diagnostics.HealthChecks

Copilot uses AI. Check for mistakes.
@mrsharm
Copy link
Copy Markdown
Member Author

mrsharm commented Feb 25, 2026

Skill Validation Results — implementing-health-checks

Skill Test Baseline With Skill Δ Verdict
implementing-health-checks Add health checks with Kubernetes probes 4.0/5 4.3/5 +0.3
implementing-health-checks Health check skill should not activate for monitoring setup 2.7/5 3.7/5 +1.0

Overall improvement: +17.2% (3 runs, not statistically significant)

Model: claude-opus-4.6 | Judge: claude-opus-4.6

1 similar comment
@mrsharm
Copy link
Copy Markdown
Member Author

mrsharm commented Feb 25, 2026

Skill Validation Results — implementing-health-checks

Skill Test Baseline With Skill Δ Verdict
implementing-health-checks Add health checks with Kubernetes probes 4.0/5 4.3/5 +0.3
implementing-health-checks Health check skill should not activate for monitoring setup 2.7/5 3.7/5 +1.0

Overall improvement: +17.2% (3 runs, not statistically significant)

Model: claude-opus-4.6 | Judge: claude-opus-4.6

@mrsharm mrsharm changed the title Add implementing-health-checks skill (+33.1% eval improvement) Add implementing-health-checks skill Feb 25, 2026
@jeffschwMSFT jeffschwMSFT requested a review from artl93 March 2, 2026 16:05
@mrsharm
Copy link
Copy Markdown
Member Author

mrsharm commented Mar 6, 2026

Superseded by #263 which uses the new plugins/ directory structure and addresses review feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants