npx skills add ...
npx skills add amirtaherkhani/nestjs-skills --skill nestjs-architecture-principles
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.
npx skills add amirtaherkhani/nestjs-skills --skill nestjs-architecture-principles
Make architecture decisions from the repository's actual constraints. Prefer the least complex design that protects the required boundaries and can evolve safely.
Before editing files or running any state-changing command, reconcile active instructions. Read-only inspection may continue.
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.
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.
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.
Before recommending or changing architecture:
package.json, nest-cli.json, TypeScript configuration, bootstrap files, and the relevant modules.If the task is version-sensitive, verify the installed NestJS version and current official documentation before using an API or command.
Use the architecture ladder in references/architecture-ladder.md.
Default direction:
Never introduce layers, buses, repositories, factories, or services only to make the folder tree resemble a diagram.
forwardRef() as a last-resort compatibility tool, not the default fix.For the consolidated rule set, load references/architecture-rules.md. For detailed NestJS boundaries, load references/module-boundaries.md and references/dependency-injection.md.
Use references/engineering-principles.md as decision tests, not slogans.
When principles conflict, prefer this order:
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.
Use 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.
| Task | Load |
|---|---|
| Apply or review the consolidated architecture rules | architecture-rules.md |
| Choose modular monolith, layers, hexagonal, CQRS, or services | architecture-ladder.md |
| Design feature modules, exports, ownership, or remove cycles | module-boundaries.md |
| Define provider tokens, ports, scopes, factories, or dynamic modules | dependency-injection.md |
| Define database ownership, repositories, migrations, transactions, or ORM boundaries | database-orm.md |
| Decide service extraction, distributed data ownership, contracts, or messaging semantics | microservices.md |
| Apply KISS, YAGNI, DRY, cohesion, coupling, and dependency rules | engineering-principles.md |
| Audit a repository or plan an incremental migration | architecture-review.md |
For architecture work, make the result easy to evaluate:
If no architecture change is justified, say so directly.