Nestjs best practices

From Asymmetric-al/core · View interactive version

Nestjs best practices is an AI agent skill from the GitHub repository Asymmetric-al/core. NestJS best practices and architecture patterns for building production-ready applications. This skill should be used when writing, reviewing, or refactoring NestJS code to ensure proper patterns for modules, dependency injection, security, and performance.

How to use this skill

Skill file

NestJS Best Practices

<!-- CORE-OVERLAY-START -->

This repository (Asymmetric-al/core)

These repo-owned sections are intentionally kept on top of the vendored NestJS

skill. If upstream refreshes replace this file, reconcile this overlay

before running bun run skills:sync. Core is a Bun + Next.js monorepo, not a NestJS application. Do not introduce NestJS modules, controllers, TypeORM, or

a Nest runtime into this repository.

Triggers

Workflow

  1. Confirm the files under edit are actually NestJS, not Core Next.js / packages/api.
  2. Prefer docs/ai/rules/backend.md and the data-access boundary for product work.
  3. Use this skill only as NestJS reference; do not restyle Core around NestJS examples.

Checklist

<!-- CORE-OVERLAY-END -->

Comprehensive best practices guide for NestJS applications. Contains 40 rules across 10 categories, prioritized by impact to guide automated refactoring and code generation.

When to Apply

Reference these guidelines when:

Rule Categories by Priority

| Priority | Category | Impact | Prefix |

| -------- | -------------------- | ----------- | ----------- |

| 1 | Architecture | CRITICAL | arch- |

| 2 | Dependency Injection | CRITICAL | di- |

| 3 | Error Handling | HIGH | error- |

| 4 | Security | HIGH | security- |

| 5 | Performance | HIGH | perf- |

| 6 | Testing | MEDIUM-HIGH | test- |

| 7 | Database & ORM | MEDIUM-HIGH | db- |

| 8 | API Design | MEDIUM | api- |

| 9 | Microservices | MEDIUM | micro- |

| 10 | DevOps & Deployment | LOW-MEDIUM | devops- |

Quick Reference

1. Architecture (CRITICAL)

2. Dependency Injection (CRITICAL)

3. Error Handling (HIGH)

4. Security (HIGH)

5. Performance (HIGH)

6. Testing (MEDIUM-HIGH)

7. Database & ORM (MEDIUM-HIGH)

8. API Design (MEDIUM)

9. Microservices (MEDIUM)

10. DevOps & Deployment (LOW-MEDIUM)

How to Use

Read individual rule files for detailed explanations and code examples:

rules/arch-avoid-circular-deps.md
rules/security-validate-all-input.md
rules/_sections.md

Each rule file contains:

Full Compiled Document

For the complete guide with all rules expanded in a single document, see

AGENTS.md in the repository.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.