Add new skills for backend patterns, coding standards, continuous learning, and NestJS best practices

- Introduced backend patterns skill with guidelines on API design, database optimization, and server-side best practices.
- Added coding standards skill outlining universal coding principles for TypeScript, NestJS, and Node.js development.
- Implemented continuous learning skill to automatically extract reusable patterns from Cursor sessions.
- Created NestJS best practices skill detailing architecture patterns, dependency injection, error handling, and security measures.
- Included various rules and templates for NestJS best practices to ensure production-ready applications.
This commit is contained in:
shancheas
2026-08-20 18:30:39 +07:00
commit 0b0bdd9c4b
108 changed files with 16056 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
---
description: All phone-number data must use the PhoneNumber value object; extend the VO instead of adding alternate helpers
alwaysApply: true
---
# Phone Number Value Object
## Mandatory
ALL phone-number data in the domain and application layers MUST use `PhoneNumber` from `src/common/value-objects/phone-number/`.
- Construct only via `PhoneNumber.create(raw)`
- Compare with `equals()`, serialize with `value` / `toString()` / `toJSON()`
- Persist and transmit the canonical E.164 from `phone.value` (or `toString()` / `toJSON()`)
## Forbidden
Do NOT:
- Store or pass phone numbers as plain `string` / `number` in domain models, services, or repositories (beyond the DTO/HTTP or DB string boundary)
- Add phone validators, parsers, formatters, regex helpers, pipes, or decorators that bypass the VO
- Create new files or functions for phone-number validation or normalization
- Use `libphonenumber-js` (or similar) outside the PhoneNumber VO
```typescript
// BAD
function normalizePhone(raw: string): string { /* ... */ }
user.phone = '+6281234567890'
// GOOD
const phone = PhoneNumber.create(dto.phone)
user.phone = phone // PhoneNumber type in domain
await repo.save({ phoneNumber: phone.value }) // E.164 string only at persistence edge
```
## When the VO is not enough
If a requirement cannot be met with the current VO (e.g. national formats, default region, formatting for display):
1. **Update** `src/common/value-objects/phone-number/` (implementation + colocated tests)
2. Do **not** invent a parallel phone helper, type, or module
## Boundaries
- HTTP DTOs may accept `string`; map to `PhoneNumber.create()` at the service boundary
- Database columns may store E.164 `text`/`varchar`; map to/from `PhoneNumber` in the repository
- `InvalidPhoneNumberError` is the only phone validation error; do not echo raw input in messages