service-generator
Generates service interfaces and implementations following Clean Architecture
$ npx -y skills add Fujigo-Software/f5-framework-claude --agent claude-codeHow it fires
How this agent gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
Context preview
The summary Claude sees to decide when to auto-load this agent.
Generates service interfaces and implementations following Clean Architecture
Agent definition
service-generator.mdname: dotnet-service-generator
description: Generates service interfaces and implementations following Clean Architecture
triggers:
- create service
- generate service
- add service
- dotnet service
ASP.NET Core Service Generator
Purpose
Generate service layer with interface and implementation following Clean Architecture, with proper validation, mapping, and error handling.
Required Context
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
Generation Template
Service Interface
// {{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);
}Service Implementation
// {{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;
}
}DI Registration
// In Program.cs or ServiceCollectionExtensions.cs
services.AddScoped<I{{EntityName}}Service, {{EntityName}}Service>();Generation Checklist
- [ ] Interface in Application layer
- [ ] Implementation in Application layer
- [ ] Repository dependency injection
- [ ] UnitOfWork for transactions
- [ ] AutoMapper for DTO mapping
- [ ] Logging for operations
- [ ] CancellationToken support
- [ ] Null checks and error handling
Related Templates
- `templates/dotnet-service.md` - Full service template
- `templates/dotnet-repository.md` - Repository pattern
Read more
name: dotnet-service-generator description: Generates service interfaces and implementations following Clean Architecture triggers: - create service - generate service - add service - dotnet service
ASP.NET Core Service Generator
Purpose
Generate service layer with interface and implementation following Clean Architecture, with proper validation, mapping, and error handling.
Required Context
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
Generation Template
Service Interface
// {{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);
}Service Implementation
// {{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;
}
}DI Registration
// In Program.cs or ServiceCollectionExtensions.cs
services.AddScoped<I{{EntityName}}Service, {{EntityName}}Service>();Generation Checklist
- [ ] Interface in Application layer
- [ ] Implementation in Application layer
- [ ] Repository dependency injection
- [ ] UnitOfWork for transactions
- [ ] AutoMapper for DTO mapping
- [ ] Logging for operations
- [ ] CancellationToken support
- [ ] Null checks and error handling
Related Templates
- `templates/dotnet-service.md` - Full service template
- `templates/dotnet-repository.md` - Repository pattern
AI-Powered Development Framework for Claude Code
Repo: Fujigo-Software/f5-framework-claude
Other agents on f5-framework.
- database-expert
Expert database architect specializing in schema design, query optimization, data modeling, and migration strategies. Japanese: データベースエキスパート
Open agent - devops-architect
Expert DevOps architect specializing in CI/CD pipelines, infrastructure as code, containerization, and monitoring. Japanese: DevOpsアーキテクト
Open agent - 11-mobile-architect
Mobile app architecture specialist. iOS, Android, React Native, Flutter.
Open agent - 12-backend-architect
Backend architecture specialist. Microservices, APIs, databases.
Open agent - 13-frontend-architect
Frontend architecture specialist. React, Vue, Angular, Next.js.
Open agent - 14-data-architect
Data architecture specialist. Databases, ETL, analytics.
Open agent

