К основному содержанию
скилл CX Codex

nestjs-architecture-principles — скилл для Claude Code

Скилл nestjs-architecture-principles для Claude Code помогает проектировать и разбирать архитектуру приложений на NestJS. Включается при планировании модулей, поиске циклических зависимостей и оценке CQRS или микросервисов.

MIT 592 установок ★ 26 обновлён 2026-11-14

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add amirtaherkhani/nestjs-skills --skill nestjs-architecture-principles -a claude-code
Открыть на GitHub

Что делает nestjs-architecture-principles

Скилл анализирует архитектуру NestJS-проекта и предлагает решения с учётом его ограничений. Он помогает выбрать границы модулей, направление зависимостей и разделение слоёв, а также оценить порты и адаптеры, Clean Architecture и DDD.

Перед изменениями скилл предлагает изучить конфигурацию, связанные модули, контракты и тесты. Базовый вариант — модульный монолит по бизнес-возможностям; CQRS добавляется, когда обработка команд и запросов действительно различается. forwardRef() рассматривается как крайний способ совместимости, а не стандартное решение циклических зависимостей.

Скилл предназначен для NestJS: для чистой фронтенд-разработки и бэкендов на других платформах он не подходит. Если архитектурное решение пересекается с другой активной инструкцией, перед изменением файлов нужно согласовать, кто отвечает за решение.

Какие задачи решает

  • спроектировать модули NestJS по бизнес-возможностям
  • найти причину циклических зависимостей между модулями
  • определить направление зависимостей и владение данными
  • оценить необходимость CQRS или выноса сервиса в микросервис

Примеры запросов агенту

  • Спланируй архитектуру нового проекта на NestJS с учётом его требований.
  • Разбери циклические зависимости между модулями и предложи границы.
  • Оцени, нужны ли этому NestJS-проекту CQRS или отдельные микросервисы.

Как установить nestjs-architecture-principles

1Через Skills CLI (Vercel)

npx skills add amirtaherkhani/nestjs-skills --skill nestjs-architecture-principles -a claude-code

2Вручную: положить файлы

~/.claude/skills/nestjs-architecture-principles/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/nestjs-architecture-principles/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о nestjs-architecture-principles

Как установить nestjs-architecture-principles в Claude Code?

Выполни npx skills add amirtaherkhani/nestjs-skills --skill nestjs-architecture-principles -a claude-code. Файл скилла появится по пути ~/.claude/skills/nestjs-architecture-principles/SKILL.md.

Что делает nestjs-architecture-principles?

Скилл помогает проектировать и проверять архитектуру NestJS: границы модулей, зависимости, слои и владение данными. Он также разбирает циклические зависимости и оценивает, оправданы ли CQRS или микросервисы.

Для каких проектов подходит nestjs-architecture-principles?

Для проектирования и анализа бэкендов на NestJS. Скилл не предназначен для чистой фронтенд-разработки и бэкендов не на NestJS.

Исходный текст

SKILL.md · MIT
---
name: nestjs-architecture-principles
description: 'Designs and reviews NestJS application architecture using cohesive feature modules, modular monoliths, layered or hexagonal boundaries, dependency inversion, and pragmatic engineering principles. Use when planning a NestJS project, changing module boundaries, evaluating Clean Architecture or DDD, resolving circular dependencies, defining ports and adapters, reviewing coupling, or deciding whether CQRS or microservices are justified. Do not use for pure frontend work or non-NestJS backends. When other skills also apply, reconcile ownership before mutation.'
license: MIT
metadata:
  author: amirtaherkhani
  version: '1.2.1'
---

# NestJS Architecture and Principles

Make architecture decisions from the repository's actual constraints. Prefer the least complex design that protects the required boundaries and can evolve safely.

## Pre-execution conflict guard

Before editing files or running any state-changing command, reconcile active instructions. Read-only inspection may continue.

### Prerequisites

Inspect repository instructions, installed versions, module wiring, contracts, callers, tests, and affected commands. Preserve user changes. Read other active skills only when their decisions overlap.

### Primary ownership

This skill owns architecture level, capability/module APIs, dependency direction, data/write and transaction boundaries, ports, and service extraction. When installed and relevant, coordinate with:

- `nestjs-oop-design-patterns`: object responsibilities, invariants, and patterns.
- `nestjs-features-performance`: lifecycle, API/security, testing, runtime, and performance.
- `nestjs-professional-software-engineering`: implementation and verification.
- `nestjs-code-audit`: read-only quality evidence and deduplicated reporting.
- `nestjs-feature-audit`: branch-specific roadmap gate and feature reporting.
- `nestjs-git-commit-pr-message`: authorized Git publication and CI follow-up.

These are decision boundaries, not required dependencies. Retain domain ownership when handing work to another workflow.

### Conflict test

Check for incompatible edits/contracts, command order or side effects, competing owners, and unmet version, evidence, authorization, or repository prerequisites. Resolve using explicit user intent, repository contracts, verified runtime constraints, then the narrowest owner. Assign one lead per decision; do not create parallel designs to satisfy incompatible advice. If a material conflict remains, stop before mutation and ask for the smallest missing decision. Audits stay read-only; explicit fix authorization applies in a distinct implementation phase.

## Start with evidence

Before recommending or changing architecture:

1. Read `package.json`, `nest-cli.json`, TypeScript configuration, bootstrap files, and the relevant modules.
2. Map the module import graph, provider exports, entry points, persistence ownership, transports, and existing tests.
3. Identify the business capability and the concrete change pressure: team ownership, independent scaling, volatile integrations, transaction boundaries, security, or delivery speed.
4. State the current architecture in one sentence. Do not label a project "Clean Architecture" or "DDD" from folder names alone.
5. Preserve healthy local conventions. Flag a convention only when it damages correctness, security, operability, or an explicit contract.

If the task is version-sensitive, verify the installed NestJS version and current official documentation before using an API or command.

## Choose the architecture level

Use the architecture ladder in [references/architecture-ladder.md](references/architecture-ladder.md).

Default direction:

- Start with a modular monolith organized by business capability.
- Add internal layers when domain logic or infrastructure volatility makes the boundary valuable.
- Add ports where the application needs to isolate a replaceable external concern.
- Add CQRS only when command and query behavior genuinely diverge.
- Split a service only when it has an independent deployment, ownership, scaling, data, or failure boundary.

Never introduce layers, buses, repositories, factories, or services only to make the folder tree resemble a diagram.

## Protect these boundaries

1. **Modules expose a small public API.** Providers are private unless another module has a real use for them.
2. **A business capability owns its invariants and writes.** Other modules collaborate through an exported application service, port, event, or deliberately designed read model.
3. **Dependencies point toward policy.** Domain code does not import NestJS, an ORM, HTTP types, queue jobs, or vendor SDKs.
4. **Controllers and transport handlers adapt.** They authenticate/authorize through framework mechanisms, validate transport input, invoke an application operation, and map the result.
5. **Application operations coordinate.** They define use-case flow and transaction intent without absorbing persistence or transport details.
6. **Infrastructure implements edges.** ORMs, brokers, caches, file systems, and external APIs stay behind explicit boundaries when their volatility or test cost warrants it.
7. **Cycles are design feedback.** Treat `forwardRef()` as a last-resort compatibility tool, not the default fix.
8. **The composition root owns wiring.** Nest modules and providers assemble implementations; business objects do not locate dependencies at runtime.

For the consolidated rule set, load [references/architecture-rules.md](references/architecture-rules.md). For detailed NestJS boundaries, load [references/module-boundaries.md](references/module-boundaries.md) and [references/dependency-injection.md](references/dependency-injection.md).

## Apply principles pragmatically

Use [references/engineering-principles.md](references/engineering-principles.md) as decision tests, not slogans.

When principles conflict, prefer this order:

1. correctness, security, and data integrity;
2. explicit external contracts and backward compatibility;
3. operability and failure containment;
4. established repository conventions;
5. design purity and local elegance.

KISS does not mean hiding failure cases. DRY does not mean abstracting coincidental similarity. SOLID does not require one class per verb. YAGNI does not excuse a boundary already demanded by a known requirement.

## Workflow

### For a new design

1. Define goals, constraints, non-goals, critical quality attributes, and expected change axes.
2. Choose the lowest architecture level that satisfies them.
3. Name capabilities and ownership before naming technical layers.
4. Draw dependencies and data ownership. Reject ambiguous write ownership.
5. Specify synchronous calls, events, transactions, and failure behavior.
6. Produce one recommended design and explain what it intentionally does not optimize.
7. Define architecture tests, integration tests, and operational checks that protect the decision.

### For an implementation or refactor

1. Trace the relevant request, message, or job end to end.
2. Identify the smallest boundary violation that causes the problem.
3. Move behavior toward its owner before adding an abstraction.
4. Introduce a port only if there are multiple implementations, a volatile edge, or a valuable test seam.
5. Keep the change incremental and preserve the public contract unless the user requested a migration.
6. Update affected tests, module wiring, documentation, and callers.

### For a review

Use [references/architecture-review.md](references/architecture-review.md). Report evidence-backed findings with severity, impact, a minimal remedy, and a validation step. Do not propose a rewrite when a boundary repair is sufficient.

## Reference routing

For consumer promises and executable wiring/behavior controls, see [module-contracts.md](references/module-contracts.md).

| Task | Load |
| --- | --- |
| Apply or review the consolidated architecture rules | [architecture-rules.md](references/architecture-rules.md) |
| Choose modular monolith, layers, hexagonal, CQRS, or services | [architecture-ladder.md](references/architecture-ladder.md) |
| Design feature modules, exports, ownership, or remove cycles | [module-boundaries.md](references/module-boundaries.md) |
| Define provider tokens, ports, scopes, factories, or dynamic modules | [dependency-injection.md](references/dependency-injection.md) |
| Define database ownership, repositories, migrations, transactions, or ORM boundaries | [database-orm.md](references/database-orm.md) |
| Decide service extraction, distributed data ownership, contracts, or messaging semantics | [microservices.md](references/microservices.md) |
| Apply KISS, YAGNI, DRY, cohesion, coupling, and dependency rules | [engineering-principles.md](references/engineering-principles.md) |
| Audit a repository or plan an incremental migration | [architecture-review.md](references/architecture-review.md) |

## Expected response

For architecture work, make the result easy to evaluate:

- **Baseline:** current architecture and evidence.
- **Decision:** one recommended direction.
- **Why:** constraints and trade-offs that drive it.
- **Boundaries:** module ownership, dependency direction, data ownership, and integration style.
- **Migration:** smallest safe sequence, when change is needed.
- **Validation:** tests, graph checks, runtime checks, and operational signals.

If no architecture change is justified, say so directly.

© amirtaherkhani · MIT · amirtaherkhani/nestjs-skills

Похожие скиллы

Все скиллы по теме «Бэкенд и API» →
nestjs-modular-monolith Felipe Rodrigues - github.com/felipfr Скилл nestjs-modular-monolith ведёт от анализа домена до кода: границы модулей, DDD, Clean Architecture и CQRS в одном бэкенде на NestJS. CX Codex +1 353установок nestjs-hexagonal Softtor Плагин nestjs-hexagonal для проектирования NestJS-приложений по принципам Hexagonal Architecture, DDD и CQRS. Содержит скиллы для каждого слоя, агентов на Opus и Sonnet, проверку кода и workflow TDD. ★ 5звёзд репо evolutionary-modular-architecture Felipe Rodrigues - github.com/felipfr Скилл evolutionary-modular-architecture помогает спроектировать бэкенд как модульный монолит: границы по DDD, папки по агрегатам, ACL вокруг внешних систем и устойчивые вызовы. CX Codex +1 ★ 7 191звёзд репо nestjs-best-practices Kadajett Скилл nestjs-best-practices для Claude Code помогает писать, проверять и рефакторить код NestJS. Он подключается к задачам по архитектуре, безопасности и производительности. CX Codex +1 32 000установок architecture-modernizer davila7 Субагент architecture-modernizer для Claude Code проектирует разбиение монолита, микросервисы и событийные потоки. Вызывайте его для анализа границ модулей и планирования модернизации архитектуры. CX Codex 1 768установок nestjs-patterns affaan-m Скилл nestjs-patterns задаёт архитектурные правила для бэкендов на NestJS и TypeScript: от структуры каталогов до валидации DTO и тестов. CX Codex +1 6 900установок

Из того же набора7

nestjs-oop-design-patterns Скилл nestjs-oop-design-patterns для Claude Code помогает применять ООП, SOLID и паттерны проектирования в NestJS и TypeScript. Подключается при написании и рефакторинге кода или поиске проблем в объектной модели. CX Codex +1 560установок nestjs-professional-software-engineering Скилл nestjs-professional-software-engineering для Claude Code и Cursor проектирует, реализует, рефакторит и проверяет код на NestJS и TypeScript. Запускается при разработке новых функций, исправлении багов и написании тестов. CX Codex +1 556установок nestjs-features-performance Скилл nestjs-features-performance для Claude Code помогает выбирать и внедрять функции NestJS для API, безопасности, тестирования и производительности. CX Codex +1 550установок nestjs-code-audit Скилл nestjs-code-audit для Claude Code и Codex проводит аудит репозитория на NestJS и формирует единый отчёт с проверенными проблемами. Запускается в режиме только для чтения без изменения кода проекта. CX Codex +1 515установок nestjs-feature-audit Скилл nestjs-feature-audit для Claude Code сверяет реализацию функции NestJS с дорожной картой и готовит отчёт с подтверждениями. Запускается по запросу проверить полноту функции, статус миграции или расхождения с планом. CX Codex +1 454установок nestjs-git-commit-pr-message Скилл nestjs-git-commit-pr-message для Claude Code готовит изменения NestJS-проекта к коммиту, push или pull request. Запускается по просьбе подготовить Git-сообщение, опубликовать изменения или проверить результат CI. CX Codex +1 410установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой