nestjs-patterns
Use this skill when implementing NestJS patterns — CQRS with @nestjs/cqrs, guards/interceptors/pipes/filters, event sourcing, custom decorators…
Skill by j4flmao
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/j4flmao-nestjs-patterns
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 26, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/nestjs-patterns
What's inside
- Skill name
nestjs-patterns- Description
- Use this skill when implementing NestJS patterns — CQRS with @nestjs/cqrs, guards/interceptors/pipes/filters, event sourcing, custom decorators, microservices, and provider patterns. This skill enforces: ExecutionContext-based guards, RxJS in interceptors, decorator composition, typed event payloads. Requires @nestjs/core. Do NOT use for: Module structure, project setup, or non-NestJS applications.
- License
- MIT
- Instructions
- 519 lines in SKILL.md · view on GitHub
Before installing
- Instructions call the network
Agent Skills spec issues
- name: "nestjs-patterns" does not match folder "patterns"
- compatibility: must be text of at most 500 characters
- body: 519 lines (spec recommends under 500)
Files (9)
- SKILL.md
- cqrs-events.md · references/
- decorators-metadata.md · references/
- guards-interceptors.md · references/
- microservices.md · references/
- nestjs-guards-interceptors.md · references/
- nestjs-providers-patterns.md · references/
- nestjs-testing.md · references/
- pipes-filters.md · references/
SKILL.md (first lines)
# NestJS Patterns
## Purpose
Implement NestJS-specific patterns — CQRS, guards/interceptors, event sourcing, custom decorators, microservices transport, and advanced provider patterns.
## Agent Protocol
### Trigger
User request includes: `NestJS guard`, `NestJS interceptor`, `NestJS pipe`, `NestJS filter`, `NestJS CQRS`, `NestJS event sourcing`, `NestJS microservice`, `NestJS decorator`, `NestJS provider`.
### Input Context
- Pattern needed (Guard, Interceptor, Pipe, Filter, CQRS, Microservice)
- Transport type for microservices (TCP, Redis, RabbitMQ, Kafka)
- Module structure and DDD approach
### Output Artifact
Code examples for the requested patterns — guard implementation, interceptor chain, CQRS handler, etc.
### Response Format
Code-first output. Pattern name, problem, types, implementation, usage. No preamble.
### Completion Criteria
- Guard uses ExecutionContext and returns boolean
- Interceptor uses Observable and RxJS operators
- Pipe transforms value or throws
- Filter catches specific exception types
- CQRS with command/query separation
- Microservice with transport strategy
### Max Response Length
4096 tokens
## Architecture Decision Trees
### Guard vs Interceptor vs Middleware
| Aspect | Guard | Interceptor | Middleware |
|--------|-------|-------------|------------|
| Decision | Allow/deny request | Transform response/request | Pre-processing |
| Execution context | Full (route, args) | Full (call handler) | Limited (request/response) |
| RxJS access | No | Yes (Observable) | No |
| DI scope | Module providers | Module providers | Globally registered |
| Use case | Auth, roles, permissions | Caching, logging, mapping | CORS, session, compression |
Decision: Gate (allow/deny) → Guard. Transform (in/out) → Interceptor. Pre-route (no Nest context) → Middleware.
### Transport Strategy for Microservices
| Transport | Pros | Cons | Best For |
|-----------|------|------|----------|
| TCP | Simple, no broker | Point-to-point only | Internal microservices |
| Redis | Pub/sub, fast | Requires Redis | Broadcast, real-time |
| RabbitMQ | Reliable, DLQ, routing | Heavier ops | Complex workflows, async |
| Kafka | High throughput, replay | Complex setup | Event streaming, audit logs |
| gRPC | Strong contracts, perf | Limited ecosystem | Cross-language |
Decision: Simple internal → TCP. Pub/sub + real-time → Redis. Reliable async → RabbitMQ. High-volume streaming → Kafka. Cross-language contracts → gRPC.
## Workflow
### Step 1: Advanced Guards
```typescript
// guards/roles.guard.ts
import { SetMetadata } from '@nestjs/common';
import { Reflector } from '@nestjs/core';
export const ROLES_KEY = 'roles';
export const Roles = (...roles: string[]) => SetMetadata(ROLES_KEY, roles);
@Injectable()
export class RolesGuard implements CanActivate {
constructor(private reflector: Reflector) {}
canActivate(context: ExecutionContext): boolean {
const requiredRoles = this.reflector.getAllAndOverride<string[]>(ROLES_KEY, [
context.getHandler(),
context.getClass(),
]);
if (!requiredRoles) return true;
const { user } = context.switchToHttp().getRequest();
return requiredRoles.some(role => user.roles?.includes(role));
}
}
// guards/throttle.guard.ts
@Injectable()
export class ThrottleGuard implements CanActivate {
private readonly requests = new Map<string, number[]>();
constructor(
@Inject('THROTTLE_CONFIG')
private readonly config: { limit: number; ttl: number },
) {}
canActivate(context: ExecutionContext): boolean {
const request = context.switchToHttp().getRequest();
const key = request.ip;
const now = Date.now();
const timestamps = this.requests.get(key) || [];
const recent = timestamps.filter(t => now - t < this.config.ttl);
recent.push(now);
this.requests.set(key, recent);
if (recent.length > this.config.limit) {
throw new HttpException('Too many requests', 429);
}
return true;
}
}
// Usage
@Controller('users')
@UseGuards(RolesGuard)
export class UserController {
@Post()
@Roles('admin')From j4flmao/agent-skills, MIT.
More from j4flmao/agent-skills
- 0.610score
elysia-patterns
j4flmao
Use this skill when implementing Elysia.js patterns — Eden Treaty client, WebSocket handlers, auth/guard macros, custom plugins, performance optimization, and…
SkillBFreshness: B★ 34Claude Code +9 - 0.610score
dotnet-patterns
j4flmao
Use this skill when implementing .NET patterns — MediatR pipelines, CQRS, Result pattern, EF Core patterns, pipeline behaviors, and event sourcing.
SkillBFreshness: B★ 34Claude Code +9 - 0.607score
llm-finetuning
j4flmao
Best practices for dataset preparation and PEFT/LoRA fine-tuning.
SkillBFreshness: B★ 34Claude Code +9 - 0.607score
genai-vision
j4flmao
Integrating Stable Diffusion for vision generation and Whisper for audio/multimodal tasks.
SkillBFreshness: B★ 34Claude Code +9 - 0.605score
micronaut
j4flmao
Use this skill when building Micronaut applications — compile-time DI, reactive HTTP server, AOT optimization, GraalVM native image.
SkillBFreshness: B★ 34Claude Code +9 - 0.605score
bun
j4flmao
Use this skill when building with Bun runtime — Bun APIs, testing, package management, shell scripting, hot reload, SQLite, file I/O.
SkillBFreshness: B★ 34Claude Code +9 - 0.605score
elixir
j4flmao
Use this skill when building with Elixir — Phoenix framework, OTP, BEAM, LiveView, Ecto, supervision trees.
SkillBFreshness: B★ 34Claude Code +9 - 0.605score
deno
j4flmao
Use this skill when building with Deno — TypeScript runtime, Deno Deploy, Fresh framework, Deno std library.
SkillBFreshness: B★ 34Claude Code +9 - 0.601score
nestjs-architecture
j4flmao
Use this skill when structuring NestJS applications — module-based architecture, dependency injection, provider scopes, dynamic modules, and monorepo structure.
SkillBFreshness: B★ 34Claude Code +9 - 0.601score
kotlin-backend-patterns
j4flmao
Use this skill when implementing Kotlin backend patterns — repository pattern, service layer, DTO mapping, DI setup (Koin, Kodein), testing with MockK, and…
SkillBFreshness: B★ 34Claude Code +9 - 0.601score
kotlin-architecture
j4flmao
Use this skill when designing Kotlin backend architecture — Ktor, Spring WebFlux, http4k.
SkillBFreshness: B★ 34Claude Code +9 - 0.601score
nodejs-architecture
j4flmao
Use this skill when designing Node.js backend architecture — Express, Fastify, Hono.
SkillBFreshness: B★ 34Claude Code +9
Compare and alternatives
Featured in
Signals
- Stars
- 34
- Forks
- 4
- Open issues
- 0
- Last commit (this folder)
- Aug 15, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/j4flmao/agent-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from j4flmao
- 0.610score
dotnet-patterns
j4flmao
Use this skill when implementing .NET patterns — MediatR pipelines, CQRS, Result pattern, EF Core patterns, pipeline behaviors, and event sourcing.
SkillBFreshness: B★ 34Claude Code +9 - 0.610score
elysia-patterns
j4flmao
Use this skill when implementing Elysia.js patterns — Eden Treaty client, WebSocket handlers, auth/guard macros, custom plugins, performance optimization, and…
SkillBFreshness: B★ 34Claude Code +9 - 0.607score
genai-vision
j4flmao
Integrating Stable Diffusion for vision generation and Whisper for audio/multimodal tasks.
SkillBFreshness: B★ 34Claude Code +9 - 0.607score
llm-finetuning
j4flmao
Best practices for dataset preparation and PEFT/LoRA fine-tuning.
SkillBFreshness: B★ 34Claude Code +9 - 0.605score
bun
j4flmao
Use this skill when building with Bun runtime — Bun APIs, testing, package management, shell scripting, hot reload, SQLite, file I/O.
SkillBFreshness: B★ 34Claude Code +9 - 0.605score
deno
j4flmao
Use this skill when building with Deno — TypeScript runtime, Deno Deploy, Fresh framework, Deno std library.
SkillBFreshness: B★ 34Claude Code +9
Cite this page
nestjs-patterns skill. Agent Mart. https://agentmart.dev/skills/j4flmao-nestjs-patterns (last updated 2026-10-24)