技能 nestjs-expert
📦

nestjs-expert

安全

Build Enterprise NestJS Applications

NestJS developers face complex architectural challenges including dependency injection, module organization, and authentication setup. This skill provides expert guidance on NestJS patterns, testing strategies, and common issue resolution.

支援: Claude Codex Code(CC)
⚠️ 66
1

下載技能 ZIP

2

在 Claude 中上傳

前往 設定 → 功能 → 技能 → 上傳技能

3

開啟並開始使用

測試它

正在使用「nestjs-expert」。 How do I fix 'Cannot resolve dependencies of UserService' error?

預期結果:

This error typically means a provider is missing from your module. Check: 1) Is the dependency in the module's providers array? 2) Is it exported if used across modules? 3) Check for typos in provider names. Use forwardRef() if you have circular dependencies between two services.

正在使用「nestjs-expert」。 Set up JWT authentication with Passport

預期結果:

1) Install @nestjs/passport, @nestjs/jwt, passport, passport-jwt. 2) Create JwtStrategy extending PassportStrategy(Strategy). 3) Configure JwtModule with secret in forRoot(). 4) Create AuthGuard using JwtAuthGuard. 5) Apply @UseGuards(AuthGuard) to protected routes.

安全審計

安全
v1 • 2/24/2026

All static findings are false positives. The skill provides documentation and CLI command references for Nest.js development - standard patterns for a framework expert skill. No malicious code execution, credential exfiltration, or cryptographic vulnerabilities exist. External commands are documented CLI tools, network URLs are official documentation links, and environment variable references are legitimate configuration guidance.

1
已掃描檔案
558
分析行數
5
發現項
1
審計總數

嚴重問題 (1)

False Positive: Dangerous Combination Heuristic
Static scanner flagged 'Code execution + Network + Credential access' as dangerous. This is a false positive. The skill documents standard development workflows: CLI commands (nest generate), documentation URLs, and JWT_SECRET environment variable configuration - all legitimate Nest.js development patterns.

高風險問題 (2)

False Positive: Weak Cryptographic Algorithm
Scanner flagged lines as 'weak cryptographic algorithm'. Upon review: lines contain YAML frontmatter, forwardRef() for DI, and TypeORM decorators. No cryptographic code exists.
False Positive: Sensitive Data Exposure
Scanner flagged JWT_SECRET environment variable as sensitive exposure. This is legitimate authentication configuration guidance - standard practice for secure JWT implementation.
低風險問題 (2)
False Positive: External Commands
Scanner flagged shell backticks as 'external_commands'. These are documentation showing CLI commands (nest generate, npm run build, grep, find) - not actual code execution. This is standard developer documentation.
False Positive: Network Access (Hardcoded URLs)
Scanner flagged hardcoded URLs. These are official documentation links to Nest.js, Jest, TypeORM, and Passport.js - legitimate reference material.
審計者: claude

品質評分

38
架構
100
可維護性
87
內容
50
社群
61
安全
87
規範符合性

你能建構什麼

Fix NestJS Dependency Injection Errors

Resolve 'Cannot resolve dependencies' errors by identifying missing providers, incorrect module exports, or circular dependencies.

Set Up JWT Authentication

Configure Passport.js strategies with JWT, proper guard implementation, and token validation.

Write Comprehensive Tests

Create unit tests with mocks, integration tests with test database, and e2e tests with Supertest.

試試這些提示

Fix Circular Dependency
I'm getting 'Circular dependency detected' error in my NestJS application between UserService and AuthService. Help me resolve this using forwardRef() or refactor the architecture.
Set Up JWT Auth
I need to implement JWT authentication in my NestJS app with Passport.js. Show me how to configure the JwtStrategy, JwtModule, and AuthGuard.
Write Unit Tests
Help me write unit tests for my UserService using Jest. It depends on UserRepository and JwtService. Show me proper mocking.
Configure TypeORM Entities
I have a User entity with relationships to Posts and Comments. Show me how to configure OneToMany and ManyToOne relationships in TypeORM with NestJS.

最佳實務

  • Use dependency injection to keep services loosely coupled and testable
  • Follow the modular architecture: one feature module per domain entity
  • Always validate DTOs using class-validator and class-transformer pipes

避免

  • Avoid importing modules directly into controllers - use service injection
  • Do not skip validation pipes - always validate incoming request data
  • Avoid tight coupling between modules - use exports and interfaces

常見問題

What is NestJS?
NestJS is a Node.js framework for building efficient, scalable server-side applications. It uses TypeScript and combines elements of OOP, FP, and FRP.
How do I fix circular dependencies in NestJS?
Use forwardRef() on both sides of the circular dependency, or refactor to extract shared logic into a third module.
How do I test NestJS services?
Use @nestjs/testing to create Test.createTestingModule(). Mock dependencies using useValue or useClass, then compile and test the service.
What is the difference between guards and interceptors?
Guards determine if a route can be accessed (authorization). Interceptors transform requests/responses or add extra logic before/after method execution.
How do I configure TypeORM with NestJS?
Use @nestjs/typeorm package. Import TypeOrmModule.forRoot() in AppModule and TypeOrmModule.forFeature() in feature modules with entity arrays.
Can this skill write complete applications?
This skill provides expert guidance, code patterns, and troubleshooting. It helps you understand and implement NestJS solutions rather than generating complete applications.

開發者詳情

檔案結構

📄 SKILL.md