/harness-claude:nestjs-service-patternfrom harness-claude
Encapsulates business logic in NestJS @Injectable services with repository pattern separation. Useful for reusable logic across controllers and testable data access.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /harness-claude:nestjs-service-pattern still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Encapsulate business logic in @Injectable services with repository pattern separation
@Injectable(). This registers it as a provider that the DI container can instantiate and inject.providers array of its module. Export it if other modules need to inject it.UsersService, OrdersService). Avoid AppService catch-alls.HttpException subclasses (NotFoundException, ConflictException, etc.) for domain errors so exception filters can serialize them correctly.@Injectable()
export class UsersService {
constructor(private readonly prisma: PrismaService) {}
async findOne(id: string): Promise<User> {
const user = await this.prisma.user.findUnique({ where: { id } });
if (!user) throw new NotFoundException(`User ${id} not found`);
return user;
}
async create(dto: CreateUserDto): Promise<User> {
const existing = await this.prisma.user.findUnique({ where: { email: dto.email } });
if (existing) throw new ConflictException('Email already registered');
return this.prisma.user.create({ data: dto });
}
async update(id: string, dto: UpdateUserDto): Promise<User> {
await this.findOne(id); // reuse findOne for existence check
return this.prisma.user.update({ where: { id }, data: dto });
}
async remove(id: string): Promise<void> {
await this.findOne(id);
await this.prisma.user.delete({ where: { id } });
}
}
async/await for all async operations. Do not mix callbacks and promises.Services are the workhorses of NestJS applications. They are singleton-scoped by default (one instance shared across the entire app lifetime), which means you should not store per-request state in service instance variables.
Scope options: @Injectable({ scope: Scope.REQUEST }) creates a new instance per request — useful for request-scoped data (e.g., tenant ID) but has a performance cost since the entire dependency chain must be request-scoped. Use the default DEFAULT (singleton) scope unless you have a concrete reason not to.
Repository pattern with Prisma: Rather than calling prisma.user everywhere in a service, some teams create a UsersRepository class that wraps Prisma calls and exposes domain-level methods (findByEmail, findActiveUsers). This makes the service easier to test and the data access logic easier to swap.
Error boundaries: Only throw HTTP exceptions in the service if it is HTTP-facing. For domain services shared between HTTP and microservice transports, throw domain-specific exceptions and convert them to RpcException or HttpException at the transport layer.
Circular dependency between services: When ServiceA depends on ServiceB and vice versa, inject with forwardRef(): @Inject(forwardRef(() => ServiceB)) private serviceB: ServiceB. Prefer refactoring to a shared third service instead.
https://docs.nestjs.com/providers
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeRead when SKILL.md points to them.
793 skills in this plugin
/a11y-aria-patternsARIA Patterns> Apply ARIA roles, states, and properties correctly to enhance assistive technology support for custom widgets/a11y-color-contrastColor Contrast and Color Independence> Ensure sufficient color contrast ratios and never use color as the sole means of conveying information/a11y-form-patternsAccessible Form Patterns> Build accessible forms with proper labeling, grouped controls, inline validation, and clear error communicationOther plugins' skills for the same job