This project offers a comprehensive skillset for mastering NestJS best practices. Containing 37 rules across 10 categories, it provides AI agents with deep insights into architecture patterns, anti-patterns, and production-ready code examples, empowering developers to enhance their NestJS applications effectively.
NestJS Best Practices Skill
The NestJS Best Practices Skill is an essential tool designed to empower AI agents with comprehensive knowledge of best practices in NestJS development. This skillset offers a detailed guide on the optimal use of NestJS by covering various patterns, anti-patterns, and providing production-ready code examples.
Overview
The skill includes 37 rules categorized into 10 different sections, addressing crucial aspects from architectural patterns to deployment strategies. Each rule is meticulously structured with the following components:
- Impact Assessment: Classified by severity (CRITICAL, HIGH, MEDIUM-HIGH, MEDIUM, LOW-MEDIUM)
- Incorrect Code Examples: Demonstrating common anti-patterns
- Correct Code Examples: Offering explanations of best practices
- References: Links to official documentation for further reading
Categories Covered
| Section | Category | Impact | Rules |
|---|---|---|---|
| 1 | Architecture | CRITICAL | 5 |
| 2 | Dependency Injection | CRITICAL | 4 |
| 3 | Error Handling | HIGH | 3 |
| 4 | Security | HIGH | 5 |
| 5 | Performance | HIGH | 4 |
| 6 | Testing | MEDIUM-HIGH | 3 |
| 7 | Database & ORM | MEDIUM-HIGH | 3 |
| 8 | API Design | MEDIUM | 4 |
| 9 | Microservices | MEDIUM | 3 |
| 10 | DevOps & Deployment | LOW-MEDIUM | 3 |
Structure of the Repository
The repository is organized as follows:
nestjs-best-practices-skill/
├── SKILL.md # Main entry point for Claude Code
├── AGENTS.md # Consolidated rules document (generated)
├── metadata.json # Version and metadata
├── rules/ # Individual rule files
│ ├── _sections.md # Category definitions
│ ├── _template.md # Template for new rules
│ ├── arch-*.md # Architecture rules
│ ├── di-*.md # Dependency Injection rules
│ ├── error-*.md # Error Handling rules
│ ├── security-*.md # Security rules
│ ├── perf-*.md # Performance rules
│ ├── test-*.md # Testing rules
│ ├── db-*.md # Database rules
│ ├── api-*.md # API Design rules
│ ├── micro-*.md # Microservices rules
│ └── devops-*.md # DevOps rules
└── scripts/ # Build tools
├── build-agents.ts # AGENTS.md generator
├── build.sh # Shell wrapper
└── package.json # NPM config
Workflow
The repository utilizes a prefix-based naming system for files, ensuring clarity:
arch-: Architecture patternsdi-: Dependency Injection strategiessecurity-: Security best practicesperf-: Performance optimizations
The rules are automatically ordered within each section, enhancing accessibility when building the AGENTS.md.
Adding New Rules
To incorporate new rules into the repository, follow these structured steps:
- Copy
rules/_template.mdto a newly created file using the relevant prefix. - Complete the frontmatter and content according to the template.
- Execute the build script to regenerate the
AGENTS.mdfile.
Example Rule Structure
Each rule adheres to a defined format:
---
title: Rule Title Here
impact: MEDIUM
impactDescription: Brief description of impact
tags: tag1, tag2, tag3
---
## Rule Title Here
Brief explanation of the rule and its significance.
**Incorrect (description of the problem):**
```typescript
// Bad code example here
Correct (description of the solution):
// Good code example here
Reference: NestJS Documentation
### Impact Classification
Each rule is classified by impact:
| Level | Description |
|-------------|--------------------------------------------------------------------------------------------|
| CRITICAL | Violations cause runtime errors, security vulnerabilities, or architectural breakdown |
| HIGH | Significant impact on reliability, security, or maintainability |
| MEDIUM-HIGH | Notable impact on quality and developer experience |
| MEDIUM | Moderate impact on code quality and adherence to best practices |
| LOW-MEDIUM | Minor enhancements to consistency and maintainability |
This skillset serves as a resource for developers seeking to enhance their NestJS capabilities and ensure their applications are built using the most effective practices.
No comments yet.
Sign in to be the first to comment.