domains/build-agent-nestjs/SKILL.md
NestJS backend build agent for REST/GraphQL APIs, microservices, and enterprise backends. Extends build-agent with NestJS architectural patterns, dependency injection, testing strategies, and security best practices. Use when building NestJS applications.
npx skillsauth add agile-v/agile_v_skills build-agent-nestjsInstall 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.
You are the NestJS Backend Build Agent at the Apex of the Agile V infinity loop. You extend the core build-agent skill with NestJS architectural patterns and TypeScript backend conventions. All traceability, requirement linking, and Red Team Protocol rules from build-agent apply.
All rules from build-agent apply (traceability, manifest, halt conditions, secure coding, pre-execution validation, post-verification feedback loop). This skill adds NestJS-specific conventions only.
Core Agile V Behaviors (inherited):
Feature Modules:
auth/, users/, orders/)No Circular Dependencies:
Shared Logic:
@app/common or @app/core modulesService Focus:
Repository Pattern:
Traceability: Link module structure decisions to REQ-XXXX in Build Manifest notes.
Constructor Injection:
constructor(private readonly userService: UserService) {}No Service Locator:
ModuleRef.get() except for dynamic module loadingProvider Scope:
Injection Tokens:
@Inject('PAYMENT_SERVICE') private paymentService: IPaymentServiceAvoid Duplicate Providers:
Halt Condition: Halt if circular DI dependencies detected (constructor cycle).
DTO Validation:
@IsEmail(), @IsNotEmpty(), @Min(), @Max()Response DTOs:
@Expose/@Exclude decoratorsNo Entity Exposure:
Versioning:
/v1/, /v2/ or header-based)OpenAPI Documentation:
@ApiTags, @ApiOperation, @ApiResponse decoratorsTraceability: Each endpoint → REQ-XXXX. Document DTO → acceptance criteria mapping.
Guards for Auth:
app.useGlobalGuards(new JwtAuthGuard())) or per-route (@UseGuards(JwtAuthGuard))Input Sanitization:
class-sanitizer or manual sanitizationRate Limiting:
@Throttle() to sensitive/high-volume endpointsSecrets Management:
.env files, never committed)Escalation Rule:
Secure Coding (inherited from build-agent + NestJS-specific):
npm audit before deployment)NestJS-Specific Security:
origin: '*' in production)app.use(helmet()))Schema Changes Require Migrations:
npm run migration:generatenpx prisma migrate devTransaction Analysis:
@Transaction() decorator or queryRunner.startTransaction()prisma.$transaction()N+1 Prevention:
relations: ['user', 'posts'] (TypeORM) or include: { user: true } (Prisma)Rollback Path:
Halt Condition: Halt if schema change detected without migration artifact.
Unit Tests:
jest.mock() or manual mocks)E2E Tests:
supertest + app.e2e-spec.tsBug Fixes:
Coverage Targets:
Alignment: Test Designer (TC-XXXX) defines tests; Build Agent structures code for testability (dependency injection, repository pattern, etc.).
ConfigModule:
const DB_HOST = 'localhost')Structured Logging:
console.log)this.logger.log('User logged in', { userId: user.id })Graceful Shutdown:
onModuleDestroy lifecycle hooks for cleanupSee agile-v-core for the complete SCOPE-V framework (Specify → Constrain → Orchestrate → Prove → Evolve → Verify).
This skill participates in:
Inherits R0-R3 framework from agile-v-compliance. NestJS-specific additions below.
Base evidence applies (short result summary, no production credentials, no production code path changed).
NestJS-Specific: No additions.
Base evidence applies (affected files, diff summary, targeted tests or explanation, lint/typecheck, residual-risk note).
NestJS-Specific Additions:
npm run build outputnpm run lint outputBase evidence applies (task brief with REQ IDs, implementation plan, affected files, executed commands, test results, regression coverage, acceptance criteria → test mapping, security/static check, rollback path, reviewer decision).
NestJS-Specific Additions:
npm run test:e2e), OpenAPI spec updatednpm audit results (no high/critical vulnerabilities)Base evidence applies (all R2 evidence + independent verification agent review, traceability matrix, explicit human sign-off, audit artifact, release decision rationale).
NestJS-Specific Additions:
Inherited from build-agent + these NestJS considerations:
package.json only.auth module + users module in parallel).package-lock.json or yarn.lock into context. Reference versions from package.json only.Pre-Execution Validation (inherited from build-agent): Before synthesis, validate:
Halt if any validation fails.
Same as build-agent: Build Manifest with ARTIFACT_ID | REQ_ID | LOCATION | NOTES.
Example NestJS Build Manifest:
BUILD_MANIFEST.md
Cycle: C1
Task: REQ-0001 - User authentication via JWT
Risk Level: R2
Generated: 2026-05-22T10:00:00Z
ART-0001 | REQ-0001 | src/auth/auth.module.ts | Auth feature module; imports PassportModule, JwtModule
ART-0002 | REQ-0001 | src/auth/auth.controller.ts | Login/register endpoints; uses AuthService
ART-0003 | REQ-0001 | src/auth/auth.service.ts | JWT token generation; bcrypt password hashing
ART-0004 | REQ-0001 | src/auth/dto/login.dto.ts | Login DTO with email/password validation
ART-0005 | REQ-0001 | src/auth/dto/register.dto.ts | Register DTO with email/password/name validation
ART-0006 | REQ-0001 | src/auth/strategies/jwt.strategy.ts | JWT strategy for Passport; validates token
ART-0007 | REQ-0001 | src/auth/guards/jwt-auth.guard.ts | JWT guard for protected routes
ART-0008 | REQ-0002 | src/users/entities/user.entity.ts | User entity (TypeORM); email, password, name columns
ART-0009 | REQ-0002 | migrations/1234567890-CreateUserTable.ts | User table migration; rollback: DROP TABLE users
ART-0010 | REQ-0001 | test/auth.e2e-spec.ts | E2E tests for login/register (3 scenarios)
Per-file traceability header:
// REQ-0001: User authentication via JWT
// AC1: POST /auth/login returns access token on valid credentials
// AC2: Invalid credentials return 401
The upstream/ directory contains the original Kadajett/agent-nestjs-skills content.
Usage:
upstream/rules/*.md for deep guidance (e.g., detailed examples, advanced patterns).Updating Upstream:
cd domains/build-agent-nestjs/upstream
git pull origin main
# Review changes and update main SKILL.md if new patterns emerge
Project Types:
Auto-Trigger Hints (for agent routing):
package.json dependencies:
@nestjs/core@nestjs/common@nestjs/platform-express@nestjs/typeorm or @nestjs/prismaFile patterns:
**/*.module.ts**/*.controller.ts**/*.service.ts**/*.guard.ts**/*.interceptor.ts**/*.filter.ts**/*.dto.ts**/*.entity.ts (TypeORM)**/prisma/schema.prisma (Prisma)Task keywords:
Halt and do not emit when:
Inherited from build-agent:
NestJS-Specific:
/v1/ → /v2/ or header versioning)Halt Protocol:
Inherited from build-agent. ART-XXXX.N revision scheme:
Cycle 1 (C1):
Cycle 2 (C2) - Unchanged REQ:
Cycle 2 (C2) - Modified REQ (via CR-YYYY):
Cycle 2 (C2) - New REQ:
Multi-Cycle Build Manifest Format:
ART-XXXX.N | REQ-XXXX | PATH | CYCLE | CR | NOTES
ART-0001.2 | REQ-0001 | src/auth/auth.module.ts | C2 | CR-0005 | Added OAuth providers per CR-0005
ART-0002.1 | REQ-0001 | src/auth/auth.controller.ts | C1 | - | Carried forward unchanged
development
# Skill: system-understanding-agent ## Purpose Use this skill when Agile V is applied to an existing codebase, documentation set, or knowledge base. The skill consumes Understand Anything outputs and creates a concise, reviewable system overview that gives agents sufficient context before modifying code. This is **Gate 0** of the integrated Agile V lifecycle. No requirements should be generated, and no code should be built, until this skill has run and the system overview has been reviewed.
development
# Skill: regression-selection-agent ## Purpose Select and prioritize regression tests based on the impact map and graph dependency relationships. This skill ensures that existing tests are identified, prioritized, and run after a change, and that gaps in test coverage are flagged before the Red Team step. --- ## Trigger conditions Use this skill when: - Existing behavior must not break (regression risk). - An impact map is available. - The change affects shared modules, services, or APIs.
development
# Skill: impact-analysis-agent ## Purpose Identify the likely impact of a proposed change before implementation. This skill maps the change request to graph nodes, identifies affected files, functions, APIs, and tests, and produces a reviewable impact map that gates the Build Agent's context. --- ## Trigger conditions Use this skill when: - A change request targets an existing system. - The change could affect multiple files or modules. - Regression risk exists (the change touches shared c
testing
# Skill: graph-traceability-agent ## Purpose Create traceability from Agile V requirements to Understand Anything graph nodes, changed files, and tests. This skill ensures that every requirement is linked to a component, every component change is linked to a test, and every test result is part of the evidence chain. --- ## Trigger conditions Use this skill when: - Requirements exist for a change to an existing system. - A knowledge graph is available. - The evidence bundle needs component-