本文へ移動
cccskills
無料GitHub で公開

azure-functions

Build, review, or migrate Azure Functions in .NET with correct execution model, isolated worker setup, bindings, DI, and Durable Functions patterns. USE FOR: working on Azure Functions in .NET; migrating from the in-process model to the isolated worker model; adding Durable Functions, bindings, or host configuration. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.

インストール方法を見る

含まれるファイル(4)

  • SKILL.md10.0 KB
  • manifest.json97 B
  • references/anti-patterns.md19.7 KB
  • references/patterns.md17.6 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Azure Functions for .NET

Trigger On

  • working on Azure Functions in .NET
  • migrating from the in-process model to the isolated worker model
  • adding Durable Functions, bindings, or host configuration

Documentation

References

  • Patterns - Isolated worker patterns, Durable Functions patterns, advanced binding patterns
  • Anti-Patterns - Common Azure Functions mistakes and how to avoid them

Workflow

  1. Use isolated worker model for all new work:

    • In-process model reaches end of support on November 10, 2026
    • Runtime v1.x ends support on September 14, 2026
    • Target .NET 8+ for longest support window
  2. Detect current project shape:

    • Target framework and runtime version
    • Worker model (isolated vs in-process)
    • Binding packages and host configuration
  3. Use standard .NET patterns in isolated model:

    • Normal dependency injection
    • Middleware pipeline
    • IOptions<T> for configuration
    • ILogger<T> for logging
  4. For Durable Functions:

    • Validate orchestration determinism constraints
    • Handle replay behavior correctly
    • Use typed activity patterns
  5. Verify both local and deployment behavior.

Isolated Worker Model Setup

Basic Function with DI

// Program.cs
var host = new HostBuilder()
    .ConfigureFunctionsWebApplication()
    .ConfigureServices(services =>
    {
        services.AddApplicationInsightsTelemetryWorkerService();
        services.ConfigureFunctionsApplicationInsights();
        services.AddSingleton<IMyService, MyService>();
    })
    .Build();

host.Run();

HTTP Trigger Function

public class HttpFunctions(ILogger<HttpFunctions> logger, IMyService myService)
{
    [Function("GetItems")]
    public async Task<IActionResult> GetItems(
        [HttpTrigger(AuthorizationLevel.Function, "get", Route = "items")] HttpRequest req)
    {
        logger.LogInformation("Processing GetItems request");
        var items = await myService.GetItemsAsync();
        return new OkObjectResult(items);
    }
}

Queue Trigger with Options

public class QueueFunctions(ILogger<QueueFunctions> logger, IOptions<ProcessingOptions> options)
{
    [Function("ProcessMessage")]
    public async Task ProcessMessage(
        [QueueTrigger("myqueue", Connection = "AzureWebJobsStorage")] string message)
    {
        logger.LogInformation("Processing message: {Message}", message);
        // Process with retry policy from options
    }
}

Middleware Pattern

Custom Middleware

// Program.cs
var host = new HostBuilder()
    .ConfigureFunctionsWebApplication(builder =>
    {
        builder.UseMiddleware<ExceptionHandlingMiddleware>();
        builder.UseMiddleware<CorrelationIdMiddleware>();
    })
    .Build();

// CorrelationIdMiddleware.cs
public class CorrelationIdMiddleware : IFunctionsWorkerMiddleware
{
    public async Task Invoke(FunctionContext context, FunctionExecutionDelegate next)
    {
        var correlationId = context.Features.Get<IHttpRequestFeature>()?.Headers["X-Correlation-Id"]
            ?? Guid.NewGuid().ToString();

        context.Items["CorrelationId"] = correlationId;

        await next(context);
    }
}

Durable Functions Patterns

Function Chaining

[Function(nameof(ChainOrchestrator))]
public static async Task<string> ChainOrchestrator(
    [OrchestrationTrigger] TaskOrchestrationContext context)
{
    var result1 = await context.CallActivityAsync<string>(nameof(Step1), "input");
    var result2 = await context.CallActivityAsync<string>(nameof(Step2), result1);
    var result3 = await context.CallActivityAsync<string>(nameof(Step3), result2);
    return result3;
}

[Function(nameof(Step1))]
public static string Step1([ActivityTrigger] string input) => $"Step1({input})";

[Function(nameof(Step2))]
public static string Step2([ActivityTrigger] string input) => $"Step2({input})";

[Function(nameof(Step3))]
public static string Step3([ActivityTrigger] string input) => $"Step3({input})";

Fan-Out/Fan-In

[Function(nameof(FanOutFanInOrchestrator))]
public static async Task<int[]> FanOutFanInOrchestrator(
    [OrchestrationTrigger] TaskOrchestrationContext context)
{
    var workItems = await context.CallActivityAsync<string[]>(nameof(GetWorkItems), null);

    // Fan out - process all items in parallel
    var tasks = workItems.Select(item =>
        context.CallActivityAsync<int>(nameof(ProcessWorkItem), item));

    // Fan in - wait for all to complete
    var results = await Task.WhenAll(tasks);

    return results;
}

[Function(nameof(ProcessWorkItem))]
public static int ProcessWorkItem([ActivityTrigger] string item)
{
    // Process item and return result
    return item.Length;
}

Human Interaction Pattern

[Function(nameof(ApprovalOrchestrator))]
public static async Task<string> ApprovalOrchestrator(
    [OrchestrationTrigger] TaskOrchestrationContext context)
{
    var request = context.GetInput<ApprovalRequest>();

    // Send notification
    await context.CallActivityAsync(nameof(SendApprovalRequest), request);

    // Wait for external event with timeout
    using var cts = new CancellationTokenSource();
    var approvalTask = context.WaitForExternalEvent<bool>("ApprovalEvent");
    var timeoutTask = context.CreateTimer(context.CurrentUtcDateTime.AddDays(7), cts.Token);

    var winner = await Task.WhenAny(approvalTask, timeoutTask);

    if (winner == approvalTask)
    {
        cts.Cancel();
        return approvalTask.Result ? "Approved" : "Rejected";
    }

    return "Timed out";
}

Best Practices

  1. Use isolated worker model for new development - Full .NET ecosystem access, middleware support, and longer support lifecycle
  2. Inject dependencies via constructor - Use ILogger<T> and service interfaces for testability
  3. Keep orchestrator code deterministic - No I/O, random, DateTime.Now, or Guid.NewGuid() in orchestrators
  4. Handle sensitive data in activities - Fetch secrets from Key Vault in activity functions, never in orchestrators
  5. Use unique task hub names - Prevent accidental sharing when multiple apps use the same storage
  6. Avoid large inputs/outputs - Serialize to blob storage for large payloads to prevent history bloat
  7. Configure concurrency limits - Set appropriate limits in host.json for resource-intensive functions
  8. Keep SDK and extensions updated - Latest versions include performance improvements and bug fixes

Anti-Patterns to Avoid

Anti-PatternWhy It's BadBetter Approach
Mixing in-process and isolated guidanceIncompatible APIs and patternsChoose one model consistently
Non-deterministic orchestrator codeReplay failures, stuck orchestrationsUse context.CurrentUtcDateTime, no I/O
Large orchestrator inputs/outputsHistory bloat, memory issuesStore large data in blob storage
Shared task hub namesMessage conflicts, stuck orchestrationsUse unique names per app
Secrets in orchestrator historySecurity risk, exposed in logsFetch secrets in activity functions
Blocking calls in async functionsThread pool exhaustionUse await throughout
Missing retry policiesTransient failures cause job lossConfigure retry in bindings or code
Ignoring execution model migrationEOL November 2026 for in-processMigrate to isolated worker model

Deployment Considerations

Linux Consumption Plan Limitations

.NET 10+ apps cannot run on Linux Consumption plan.
Use Flex Consumption plan or App Service for .NET 10+.
.NET 9 is the last version supported on Linux Consumption.

host.json Configuration

{
  "version": "2.0",
  "extensions": {
    "durableTask": {
      "hubName": "MyUniqueTaskHub",
      "maxConcurrentActivityFunctions": 10,
      "maxConcurrentOrchestratorFunctions": 5
    }
  },
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  }
}

Deliver

  • correct Functions project setup for the isolated worker model
  • clear binding and host configuration
  • middleware for cross-cutting concerns
  • Durable Functions with proper orchestration patterns
  • migration-safe guidance when upgrading execution models

Validate

  • execution model guidance is consistent (isolated only for new work)
  • orchestrator code is deterministic
  • bindings and host settings match the target runtime
  • large payloads are externalized to blob storage
  • retry policies are configured for transient failures
  • local and deployment behavior are both verified

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Route gh-aw workflow design/create/debug/upgrade requests to the right prompts.

日本語の概要は準備中です。原文の説明を表示しています。

managedcode/dotnet-skills4852026年10月10日 更新

Use a repo-root `.editorconfig` to configure free .NET analyzer and style rules. Use when a .NET repo needs rule severity, code-style options, section layout, or analyzer ownership made explicit. USE FOR: the repo needs a root .editorconfig; analyzer severity and style ownership are unclear; the team wants one source of truth for rule configuration. DO NOT USE FOR: choosing analyzers with no config change; formatting-only execution with no config ownership question. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.

日本語の概要は準備中です。原文の説明を表示しています。

managedcode/dotnet-skills4852026年10月10日 更新

Scans .NET code for ~50 performance anti-patterns across async, memory, strings, collections, LINQ, regex, serialization, and I/O with tiered severity classification. Use when analyzing .NET code for optimization opportunities, reviewing hot paths, or auditing allocation-heavy patterns.

日本語の概要は準備中です。原文の説明を表示しています。

managedcode/dotnet-skills4852026年10月10日 更新

Symbolicate the .NET runtime frames in an Android tombstone file. Extracts BuildIds and PC offsets from the native backtrace, downloads debug symbols from the Microsoft symbol server, and runs llvm-symbolizer to produce function names with source file and line numbers. USE FOR triaging a .NET MAUI or Mono Android app crash from a tombstone, resolving native backtrace frames in libmonosgen-2.0.so or libcoreclr.so to .NET runtime source code, or investigating SIGABRT, SIGSEGV, or other native signals originating from the .NET runtime on Android. DO NOT USE FOR pure Java/Kotlin crashes, managed .NET exceptions that are already captured in logcat, or iOS crash logs. INVOKES Symbolicate-Tombstone.ps1 script, llvm-symbolizer, Microsoft symbol server.

日本語の概要は準備中です。原文の説明を表示しています。

managedcode/dotnet-skills4852026年10月10日 更新

Symbolicate .NET runtime frames in Apple platform .ips crash logs (iOS, tvOS, Mac Catalyst, macOS). Extracts UUIDs and addresses from the native backtrace, locates dSYM debug symbols, and runs atos to produce function names with source file and line numbers. Automatically downloads .dwarf symbols from the Microsoft symbol server using Mach-O UUIDs. USE FOR triaging a .NET MAUI or Mono app crash from an .ips file on any Apple platform, resolving native backtrace frames in libcoreclr or libmonosgen-2.0 to .NET runtime source code, retrieving .ips crash logs from a connected iOS device or iPhone, or investigating EXC_CRASH, EXC_BAD_ACCESS, SIGABRT, or SIGSEGV originating from the .NET runtime. DO NOT USE FOR pure Swift/Objective-C crashes with no .NET components, or Android tombstone files. INVOKES Symbolicate-Crash.ps1 script, atos, dwarfdump, idevicecrashreport.

日本語の概要は準備中です。原文の説明を表示しています。

managedcode/dotnet-skills4852026年10月10日 更新

Design or review .NET solution architecture across modular monoliths, clean architecture, vertical slices, microservices, DDD, CQRS, and cloud-native boundaries without over-engineering. USE FOR: .NET architecture choices; layer and domain boundary review; service decomposition; clean architecture, vertical slice, DDD, CQRS, and modular monolith decisions. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.

日本語の概要は準備中です。原文の説明を表示しています。

managedcode/dotnet-skills4852026年10月10日 更新

managedcode のスキルをすべて見る

このスキルの問題を報告する