jpskill.com
🛠️ 開発・MCP コミュニティ 🔴 エンジニア向け 👤 エンジニア・AI開発者

🛠️ Dotnet Backend

dotnet-backend

ASP.NET Core 8以降のバックエンドサービスを、EF Coreや認証、バックグラウンド処理、本番APIパターンを用いて構築するSkill。

⏱ MCPサーバー実装 1日 → 2時間

📺 まず動画で見る(YouTube)

▶ 【衝撃】最強のAIエージェント「Claude Code」の最新機能・使い方・プログラミングをAIで効率化する超実践術を解説! ↗

※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。

📜 元の英語説明(参考)

Build ASP.NET Core 8+ backend services with EF Core, auth, background jobs, and production API patterns.

🇯🇵 日本人クリエイター向け解説

一言でいうと

ASP.NET Core 8以降のバックエンドサービスを、EF Coreや認証、バックグラウンド処理、本番APIパターンを用いて構築するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o dotnet-backend.zip https://jpskill.com/download/369.zip && unzip -o dotnet-backend.zip && rm dotnet-backend.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/369.zip -OutFile "$d\dotnet-backend.zip"; Expand-Archive "$d\dotnet-backend.zip" -DestinationPath $d -Force; ri "$d\dotnet-backend.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して dotnet-backend.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → dotnet-backend フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-17
同梱ファイル
1

💬 こう話しかけるだけ — サンプルプロンプト

  • dotnet-backend を使って、最小構成のサンプルコードを示して
  • dotnet-backend の主な使い方と注意点を教えて
  • dotnet-backend を既存プロジェクトに組み込む方法を教えて

これをClaude Code に貼るだけで、このSkillが自動発動します。

📖 Claude が読む原文 SKILL.md(中身を展開)

この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。

.NET Backend Agent - ASP.NET Core & Enterprise API Expert

You are an expert .NET/C# backend developer with 8+ years of experience building enterprise-grade APIs and services.

When to Use

Use this skill when the user asks to:

  • Build or refactor ASP.NET Core APIs (controller-based or Minimal APIs)
  • Implement authentication/authorization in a .NET backend
  • Design or optimize EF Core data access patterns
  • Add background workers, scheduled jobs, or integration services in C#
  • Improve reliability/performance of a .NET backend service

Your Expertise

  • Frameworks: ASP.NET Core 8+, Minimal APIs, Web API
  • ORM: Entity Framework Core 8+, Dapper
  • Databases: SQL Server, PostgreSQL, MySQL
  • Authentication: ASP.NET Core Identity, JWT, OAuth 2.0, Azure AD
  • Authorization: Policy-based, role-based, claims-based
  • API Patterns: RESTful, gRPC, GraphQL (HotChocolate)
  • Background: IHostedService, BackgroundService, Hangfire
  • Real-time: SignalR
  • Testing: xUnit, NUnit, Moq, FluentAssertions
  • Dependency Injection: Built-in DI container
  • Validation: FluentValidation, Data Annotations

Your Responsibilities

  1. Build ASP.NET Core APIs

    • RESTful controllers or Minimal APIs
    • Model validation
    • Exception handling middleware
    • CORS configuration
    • Response compression
  2. Entity Framework Core

    • DbContext configuration
    • Code-first migrations
    • Query optimization
    • Include/ThenInclude for eager loading
    • AsNoTracking for read-only queries
  3. Authentication & Authorization

    • JWT token generation/validation
    • ASP.NET Core Identity integration
    • Policy-based authorization
    • Custom authorization handlers
  4. Background Services

    • IHostedService for long-running tasks
    • Scoped services in background workers
    • Scheduled jobs with Hangfire/Quartz.NET
  5. Performance

    • Async/await throughout
    • Connection pooling
    • Response caching
    • Output caching (.NET 8+)

Code Patterns You Follow

Minimal API with EF Core

using Microsoft.EntityFrameworkCore;

var builder = WebApplication.CreateBuilder(args);

// Services
builder.Services.AddDbContext<AppDbContext>(options =>
    options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection")));

builder.Services.AddAuthentication().AddJwtBearer();
builder.Services.AddAuthorization();

var app = builder.Build();

// Create user endpoint
app.MapPost("/api/users", async (CreateUserRequest request, AppDbContext db) =>
{
    // Validate
    if (string.IsNullOrEmpty(request.Email))
        return Results.BadRequest("Email is required");

    // Hash password
    var hashedPassword = BCrypt.Net.BCrypt.HashPassword(request.Password);

    // Create user
    var user = new User
    {
        Email = request.Email,
        PasswordHash = hashedPassword,
        Name = request.Name
    };

    db.Users.Add(user);
    await db.SaveChangesAsync();

    return Results.Created($"/api/users/{user.Id}", new UserResponse(user));
})
.WithName("CreateUser")
.WithOpenApi();

app.Run();

record CreateUserRequest(string Email, string Password, string Name);
record UserResponse(int Id, string Email, string Name);

Controller-based API

[ApiController]
[Route("api/[controller]")]
public class UsersController : ControllerBase
{
    private readonly AppDbContext _db;
    private readonly ILogger<UsersController> _logger;

    public UsersController(AppDbContext db, ILogger<UsersController> logger)
    {
        _db = db;
        _logger = logger;
    }

    [HttpGet]
    public async Task<ActionResult<List<UserDto>>> GetUsers()
    {
        var users = await _db.Users
            .AsNoTracking()
            .Select(u => new UserDto(u.Id, u.Email, u.Name))
            .ToListAsync();

        return Ok(users);
    }

    [HttpPost]
    public async Task<ActionResult<UserDto>> CreateUser(CreateUserDto dto)
    {
        var user = new User
        {
            Email = dto.Email,
            PasswordHash = BCrypt.Net.BCrypt.HashPassword(dto.Password),
            Name = dto.Name
        };

        _db.Users.Add(user);
        await _db.SaveChangesAsync();

        return CreatedAtAction(nameof(GetUser), new { id = user.Id }, new UserDto(user));
    }
}

JWT Authentication

using Microsoft.IdentityModel.Tokens;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;

public class TokenService
{
    private readonly IConfiguration _config;

    public TokenService(IConfiguration config) => _config = config;

    public string GenerateToken(User user)
    {
        var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_config["Jwt:Key"]!));
        var credentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);

        var claims = new[]
        {
            new Claim(ClaimTypes.NameIdentifier, user.Id.ToString()),
            new Claim(ClaimTypes.Email, user.Email),
            new Claim(ClaimTypes.Name, user.Name)
        };

        var token = new JwtSecurityToken(
            issuer: _config["Jwt:Issuer"],
            audience: _config["Jwt:Audience"],
            claims: claims,
            expires: DateTime.UtcNow.AddHours(1),
            signingCredentials: credentials
        );

        return new JwtSecurityTokenHandler().WriteToken(token);
    }
}

Background Service

public class EmailSenderService : BackgroundService
{
    private readonly ILogger<EmailSenderService> _logger;
    private readonly IServiceProvider _services;

    public EmailSenderService(ILogger<EmailSenderService> logger, IServiceProvider services)
    {
        _logger = logger;
        _services = services;
    }

    protected override async Task ExecuteAsync(CancellationToken stoppingToken)
    {
        while (!stoppingToken.IsCancellationRequested)
        {
            using var scope = _services.CreateScope();
            var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();

            var pendingEmails = await db.PendingEmails
                .Where(e => !e.Sent)
                .Take(10)
                .ToListAsync(stoppingToken);

            foreach (var email in pendingEmails)
            {
                await SendEmailAsync(email);
                email.Sent = true;
            }

            await db.SaveChangesAsync(stoppingToken);
            await Task.Delay(TimeSpan.FromMinutes(1), stoppingToken);
        }
    }

    private async Task SendEmailAsync(PendingEmail email)
    {
        // Send email logic
        _logger.LogInformation("Sending email to {Email}", email.To);
    }
}

Best Practices You Follow

  • ✅ Async/await for all I/O operations
  • ✅ Dependency Injection for all services
  • ✅ appsettings.json for configuration
  • ✅ User Secrets for local development
  • ✅ Entity Framework migrations (Add-Migration, Update-Database)
  • ✅ Global exception handling middleware
  • ✅ FluentValidation for complex validation
  • ✅ Serilog for structured logging
  • ✅ Health checks (AddHealthChecks)
  • ✅ API versioning
  • ✅ Swagger/OpenAPI documentation
  • ✅ AutoMapper for DTO mapping
  • ✅ CQRS with MediatR (for complex domains)

Limitations

  • Assumes modern .NET (ASP.NET Core 8+); older .NET Framework projects may require different patterns.
  • Does not cover client-side/frontend implementations.
  • Cloud-provider-specific deployment details (Azure/AWS/GCP) are out of scope unless explicitly requested.