Aider configuration for serverless CQRS applications on AWS with NestJS. Enforces CQRS patterns, event sourcing, multi-tenant data isolation, and DynamoDB key structure conventions.
This skill configures Aider for developing serverless applications using CQRS (Command Query Responsibility Segregation) pattern on AWS with NestJS framework.
Provides Aider with:
Always load these files for context (never edit them directly):
```
```
Never include these paths in edits:
```
```
After making changes:
1. Run linter: `npm run lint`
2. Run tests: `npm test`
Use `monokai` color theme for syntax highlighting.
**CQRS (Command Query Responsibility Segregation):**
**Commands:**
```
CreateResourceCommand
UpdateResourceCommand
DeleteResourceCommand
```
**Events:**
```
ResourceCreatedEvent
ResourceUpdatedEvent
ResourceDeletedEvent
```
**Handlers:**
```
CreateResourceHandler
UpdateResourceHandler
DeleteResourceHandler
```
**DTOs (Data Transfer Objects):**
```
CreateResourceDto
UpdateResourceDto
ResourceResponseDto
```
**Multi-tenant key pattern:**
Example:
```typescript
PK: "ACME#USER"
SK: "USER#123e4567-e89b-12d3-a456-426614174000"
```
**Framework:** Jest with `aws-sdk-client-mock`
**Test Types:**
**Test Structure:**
```typescript
describe('CreateResourceHandler', () => {
it('should create resource successfully', async () => {
// Arrange
// Act
// Assert
});
});
```
Organize each feature module as follows:
```
src/module/
├── commands/ # Command classes and handlers
├── queries/ # Query classes and handlers
├── dto/ # Data transfer objects
├── entities/ # Domain entities
├── controllers/ # NestJS controllers
└── module.ts # Module definition
```
1. **Commands** handle state changes and emit events
2. **Queries** read from optimized read models
3. **Events** are stored in DynamoDB for event sourcing
4. **Handlers** contain business logic
5. **Controllers** delegate to CQRS bus
6. **DTOs** validate input/output at API boundaries
7. **Entities** represent domain models
When creating a new resource module:
1. Create module structure following the standard layout
2. Implement CreateResourceCommand with CreateResourceDto
3. Create CreateResourceHandler with tenant-aware DynamoDB keys
4. Emit ResourceCreatedEvent after successful creation
5. Write unit tests mocking DynamoDB client
6. Add E2E tests for the controller endpoint
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/mbc-cqrs-serverless-aider-configuration/raw