skills/dotnet/generators/create-repository/SKILL.md
Generate Repository implementation for Domain Repository Interface using EF Core or Dapper in Infrastructure layer. Use when: - Implementing repository interface defined in Domain layer - Creating data access layer with EF Core or Dapper - Building repository pattern implementations - Scaffolding persistence layer for aggregates - Implementing read/write separation (CQRS) Triggers: "create repository", "generate repository", "repository implementation", "EF repository", "Dapper repository"
npx skillsauth add yeeehaooo/WorkSpace create-repositoryInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Implement Domain Repository Interface with EF Core or Dapper.
Applies to:
EF Core Repository:
public class {Entity}Repository : I{Entity}Repository
{
private readonly AppDbContext _db;
public {Entity}Repository(AppDbContext db)
{
_db = db;
}
public async Task<{Entity}?> GetByIdAsync(Guid id, CancellationToken ct = default)
{
return await _db.Set<{Entity}>().FindAsync(new object[] { id }, ct);
}
public async Task AddAsync({Entity} entity, CancellationToken ct = default)
{
await _db.Set<{Entity}>().AddAsync(entity, ct);
}
public Task UpdateAsync({Entity} entity, CancellationToken ct = default)
{
_db.Set<{Entity}>().Update(entity);
return Task.CompletedTask;
}
public async Task DeleteAsync(Guid id, CancellationToken ct = default)
{
var entity = await GetByIdAsync(id, ct);
if (entity != null)
{
_db.Set<{Entity}>().Remove(entity);
}
}
}
Dapper Repository:
public class {Entity}Repository : I{Entity}Repository
{
private readonly IDbSession _session;
public {Entity}Repository(IDbSession session)
{
_session = session;
}
public async Task<{Entity}?> GetByIdAsync(Guid id, CancellationToken ct = default)
{
const string sql = "SELECT * FROM {TableName} WHERE Id = @Id";
return await _session.QueryFirstOrDefaultAsync<{Entity}>(sql, new { Id = id }, ct);
}
public async Task AddAsync({Entity} entity, CancellationToken ct = default)
{
const string sql = "INSERT INTO {TableName} (Id, ...) VALUES (@Id, ...)";
await _session.ExecuteAsync(sql, entity, ct);
}
public async Task UpdateAsync({Entity} entity, CancellationToken ct = default)
{
const string sql = "UPDATE {TableName} SET ... WHERE Id = @Id";
await _session.ExecuteAsync(sql, entity, ct);
}
public async Task DeleteAsync(Guid id, CancellationToken ct = default)
{
const string sql = "DELETE FROM {TableName} WHERE Id = @Id";
await _session.ExecuteAsync(sql, new { Id = id }, ct);
}
}
SaveChanges() or CommitAsync()development
Create reusable .NET atomic capability code snippets that can be directly copied and pasted. Use when: - Creating single-purpose code snippets - Building reusable code templates - Implementing atomic technical capabilities - Creating copy-pasteable code blocks - Building snippet library for common patterns Triggers: "create snippet", "code snippet", "reusable snippet", "atomic snippet", "copy-paste code"
development
Create Docker Compose configuration for containerized .NET application development and deployment. Use when: - Containerizing .NET applications - Setting up local development environment with dependencies - Creating multi-container setups (API + DB + Redis) - Defining service dependencies and networking - Building docker-compose.yml for development or production Triggers: "docker compose", "containerize", "multi-container", "docker-compose.yml", "docker setup"
tools
Create adapter structure for integrating third-party APIs in Clean Architecture applications. Use when: - Integrating external APIs or services - Creating HTTP client adapters for third-party services - Implementing API integration with error handling - Setting up adapter pattern for external dependencies - Building resilient external service integrations Triggers: "api adapter", "third-party api", "external service", "http client adapter", "api integration"
development
Enterprise backend structure built on Clean Architecture, DDD, CQRS, and Vertical Slice API Design with Dapper-first persistence. Use when: - Creating new enterprise backend projects - Implementing Clean Architecture with DDD and CQRS - Building vertical slice API endpoints - Using Dapper as primary persistence mechanism - Organizing modules by UseCase-driven and Model-driven separation Triggers: "dmis structure", "clean architecture", "enterprise backend", "DDD CQRS", "vertical slice", "dapper"