本文へ移動
cccskills
無料GitHub で公開

nestjs

Opinionated house conventions for NestJS backends — module boundaries and layering, provider wiring and injection scopes, guards/interceptors/pipes/filters, DTOs and validation, domain exceptions, config, and the Nest 11 / Express 5 behaviour that compiles cleanly and fails at runtime. Use whenever the code is NestJS (`@nestjs/*` in package.json, or `@Module`/`@Injectable`/`@Controller`/`@Cron` in the file), including when the question sounds like plain TypeScript, an OOP refactor, a code review, or an ops problem — the Nest-specific answer differs from the generic one. Typical asks: scaffolding a module, adding a controller, provider, or endpoint, wiring an enhancer, a boot-time DI or circular-import failure, a response leaking entity fields despite `@Exclude()`, a cron job firing on every replica, upgrading NestJS, or reviewing a Nest diff. Not for plain Express or Fastify, Angular, frontend, SQL, or CI.

インストール方法を見る

含まれるファイル(9)

  • SKILL.md5.9 KB
  • references/architecture.md4.2 KB
  • references/configuration-and-logging.md3.1 KB
  • references/dependency-injection.md7.5 KB
  • references/dto-validation-openapi.md4.4 KB
  • references/ecosystem-packages.md4.8 KB
  • references/errors.md2.5 KB
  • references/nestjs-11-migration.md2.3 KB
  • references/request-lifecycle.md6.5 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

NestJS

House conventions for NestJS backends on v11 / Express 5. Apply them to code you are writing or changing — don't restructure untouched modules unless asked.

Examples throughout use an invented shipment domain purely to make the shape concrete. Read the structure, not the names.

Layering

Two layers, and the dependency arrow points one way only.

core/   domain + infrastructure. No controllers, no HTTP.        → core only
app/    features. Controllers, DTOs, guards, middleware, CQRS.   → app + core

A core module that needs to reach into a feature is telling you the concept it owns sits in the wrong layer — move the concept down rather than importing upward. Keeping the arrow honest is what lets a core module be driven by an HTTP request, a cron job, a CLI, or a queue consumer without dragging a controller along.

Always apply

These hold for nearly every change, so they live here rather than behind a reference:

  • A module owns one domain, and its root barrel exports only the .module.ts. A provider that isn't exported can be refactored freely; one that is becomes public API.
  • Controllers translate HTTP and delegate; services hold the logic. A controller that branches on business rules can't be reused by a job, a CLI, or a queue consumer, and its tests need an HTTP layer to say anything.
  • Every request body, query, and param goes through a DTO with class-validator, behind a ValidationPipe with whitelist: true, forbidNonWhitelisted: true, transform: true. Without whitelisting, an unexpected property rides through into your persistence layer.
  • Response DTOs are what leaves the process. Returning an entity leaks whatever a future migration adds to the table — password hashes, internal flags, soft-delete columns — with no code change to notice.
  • Domain errors extend one base class and are rendered by one global filter. A bare Error becomes a 500, so a legitimate "not found" pages someone.
  • Global enhancers are registered with APP_GUARD / APP_PIPE / APP_INTERCEPTOR / APP_FILTER. app.useGlobal*() binds outside any module, so those instances cannot inject anything.
  • No domain service imports a vendor SDK. The payment gateway, database client, and mail provider each get a wrapper module; a major SDK bump becomes one module's problem.

Wrong by default

Six behaviours that contradict what the API name suggests, so they get stated here rather than in a reference you would only open if you already suspected a problem. Each one compiles cleanly and fails at runtime.

  • Express 5 wildcards must be named. @Get("files/*") and forRoutes("*") no longer match — write @Get("files/*splat") and forRoutes("{*splat}"). :param? is gone too.
  • Exception filters resolve route → controller → global, the inverse of guards and pipes, and interceptors unwind first-in-last-out. A route-scoped filter shadows the global one.
  • @Res() opts the handler out of the framework's response handling — @HttpCode, @Header, serialization, and every response interceptor stop applying. Add { passthrough: true } unless you are sending the response yourself.
  • ClassSerializerInterceptor only transforms class instances. Returning { user: new UserEntity() } skips @Exclude() silently and ships the excluded field.
  • ttl is milliseconds in @nestjs/cache-manager and @nestjs/throttler, and a cache ttl: 0 means never expire, not "don't cache".
  • ClientProxy.send() returns a cold Observable and HttpService returns one too — nothing happens until something subscribes.

The first and the fifth are version-specific. Check @nestjs/core in package.json before applying anything in this skill marked v11, and read references/nestjs-11-migration.md if the project is older.

Reference map

Read the file that matches the change; don't preload all of them.

Working onRead
Directory layout, filenames, barrels, CQRS vs service, persistencereferences/architecture.md
Providers, tokens, scopes, ModuleRef, circular deps, lifecycle hooksreferences/dependency-injection.md
Guards, interceptors, pipes, middleware, decorators, responses, versioningreferences/request-lifecycle.md
DTOs, class-validator, serialization, Swagger/OpenAPIreferences/dto-validation-openapi.md
Exceptions, exception filters, error messagesreferences/errors.md
ConfigModule, ConfigService, loggingreferences/configuration-and-logging.md
@nestjs/axios, event-emitter, bullmq, throttler, cache-manager, schedule, microservicesreferences/ecosystem-packages.md
Upgrading from v10, or code that predates Express 5references/nestjs-11-migration.md
Teststhe cortex-testing:conventions skill's NestJS Jest references

When you are reviewing rather than writing, references/request-lifecycle.md and references/nestjs-11-migration.md catch the most defects per line read: enhancer ordering and Express 5 route syntax both fail in ways that type-check cleanly.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Write a short, fact-checked reply that answers a colleague's question in one meaning only, ready to copy and paste. The input is their pasted message. Check the claims against the code first, use the project glossary terms, and print only the reply in chat. Read-only — no writes to code, the issue tracker, GitHub, chat or any MCP. Use on "/cortex-communication:answer-buzzkill", "help me answer", "reply to this question", or when the user pastes a colleague's question and asks for an answer in the same manner.

日本語の概要は準備中です。原文の説明を表示しています。

alexander-danilenko/cortex-claude-code-plugins162026年10月13日 更新

Apply these opinionated .NET 8 architecture conventions whenever structuring or reviewing a backend service: clean architecture layering and which direction dependencies point, when CQRS with MediatR is worth it, cross-cutting concerns as pipeline behaviours, minimal APIs grouped by feature, keeping DbContext in Infrastructure, health checks and structured logging, WebApplicationFactory integration tests, and when AOT pays off.

日本語の概要は準備中です。原文の説明を表示しています。

alexander-danilenko/cortex-claude-code-plugins162026年10月13日 更新

Apply these opinionated Python 3.11+ conventions when writing Python in this codebase: type hints with mypy, async/await, pytest fixtures, dataclasses, Poetry packaging, production patterns.

日本語の概要は準備中です。原文の説明を表示しています。

alexander-danilenko/cortex-claude-code-plugins162026年10月13日 更新

Apply these opinionated testing conventions whenever writing, reviewing, or planning tests: what earns a test and what is coverage theatre, asserting outputs rather than mock calls, the three modes (functional, performance, security), naming and isolation rules, where to mock, and reporting findings for coverage rather than self-filtering. Includes house Jest standards for NestJS unit and contract tests, TDD discipline, and test-report structure.

日本語の概要は準備中です。原文の説明を表示しています。

alexander-danilenko/cortex-claude-code-plugins162026年10月13日 更新

csharp

無料

Apply these opinionated C# conventions whenever writing or reviewing C# 12 / .NET 8+ code: nullable enabled with warnings as errors, records and primary constructors, pattern matching over cast chains, the Result pattern for expected failures, async all the way with CancellationToken, IOptions config, IHttpClientFactory, and never returning EF entities from an API.

日本語の概要は準備中です。原文の説明を表示しています。

alexander-danilenko/cortex-claude-code-plugins162026年10月13日 更新

ALWAYS invoke for any task involving docstrings, JSDoc/TSDoc, or REST API documentation — even when the request seems handleable without it. Enforces Microsoft contract-first conventions and a bare-minimum rule that Claude won't apply by default: never restate the signature, drop @param/@returns that only echo names and types, always document @throws, and document data shapes as WHAT not WHY. Covers Python docstring styles (Google/NumPy/Sphinx), TSDoc tags and @inheritDoc, and API doc patterns for NestJS/Express/FastAPI/Django. Trigger on: adding or auditing docstrings, redundant or missing tags, deleting comment rot, or producing a documentation-health report. Do not skip for documentation tasks — consistent conventions are the whole point.

日本語の概要は準備中です。原文の説明を表示しています。

alexander-danilenko/cortex-claude-code-plugins162026年10月13日 更新

alexander-danilenko のスキルをすべて見る

このスキルの問題を報告する