Skip to content
Back to skills

Add Api Endpoint Tassadar2499 Novatune 3

ASecurity

Add a new minimal API endpoint to NovaTune with service, models, and tests

  • 666 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 2, 2026
ai-agentsapidocumentation

Works with

  • api

Security analysis

A100/100

Scanned June 2, 2026

npx -y skills add majiayu000/claude-skill-registry --skill add-api-endpoint-tassadar2499-novatune --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Add Api Endpoint Tassadar2499 Novatune 3?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Add Api Endpoint Tassadar2499 Novatune 3
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-add-api-endpoint-tassadar2499-novatune-3/badge)](https://www.skillsdirectory.com/skills/majiayu000-add-api-endpoint-tassadar2499-novatune-3)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
description: Add a new minimal API endpoint to NovaTune with service, models, and tests
---
# Add API Endpoint Skill

Add a new minimal API endpoint to NovaTune.

## Steps

### 1. Create/Update Request and Response Models

Location: `src/NovaTuneApp/NovaTuneApp.ApiService/Models/`

```csharp
// Models/Requests/CreateTrackRequest.cs
public record CreateTrackRequest(
    string Title,
    string? Description);

// Models/Responses/TrackResponse.cs
public record TrackResponse(
    Guid Id,
    string Title,
    string? Description,
    DateTimeOffset CreatedAt);
```

### 2. Create/Update Service

Location: `src/NovaTuneApp/NovaTuneApp.ApiService/Services/`

```csharp
public interface ITrackService
{
    Task<Track> CreateAsync(CreateTrackRequest request, CancellationToken ct);
}

public class TrackService : ITrackService
{
    private readonly IDocumentSession _session;

    public TrackService(IDocumentSession session)
    {
        _session = session;
    }

    public async Task<Track> CreateAsync(CreateTrackRequest request, CancellationToken ct)
    {
        var track = new Track
        {
            Title = request.Title,
            Description = request.Description,
            CreatedAt = DateTimeOffset.UtcNow
        };

        await _session.StoreAsync(track, ct);
        await _session.SaveChangesAsync(ct);

        return track;
    }
}
```

### 3. Create Endpoint Group

Location: `src/NovaTuneApp/NovaTuneApp.ApiService/Endpoints/`

```csharp
public static class TrackEndpoints
{
    public static void MapTrackEndpoints(this IEndpointRouteBuilder app)
    {
        var group = app.MapGroup("/api/tracks")
            .WithTags("Tracks")
            .WithOpenApi();

        group.MapPost("/", CreateTrack)
            .WithName("CreateTrack")
            .RequireAuthorization();

        group.MapGet("/{id:guid}", GetTrack)
            .WithName("GetTrack");
    }

    private static async Task<IResult> CreateTrack(
        CreateTrackRequest request,
        ITrackService trackService,
        CancellationToken ct)
    {
        var track = await trackService.CreateAsync(request, ct);
        return TypedResults.Created($"/api/tracks/{track.Id}", track.ToResponse());
    }

    private static async Task<IResult> GetTrack(
        Guid id,
        ITrackService trackService,
        CancellationToken ct)
    {
        var track = await trackService.GetByIdAsync(id, ct);
        return track is null
            ? TypedResults.NotFound()
            : TypedResults.Ok(track.ToResponse());
    }
}
```

### 4. Register in Program.cs

```csharp
// Register service
builder.Services.AddScoped<ITrackService, TrackService>();

// Map endpoints (after app.Build())
app.MapTrackEndpoints();
```

### 5. Add Tests

Unit test: `src/unit_tests/TrackServiceTests.cs`
Integration test: `src/NovaTuneApp/NovaTuneApp.Tests/TrackEndpoints.IntegrationTests.cs`

## Conventions

- Use minimal APIs with `MapGroup`
- Return `TypedResults` for proper OpenAPI schema
- Use `WithTags` and `WithOpenApi` for Scalar documentation
- Add `RequireAuthorization()` for protected endpoints
- Use `CancellationToken` in all async methods
- PascalCase for endpoint names

## Response Status Codes

| Operation | Success | Error |
|-----------|---------|-------|
| Create | 201 Created | 400 Bad Request |
| Get | 200 OK | 404 Not Found |
| Update | 200 OK / 204 No Content | 404 Not Found |
| Delete | 204 No Content | 404 Not Found |
| List | 200 OK | - |

## API Documentation

Access Scalar UI at `/scalar/v1` when running the API.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.