Dotnet aspire

From markus41/claude · View interactive version

Dotnet aspire is an AI agent skill from the GitHub repository markus41/claude. .NET Aspire for cloud-native app orchestration, service discovery, telemetry, and component integrations

How to use this skill

Skill file

.NET Aspire

What is Aspire?

.NET Aspire is an opinionated, cloud-ready stack for building observable, production-ready, distributed applications. It provides:

AppHost (Orchestrator)

// MyApp.AppHost/Program.cs
var builder = DistributedApplication.CreateBuilder(args);

// Infrastructure resources
var postgres = builder.AddPostgres("postgres").WithDataVolume().WithPgAdmin();
var redis = builder.AddRedis("redis").WithRedisInsight();
var rabbitmq = builder.AddRabbitMQ("messaging").WithManagementPlugin();

// Databases
var appDb = postgres.AddDatabase("appdb");

// Projects (services)
var api = builder.AddProject<Projects.Api>("api")
    .WithReference(appDb)
    .WithReference(redis)
    .WithReference(rabbitmq)
    .WithExternalHttpEndpoints();

var web = builder.AddProject<Projects.Web>("web")
    .WithReference(api)
    .WithReference(redis)
    .WithExternalHttpEndpoints();

var worker = builder.AddProject<Projects.Worker>("worker")
    .WithReference(rabbitmq)
    .WithReference(appDb);

builder.Build().Run();

Service Defaults

// ServiceDefaults/Extensions.cs (shared project)
public static IHostApplicationBuilder AddServiceDefaults(this IHostApplicationBuilder builder)
{
    builder.ConfigureOpenTelemetry();
    builder.AddDefaultHealthChecks();
    builder.Services.AddServiceDiscovery();

    builder.Services.ConfigureHttpClientDefaults(http =>
    {
        http.AddStandardResilienceHandler();
        http.AddServiceDiscovery();
    });

    return builder;
}

Component Integrations

| Component | NuGet Package | AddXxx Method |

|-----------|--------------|---------------|

| PostgreSQL (EF) | Aspire.Npgsql.EntityFrameworkCore.PostgreSQL | AddNpgsqlDbContext<T>() |

| SQL Server (EF) | Aspire.Microsoft.EntityFrameworkCore.SqlServer | AddSqlServerDbContext<T>() |

| Redis Cache | Aspire.StackExchange.Redis.DistributedCaching | AddRedisDistributedCache() |

| Redis Output Cache | Aspire.StackExchange.Redis.OutputCaching | AddRedisOutputCache() |

| RabbitMQ | Aspire.RabbitMQ.Client | AddRabbitMQClient() |

| Azure Service Bus | Aspire.Azure.Messaging.ServiceBus | AddAzureServiceBusClient() |

| Azure Blob Storage | Aspire.Azure.Storage.Blobs | AddAzureBlobClient() |

| Cosmos DB | Aspire.Microsoft.Azure.Cosmos | AddAzureCosmosClient() |

Dashboard

The Aspire dashboard provides:

Access at: https://localhost:18888 (default)

Deployment

# Deploy to Azure Container Apps
azd init
azd provision  # Creates Azure resources
azd deploy     # Deploys all services

# Or use Aspire CLI
aspire publish --publisher azure

Key Patterns

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.