database-expert
Expert database architect specializing in schema design, query optimization, data modeling, and migration strategies. Japanese: データベースエキスパート
Generates service interfaces and implementations following Clean Architecture
> /plugin marketplace add Fujigo-Software/f5-framework-claudeHow it fires
How this agent gets triggered: by you, by Claude, or both.
Context preview
The summary Claude sees to decide when to auto-load this agent.
Generates service interfaces and implementations following Clean Architecture
name: dotnet-service-generator description: Generates service interfaces and implementations following Clean Architecture triggers: - create service - generate service - add service - dotnet service
Generate service layer with interface and implementation following Clean Architecture, with proper validation, mapping, and error handling.
Before generating, gather: 1. **Entity Name**: PascalCase name (e.g., `Product`) 2. **Operations**: Required service methods 3. **Repository**: Repository interface to use 4. **Validation**: Validation requirements
// {{SolutionName}}.Application/Interfaces/I{{EntityName}}Service.cs
using {{SolutionName}}.Application.DTOs;
namespace {{SolutionName}}.Application.Interfaces;
public interface I{{EntityName}}Service
{
Task<IEnumerable<{{EntityName}}Dto>> GetAllAsync(
{{EntityName}}FilterDto filter,
CancellationToken cancellationToken = default);
Task<{{EntityName}}Dto?> GetByIdAsync(
Guid id,
CancellationToken cancellationToken = default);
Task<{{EntityName}}Dto> CreateAsync(
Create{{EntityName}}Dto dto,
CancellationToken cancellationToken = default);
Task<{{EntityName}}Dto?> UpdateAsync(
Guid id,
Update{{EntityName}}Dto dto,
CancellationToken cancellationToken = default);
Task<bool> DeleteAsync(
Guid id,
CancellationToken cancellationToken = default);
}// {{SolutionName}}.Application/Services/{{EntityName}}Service.cs
using AutoMapper;
using Microsoft.Extensions.Logging;
using {{SolutionName}}.Application.DTOs;
using {{SolutionName}}.Application.Interfaces;
using {{SolutionName}}.Domain.Entities;
using {{SolutionName}}.Domain.Interfaces;
namespace {{SolutionName}}.Application.Services;
public class {{EntityName}}Service : I{{EntityName}}Service
{
private readonly I{{EntityName}}Repository _repository;
private readonly IUnitOfWork _unitOfWork;
private readonly IMapper _mapper;
private readonly ILogger<{{EntityName}}Service> _logger;
public {{EntityName}}Service(
I{{EntityName}}Repository repository,
IUnitOfWork unitOfWork,
IMapper mapper,
ILogger<{{EntityName}}Service> logger)
{
_repository = repository;
_unitOfWork = unitOfWork;
_mapper = mapper;
_logger = logger;
}
public async Task<IEnumerable<{{EntityName}}Dto>> GetAllAsync(
{{EntityName}}FilterDto filter,
CancellationToken cancellationToken = default)
{
var entities = await _repository.GetAllAsync(filter, cancellationToken);
return _mapper.Map<IEnumerable<{{EntityName}}Dto>>(entities);
}
public async Task<{{EntityName}}Dto?> GetByIdAsync(
Guid id,
CancellationToken cancellationToken = default)
{
var entity = await _repository.GetByIdAsync(id, cancellationToken);
return entity is null ? null : _mapper.Map<{{EntityName}}Dto>(entity);
}
public async Task<{{EntityName}}Dto> CreateAsync(
Create{{EntityName}}Dto dto,
CancellationToken cancellationToken = default)
{
var entity = _mapper.Map<{{EntityName}}>(dto);
await _repository.AddAsync(entity, cancellationToken);
await _unitOfWork.SaveChangesAsync(cancellationToken);
_logger.LogInformation("{{EntityName}} created with ID {Id}", entity.Id);
return _mapper.Map<{{EntityName}}Dto>(entity);
}
public async Task<{{EntityName}}Dto?> UpdateAsync(
Guid id,
Update{{EntityName}}Dto dto,
CancellationToken cancellationToken = default)
{
var entity = await _repository.GetByIdAsync(id, cancellationToken);
if (entity is null)
return null;
_mapper.Map(dto, entity);
_repository.Update(entity);
await _unitOfWork.SaveChangesAsync(cancellationToken);
_logger.LogInformation("{{EntityName}} updated with ID {Id}", id);
return _mapper.Map<{{EntityName}}Dto>(entity);
}
public async Task<bool> DeleteAsync(
Guid id,
CancellationToken cancellationToken = default)
{
var entity = await _repository.GetByIdAsync(id, cancellationToken);
if (entity is null)
return false;
_repository.Delete(entity);
await _unitOfWork.SaveChangesAsync(cancellationToken);
_logger.LogInformation("{{EntityName}} deleted with ID {Id}", id);
return true;
}
}// In Program.cs or ServiceCollectionExtensions.cs
services.AddScoped<I{{EntityName}}Service, {{EntityName}}Service>();Repo: Fujigo-Software/f5-framework-claude
Expert database architect specializing in schema design, query optimization, data modeling, and migration strategies. Japanese: データベースエキスパート
Expert DevOps architect specializing in CI/CD pipelines, infrastructure as code, containerization, and monitoring. Japanese: DevOpsアーキテクト
Mobile app architecture specialist. iOS, Android, React Native, Flutter.
Backend architecture specialist. Microservices, APIs, databases.
Frontend architecture specialist. React, Vue, Angular, Next.js.