@smicolon/ai-kit 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/.claude-plugin/CLAUDE.md +7 -0
  2. package/.claude-plugin/marketplace.json +373 -0
  3. package/README.md +26 -16
  4. package/dist/index.js +146 -38
  5. package/package.json +4 -3
  6. package/packs/architect/CHANGELOG.md +17 -0
  7. package/packs/architect/README.md +58 -0
  8. package/packs/architect/agents/system-architect.md +768 -0
  9. package/packs/architect/commands/diagram-create.md +300 -0
  10. package/packs/better-auth/.claude-plugin/plugin.json +14 -0
  11. package/packs/better-auth/.mcp.json +14 -0
  12. package/packs/better-auth/CHANGELOG.md +26 -0
  13. package/packs/better-auth/README.md +125 -0
  14. package/packs/better-auth/agents/auth-architect.md +278 -0
  15. package/packs/better-auth/commands/auth-provider-add.md +265 -0
  16. package/packs/better-auth/commands/auth-setup.md +298 -0
  17. package/packs/better-auth/skills/auth-security/SKILL.md +425 -0
  18. package/packs/better-auth/skills/better-auth-patterns/SKILL.md +455 -0
  19. package/packs/dev-loop/.claude-plugin/plugin.json +10 -0
  20. package/packs/dev-loop/CHANGELOG.md +69 -0
  21. package/packs/dev-loop/README.md +155 -0
  22. package/packs/dev-loop/commands/cancel-dev.md +21 -0
  23. package/packs/dev-loop/commands/dev-loop.md +72 -0
  24. package/packs/dev-loop/commands/dev-plan.md +351 -0
  25. package/packs/dev-loop/hooks/hooks.json +15 -0
  26. package/packs/dev-loop/hooks/stop-hook.sh +178 -0
  27. package/packs/dev-loop/scripts/setup-dev-loop.sh +194 -0
  28. package/packs/dev-loop/skills/tdd-planner/SKILL.md +249 -0
  29. package/packs/dev-loop/skills/tdd-planner/references/framework-patterns.md +874 -0
  30. package/packs/dev-loop/skills/tdd-planner/references/good-example.md +260 -0
  31. package/packs/dev-loop/skills/tdd-planner/references/plan-template.md +275 -0
  32. package/packs/django/CHANGELOG.md +39 -0
  33. package/packs/django/README.md +92 -0
  34. package/packs/django/agents/django-architect.md +182 -0
  35. package/packs/django/agents/django-builder.md +250 -0
  36. package/packs/django/agents/django-feature-based.md +420 -0
  37. package/packs/django/agents/django-reviewer.md +253 -0
  38. package/packs/django/agents/django-tester.md +230 -0
  39. package/packs/django/commands/api-endpoint.md +285 -0
  40. package/packs/django/commands/model-create.md +178 -0
  41. package/packs/django/commands/test-generate.md +325 -0
  42. package/packs/django/rules/migrations.md +138 -0
  43. package/packs/django/rules/models.md +167 -0
  44. package/packs/django/rules/serializers.md +126 -0
  45. package/packs/django/rules/services.md +131 -0
  46. package/packs/django/rules/tests.md +140 -0
  47. package/packs/django/rules/views.md +102 -0
  48. package/packs/django/skills/import-convention-enforcer/SKILL.md +226 -0
  49. package/packs/django/skills/import-convention-enforcer/patterns/django-imports.md +343 -0
  50. package/packs/django/skills/migration-safety-checker/SKILL.md +375 -0
  51. package/packs/django/skills/model-entity-validator/SKILL.md +298 -0
  52. package/packs/django/skills/performance-optimizer/SKILL.md +447 -0
  53. package/packs/django/skills/red-phase-verifier/SKILL.md +180 -0
  54. package/packs/django/skills/security-first-validator/SKILL.md +435 -0
  55. package/packs/django/skills/test-coverage-advisor/SKILL.md +394 -0
  56. package/packs/django/skills/test-validity-checker/SKILL.md +194 -0
  57. package/packs/failure-log/.claude-plugin/plugin.json +14 -0
  58. package/packs/failure-log/CHANGELOG.md +20 -0
  59. package/packs/failure-log/README.md +168 -0
  60. package/packs/failure-log/commands/failure-add.md +106 -0
  61. package/packs/failure-log/commands/failure-list.md +89 -0
  62. package/packs/failure-log/hooks/hooks.json +16 -0
  63. package/packs/failure-log/hooks/scripts/inject-failures.sh +64 -0
  64. package/packs/failure-log/skills/failure-log-manager/SKILL.md +164 -0
  65. package/packs/flutter/.claude-plugin/plugin.json +10 -0
  66. package/packs/flutter/CHANGELOG.md +19 -0
  67. package/packs/flutter/README.md +170 -0
  68. package/packs/flutter/agents/flutter-architect.md +166 -0
  69. package/packs/flutter/agents/flutter-builder.md +303 -0
  70. package/packs/flutter/agents/release-manager.md +355 -0
  71. package/packs/flutter/commands/fastlane-setup.md +188 -0
  72. package/packs/flutter/commands/flutter-build.md +90 -0
  73. package/packs/flutter/commands/flutter-deploy.md +133 -0
  74. package/packs/flutter/commands/flutter-test.md +117 -0
  75. package/packs/flutter/commands/signing-setup.md +209 -0
  76. package/packs/flutter/hooks/hooks.json +17 -0
  77. package/packs/flutter/skills/fastlane-knowledge/SKILL.md +193 -0
  78. package/packs/flutter/skills/flutter-architecture/SKILL.md +127 -0
  79. package/packs/flutter/skills/store-publishing/SKILL.md +163 -0
  80. package/packs/hono/.claude-plugin/plugin.json +19 -0
  81. package/packs/hono/CHANGELOG.md +19 -0
  82. package/packs/hono/README.md +143 -0
  83. package/packs/hono/agents/hono-architect.md +240 -0
  84. package/packs/hono/agents/hono-builder.md +285 -0
  85. package/packs/hono/agents/hono-reviewer.md +279 -0
  86. package/packs/hono/agents/hono-tester.md +346 -0
  87. package/packs/hono/commands/middleware-create.md +223 -0
  88. package/packs/hono/commands/project-init.md +306 -0
  89. package/packs/hono/commands/route-create.md +153 -0
  90. package/packs/hono/commands/rpc-client.md +263 -0
  91. package/packs/hono/hooks/hooks.json +4 -0
  92. package/packs/hono/skills/cloudflare-bindings/SKILL.md +408 -0
  93. package/packs/hono/skills/hono-patterns/SKILL.md +309 -0
  94. package/packs/hono/skills/rpc-typesafe/SKILL.md +388 -0
  95. package/packs/hono/skills/zod-validation/SKILL.md +332 -0
  96. package/packs/nestjs/CHANGELOG.md +29 -0
  97. package/packs/nestjs/README.md +75 -0
  98. package/packs/nestjs/agents/nestjs-architect.md +402 -0
  99. package/packs/nestjs/agents/nestjs-builder.md +301 -0
  100. package/packs/nestjs/agents/nestjs-tester.md +437 -0
  101. package/packs/nestjs/commands/module-create.md +369 -0
  102. package/packs/nestjs/rules/controllers.md +92 -0
  103. package/packs/nestjs/rules/dto.md +124 -0
  104. package/packs/nestjs/rules/entities.md +102 -0
  105. package/packs/nestjs/rules/services.md +106 -0
  106. package/packs/nestjs/skills/barrel-export-manager/SKILL.md +389 -0
  107. package/packs/nestjs/skills/import-convention-enforcer/SKILL.md +365 -0
  108. package/packs/nextjs/CHANGELOG.md +36 -0
  109. package/packs/nextjs/README.md +76 -0
  110. package/packs/nextjs/agents/frontend-tester.md +680 -0
  111. package/packs/nextjs/agents/frontend-visual.md +820 -0
  112. package/packs/nextjs/agents/nextjs-architect.md +331 -0
  113. package/packs/nextjs/agents/nextjs-modular.md +433 -0
  114. package/packs/nextjs/commands/component-create.md +398 -0
  115. package/packs/nextjs/rules/api-routes.md +129 -0
  116. package/packs/nextjs/rules/components.md +106 -0
  117. package/packs/nextjs/rules/hooks.md +132 -0
  118. package/packs/nextjs/skills/accessibility-validator/SKILL.md +445 -0
  119. package/packs/nextjs/skills/import-convention-enforcer/SKILL.md +399 -0
  120. package/packs/nextjs/skills/react-form-validator/SKILL.md +569 -0
  121. package/packs/nuxtjs/CHANGELOG.md +30 -0
  122. package/packs/nuxtjs/README.md +56 -0
  123. package/packs/nuxtjs/agents/frontend-tester.md +680 -0
  124. package/packs/nuxtjs/agents/frontend-visual.md +820 -0
  125. package/packs/nuxtjs/agents/nuxtjs-architect.md +537 -0
  126. package/packs/nuxtjs/commands/component-create.md +223 -0
  127. package/packs/nuxtjs/rules/components.md +101 -0
  128. package/packs/nuxtjs/rules/composables.md +118 -0
  129. package/packs/nuxtjs/rules/server-routes.md +127 -0
  130. package/packs/nuxtjs/skills/accessibility-validator/SKILL.md +183 -0
  131. package/packs/nuxtjs/skills/import-convention-enforcer/SKILL.md +196 -0
  132. package/packs/nuxtjs/skills/veevalidate-form-validator/SKILL.md +190 -0
  133. package/packs/onboard/CHANGELOG.md +22 -0
  134. package/packs/onboard/README.md +103 -0
  135. package/packs/onboard/agents/onboard-guide.md +118 -0
  136. package/packs/onboard/commands/onboard.md +313 -0
  137. package/packs/onboard/skills/onboard-context-provider/SKILL.md +98 -0
  138. package/packs/tanstack-router/.claude-plugin/plugin.json +14 -0
  139. package/packs/tanstack-router/CHANGELOG.md +30 -0
  140. package/packs/tanstack-router/README.md +113 -0
  141. package/packs/tanstack-router/agents/tanstack-architect.md +173 -0
  142. package/packs/tanstack-router/agents/tanstack-builder.md +360 -0
  143. package/packs/tanstack-router/agents/tanstack-tester.md +454 -0
  144. package/packs/tanstack-router/commands/form-create.md +313 -0
  145. package/packs/tanstack-router/commands/query-create.md +263 -0
  146. package/packs/tanstack-router/commands/route-create.md +190 -0
  147. package/packs/tanstack-router/commands/table-create.md +413 -0
  148. package/packs/tanstack-router/skills/ai-patterns/SKILL.md +370 -0
  149. package/packs/tanstack-router/skills/db-patterns/SKILL.md +346 -0
  150. package/packs/tanstack-router/skills/devtools-patterns/SKILL.md +415 -0
  151. package/packs/tanstack-router/skills/form-patterns/SKILL.md +425 -0
  152. package/packs/tanstack-router/skills/pacer-patterns/SKILL.md +341 -0
  153. package/packs/tanstack-router/skills/query-patterns/SKILL.md +359 -0
  154. package/packs/tanstack-router/skills/router-patterns/SKILL.md +285 -0
  155. package/packs/tanstack-router/skills/store-patterns/SKILL.md +351 -0
  156. package/packs/tanstack-router/skills/table-patterns/SKILL.md +531 -0
  157. package/packs/tanstack-router/skills/tanstack-conventions/SKILL.md +428 -0
  158. package/packs/tanstack-router/skills/virtual-patterns/SKILL.md +490 -0
  159. package/packs/worktree/.claude-plugin/plugin.json +19 -0
  160. package/packs/worktree/CHANGELOG.md +24 -0
  161. package/packs/worktree/README.md +110 -0
  162. package/packs/worktree/commands/wt.md +73 -0
  163. package/packs/worktree/scripts/wt.sh +396 -0
  164. package/packs/worktree/skills/worktree-manager/SKILL.md +68 -0
@@ -0,0 +1,369 @@
1
+ ---
2
+ name: module-create
3
+ description: Create a new NestJS module following Smicolon conventions
4
+ ---
5
+
6
+ # NestJS Module Creation
7
+
8
+ You are a NestJS module creation specialist. Your task is to create a complete NestJS module that strictly follows Smicolon company standards.
9
+
10
+ ## Core Requirements
11
+
12
+ ### Import Pattern (CRITICAL)
13
+ ALWAYS use absolute imports from barrel exports:
14
+
15
+ ```typescript
16
+ // ✅ CORRECT - Absolute imports from barrel exports
17
+ import { User } from 'src/users/entities'
18
+ import { UsersService } from 'src/users/services'
19
+ import { CreateUserDto } from 'src/users/dto'
20
+
21
+ // ❌ WRONG - Relative imports
22
+ import { User } from './entities/user.entity'
23
+ import { User } from '../entities'
24
+ ```
25
+
26
+ ### Standard Entity Fields (MANDATORY)
27
+ Every entity MUST include:
28
+
29
+ ```typescript
30
+ import {
31
+ Entity,
32
+ PrimaryGeneratedColumn,
33
+ Column,
34
+ CreateDateColumn,
35
+ UpdateDateColumn,
36
+ DeleteDateColumn
37
+ } from 'typeorm'
38
+
39
+ @Entity('table_name')
40
+ export class YourEntity {
41
+ @PrimaryGeneratedColumn('uuid')
42
+ id: string
43
+
44
+ @CreateDateColumn()
45
+ createdAt: Date
46
+
47
+ @UpdateDateColumn()
48
+ updatedAt: Date
49
+
50
+ @DeleteDateColumn()
51
+ deletedAt?: Date
52
+
53
+ // Your custom fields here
54
+ }
55
+ ```
56
+
57
+ ### Module Structure
58
+ Every module needs these files:
59
+ ```
60
+ src/module-name/
61
+ ├── index.ts # Barrel export (REQUIRED)
62
+ ├── module-name.module.ts
63
+ ├── entities/
64
+ │ ├── index.ts # Barrel export
65
+ │ └── entity-name.entity.ts
66
+ ├── dto/
67
+ │ ├── index.ts # Barrel export
68
+ │ ├── create-entity.dto.ts
69
+ │ └── update-entity.dto.ts
70
+ ├── services/
71
+ │ ├── index.ts # Barrel export
72
+ │ └── module-name.service.ts
73
+ ├── controllers/
74
+ │ ├── index.ts # Barrel export
75
+ │ └── module-name.controller.ts
76
+ └── guards/ (if needed)
77
+ ├── index.ts
78
+ └── custom.guard.ts
79
+ ```
80
+
81
+ ## Workflow
82
+
83
+ 1. **Understand Requirements**: Ask user for:
84
+ - Module name and purpose
85
+ - Entity fields needed
86
+ - API endpoints (CRUD operations)
87
+ - Access control needs
88
+
89
+ 2. **Generate Files**: Create all necessary files with:
90
+ - Entity with standard fields
91
+ - DTOs with validation
92
+ - Service with business logic
93
+ - Controller with guards
94
+ - Module configuration
95
+ - Barrel exports
96
+
97
+ ## Example Output
98
+
99
+ ### Entity
100
+ ```typescript
101
+ // src/products/entities/product.entity.ts
102
+ import {
103
+ Entity,
104
+ PrimaryGeneratedColumn,
105
+ Column,
106
+ CreateDateColumn,
107
+ UpdateDateColumn,
108
+ DeleteDateColumn,
109
+ ManyToOne,
110
+ JoinColumn
111
+ } from 'typeorm'
112
+ import { User } from 'src/users/entities'
113
+
114
+ @Entity('products')
115
+ export class Product {
116
+ @PrimaryGeneratedColumn('uuid')
117
+ id: string
118
+
119
+ @CreateDateColumn()
120
+ createdAt: Date
121
+
122
+ @UpdateDateColumn()
123
+ updatedAt: Date
124
+
125
+ @DeleteDateColumn()
126
+ deletedAt?: Date
127
+
128
+ @Column({ length: 255 })
129
+ name: string
130
+
131
+ @Column({ unique: true, length: 255 })
132
+ slug: string
133
+
134
+ @Column('text')
135
+ description: string
136
+
137
+ @Column('decimal', { precision: 10, scale: 2 })
138
+ price: number
139
+
140
+ @Column('int', { default: 0 })
141
+ stock: number
142
+
143
+ @ManyToOne(() => User)
144
+ @JoinColumn({ name: 'created_by_id' })
145
+ createdBy: User
146
+ }
147
+ ```
148
+
149
+ ### DTOs
150
+ ```typescript
151
+ // src/products/dto/create-product.dto.ts
152
+ import { IsString, IsNumber, IsNotEmpty, Min, MaxLength } from 'class-validator'
153
+ import { ApiProperty } from '@nestjs/swagger'
154
+
155
+ export class CreateProductDto {
156
+ @ApiProperty({ example: 'Laptop', description: 'Product name' })
157
+ @IsString()
158
+ @IsNotEmpty()
159
+ @MaxLength(255)
160
+ name: string
161
+
162
+ @ApiProperty({ example: 'laptop-2024', description: 'URL-friendly slug' })
163
+ @IsString()
164
+ @IsNotEmpty()
165
+ @MaxLength(255)
166
+ slug: string
167
+
168
+ @ApiProperty({ example: 'High-performance laptop', description: 'Product description' })
169
+ @IsString()
170
+ @IsNotEmpty()
171
+ description: string
172
+
173
+ @ApiProperty({ example: 999.99, description: 'Product price' })
174
+ @IsNumber()
175
+ @Min(0)
176
+ price: number
177
+
178
+ @ApiProperty({ example: 10, description: 'Stock quantity', required: false })
179
+ @IsNumber()
180
+ @Min(0)
181
+ stock?: number
182
+ }
183
+
184
+ // src/products/dto/update-product.dto.ts
185
+ import { PartialType } from '@nestjs/mapped-types'
186
+ import { CreateProductDto } from './create-product.dto'
187
+
188
+ export class UpdateProductDto extends PartialType(CreateProductDto) {}
189
+
190
+ // src/products/dto/index.ts
191
+ export * from './create-product.dto'
192
+ export * from './update-product.dto'
193
+ ```
194
+
195
+ ### Service
196
+ ```typescript
197
+ // src/products/services/product.service.ts
198
+ import { Injectable, NotFoundException } from '@nestjs/common'
199
+ import { InjectRepository } from '@nestjs/typeorm'
200
+ import { Repository } from 'typeorm'
201
+ import { Product } from 'src/products/entities'
202
+ import { CreateProductDto, UpdateProductDto } from 'src/products/dto'
203
+
204
+ @Injectable()
205
+ export class ProductService {
206
+ constructor(
207
+ @InjectRepository(Product)
208
+ private readonly productRepository: Repository<Product>,
209
+ ) {}
210
+
211
+ async create(createProductDto: CreateProductDto, userId: string): Promise<Product> {
212
+ const product = this.productRepository.create({
213
+ ...createProductDto,
214
+ createdBy: { id: userId } as any,
215
+ })
216
+
217
+ return await this.productRepository.save(product)
218
+ }
219
+
220
+ async findAll(): Promise<Product[]> {
221
+ return await this.productRepository.find({
222
+ relations: ['createdBy'],
223
+ order: { createdAt: 'DESC' },
224
+ })
225
+ }
226
+
227
+ async findOne(id: string): Promise<Product> {
228
+ const product = await this.productRepository.findOne({
229
+ where: { id },
230
+ relations: ['createdBy'],
231
+ })
232
+
233
+ if (!product) {
234
+ throw new NotFoundException(`Product with ID ${id} not found`)
235
+ }
236
+
237
+ return product
238
+ }
239
+
240
+ async update(id: string, updateProductDto: UpdateProductDto): Promise<Product> {
241
+ const product = await this.findOne(id)
242
+
243
+ Object.assign(product, updateProductDto)
244
+
245
+ return await this.productRepository.save(product)
246
+ }
247
+
248
+ async remove(id: string): Promise<void> {
249
+ const product = await this.findOne(id)
250
+ await this.productRepository.softRemove(product)
251
+ }
252
+
253
+ async restock(id: string, quantity: number): Promise<Product> {
254
+ const product = await this.findOne(id)
255
+ product.stock += quantity
256
+ return await this.productRepository.save(product)
257
+ }
258
+ }
259
+
260
+ // src/products/services/index.ts
261
+ export * from './product.service'
262
+ ```
263
+
264
+ ### Controller
265
+ ```typescript
266
+ // src/products/controllers/product.controller.ts
267
+ import {
268
+ Controller,
269
+ Get,
270
+ Post,
271
+ Body,
272
+ Patch,
273
+ Param,
274
+ Delete,
275
+ UseGuards,
276
+ Request,
277
+ } from '@nestjs/common'
278
+ import { ApiBearerAuth, ApiTags, ApiOperation } from '@nestjs/swagger'
279
+ import { JwtAuthGuard } from 'src/auth/guards'
280
+ import { ProductService } from 'src/products/services'
281
+ import { CreateProductDto, UpdateProductDto } from 'src/products/dto'
282
+
283
+ @ApiTags('products')
284
+ @ApiBearerAuth()
285
+ @UseGuards(JwtAuthGuard)
286
+ @Controller('products')
287
+ export class ProductController {
288
+ constructor(private readonly productService: ProductService) {}
289
+
290
+ @Post()
291
+ @ApiOperation({ summary: 'Create a new product' })
292
+ create(@Body() createProductDto: CreateProductDto, @Request() req) {
293
+ return this.productService.create(createProductDto, req.user.id)
294
+ }
295
+
296
+ @Get()
297
+ @ApiOperation({ summary: 'Get all products' })
298
+ findAll() {
299
+ return this.productService.findAll()
300
+ }
301
+
302
+ @Get(':id')
303
+ @ApiOperation({ summary: 'Get a product by ID' })
304
+ findOne(@Param('id') id: string) {
305
+ return this.productService.findOne(id)
306
+ }
307
+
308
+ @Patch(':id')
309
+ @ApiOperation({ summary: 'Update a product' })
310
+ update(@Param('id') id: string, @Body() updateProductDto: UpdateProductDto) {
311
+ return this.productService.update(id, updateProductDto)
312
+ }
313
+
314
+ @Delete(':id')
315
+ @ApiOperation({ summary: 'Delete a product' })
316
+ remove(@Param('id') id: string) {
317
+ return this.productService.remove(id)
318
+ }
319
+
320
+ @Post(':id/restock')
321
+ @ApiOperation({ summary: 'Restock a product' })
322
+ restock(@Param('id') id: string, @Body('quantity') quantity: number) {
323
+ return this.productService.restock(id, quantity)
324
+ }
325
+ }
326
+
327
+ // src/products/controllers/index.ts
328
+ export * from './product.controller'
329
+ ```
330
+
331
+ ### Module
332
+ ```typescript
333
+ // src/products/products.module.ts
334
+ import { Module } from '@nestjs/common'
335
+ import { TypeOrmModule } from '@nestjs/typeorm'
336
+ import { Product } from './entities'
337
+ import { ProductService } from './services'
338
+ import { ProductController } from './controllers'
339
+
340
+ @Module({
341
+ imports: [TypeOrmModule.forFeature([Product])],
342
+ controllers: [ProductController],
343
+ providers: [ProductService],
344
+ exports: [ProductService],
345
+ })
346
+ export class ProductsModule {}
347
+
348
+ // src/products/index.ts (Barrel export)
349
+ export * from './products.module'
350
+ export * from './entities'
351
+ export * from './dto'
352
+ export * from './services'
353
+ export * from './controllers'
354
+ ```
355
+
356
+ ## Quality Checklist
357
+
358
+ - [ ] UUID primary keys
359
+ - [ ] Timestamps (createdAt, updatedAt)
360
+ - [ ] Soft deletes (deletedAt)
361
+ - [ ] Absolute imports from barrel exports
362
+ - [ ] DTOs with class-validator
363
+ - [ ] Guards on protected routes
364
+ - [ ] Swagger/OpenAPI documentation
365
+ - [ ] Barrel exports (index.ts) in all folders
366
+ - [ ] Service methods with proper error handling
367
+ - [ ] Repository pattern with TypeORM
368
+
369
+ Now, ask the user what module they want to create!
@@ -0,0 +1,92 @@
1
+ ---
2
+ paths:
3
+ - "**/*.controller.ts"
4
+ ---
5
+
6
+ # NestJS Controller Standards
7
+
8
+ ## Structure
9
+
10
+ ```typescript
11
+ import { Controller, Get, Post, Body, UseGuards } from '@nestjs/common'
12
+ import { JwtAuthGuard } from 'src/auth/guards'
13
+ import { User } from 'src/users/entities'
14
+ import { UsersService } from 'src/users/services'
15
+ import { CreateUserDto, UserResponseDto } from 'src/users/dto'
16
+
17
+ @Controller('users')
18
+ @UseGuards(JwtAuthGuard) // REQUIRED
19
+ export class UsersController {
20
+ constructor(private readonly usersService: UsersService) {}
21
+
22
+ @Post()
23
+ async create(@Body() dto: CreateUserDto): Promise<UserResponseDto> {
24
+ return this.usersService.create(dto)
25
+ }
26
+ }
27
+ ```
28
+
29
+ ## Requirements
30
+
31
+ - Guards on all protected routes (@UseGuards)
32
+ - DTOs for all inputs
33
+ - Response DTOs for outputs
34
+ - Absolute imports from barrel exports
35
+ - Constructor injection for dependencies
36
+
37
+ ## Import Pattern
38
+
39
+ ```typescript
40
+ // CORRECT - Absolute imports from barrel exports
41
+ import { UsersService } from 'src/users/services'
42
+ import { CreateUserDto } from 'src/users/dto'
43
+ import { User } from 'src/users/entities'
44
+
45
+ // WRONG - Relative imports
46
+ import { UsersService } from './users.service'
47
+ import { CreateUserDto } from '../dto/create-user.dto'
48
+ ```
49
+
50
+ ## Method Decorators
51
+
52
+ ```typescript
53
+ @Controller('users')
54
+ @UseGuards(JwtAuthGuard)
55
+ export class UsersController {
56
+ @Get()
57
+ findAll(): Promise<UserResponseDto[]> {
58
+ return this.usersService.findAll()
59
+ }
60
+
61
+ @Get(':id')
62
+ findOne(@Param('id', ParseUUIDPipe) id: string): Promise<UserResponseDto> {
63
+ return this.usersService.findOne(id)
64
+ }
65
+
66
+ @Post()
67
+ create(@Body() dto: CreateUserDto): Promise<UserResponseDto> {
68
+ return this.usersService.create(dto)
69
+ }
70
+
71
+ @Patch(':id')
72
+ update(
73
+ @Param('id', ParseUUIDPipe) id: string,
74
+ @Body() dto: UpdateUserDto,
75
+ ): Promise<UserResponseDto> {
76
+ return this.usersService.update(id, dto)
77
+ }
78
+
79
+ @Delete(':id')
80
+ @HttpCode(HttpStatus.NO_CONTENT)
81
+ remove(@Param('id', ParseUUIDPipe) id: string): Promise<void> {
82
+ return this.usersService.remove(id)
83
+ }
84
+ }
85
+ ```
86
+
87
+ ## Forbidden Patterns
88
+
89
+ - Controllers without @UseGuards
90
+ - Direct repository access (use services)
91
+ - Business logic in controllers
92
+ - Any type in parameters or return types
@@ -0,0 +1,124 @@
1
+ ---
2
+ paths:
3
+ - "**/*.dto.ts"
4
+ ---
5
+
6
+ # NestJS DTO Standards
7
+
8
+ ## Structure
9
+
10
+ ```typescript
11
+ import { IsEmail, IsString, MinLength, IsOptional } from 'class-validator'
12
+ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'
13
+
14
+ export class CreateUserDto {
15
+ @ApiProperty({ description: 'User email address' })
16
+ @IsEmail()
17
+ email: string
18
+
19
+ @ApiProperty({ description: 'User password', minLength: 8 })
20
+ @IsString()
21
+ @MinLength(8)
22
+ password: string
23
+
24
+ @ApiPropertyOptional({ description: 'User first name' })
25
+ @IsOptional()
26
+ @IsString()
27
+ firstName?: string
28
+ }
29
+ ```
30
+
31
+ ## Requirements
32
+
33
+ - class-validator decorators for validation
34
+ - @nestjs/swagger decorators for API documentation
35
+ - Separate DTOs for create, update, response
36
+ - Export from barrel (index.ts)
37
+
38
+ ## Naming Convention
39
+
40
+ - Create DTOs: `Create{Entity}Dto`
41
+ - Update DTOs: `Update{Entity}Dto`
42
+ - Response DTOs: `{Entity}ResponseDto`
43
+ - Query DTOs: `{Entity}QueryDto`
44
+
45
+ ## Update DTOs with PartialType
46
+
47
+ ```typescript
48
+ import { PartialType } from '@nestjs/swagger'
49
+ import { CreateUserDto } from './create-user.dto'
50
+
51
+ export class UpdateUserDto extends PartialType(CreateUserDto) {}
52
+ ```
53
+
54
+ ## Response DTOs
55
+
56
+ ```typescript
57
+ import { Exclude, Expose } from 'class-transformer'
58
+
59
+ export class UserResponseDto {
60
+ @Expose()
61
+ id: string
62
+
63
+ @Expose()
64
+ email: string
65
+
66
+ @Expose()
67
+ firstName: string
68
+
69
+ @Expose()
70
+ createdAt: Date
71
+
72
+ @Exclude()
73
+ password: string // Never expose
74
+ }
75
+ ```
76
+
77
+ ## Validation Examples
78
+
79
+ ```typescript
80
+ import {
81
+ IsEmail,
82
+ IsString,
83
+ MinLength,
84
+ MaxLength,
85
+ IsUUID,
86
+ IsEnum,
87
+ IsInt,
88
+ Min,
89
+ Max,
90
+ IsArray,
91
+ ValidateNested,
92
+ } from 'class-validator'
93
+ import { Type } from 'class-transformer'
94
+
95
+ export class CreateOrderDto {
96
+ @IsUUID()
97
+ userId: string
98
+
99
+ @IsArray()
100
+ @ValidateNested({ each: true })
101
+ @Type(() => OrderItemDto)
102
+ items: OrderItemDto[]
103
+
104
+ @IsEnum(PaymentMethod)
105
+ paymentMethod: PaymentMethod
106
+ }
107
+
108
+ export class OrderItemDto {
109
+ @IsUUID()
110
+ productId: string
111
+
112
+ @IsInt()
113
+ @Min(1)
114
+ @Max(100)
115
+ quantity: number
116
+ }
117
+ ```
118
+
119
+ ## Forbidden Patterns
120
+
121
+ - DTOs without validation decorators
122
+ - Exposing sensitive fields in response DTOs
123
+ - Using `any` type
124
+ - Missing Swagger documentation
@@ -0,0 +1,102 @@
1
+ ---
2
+ paths:
3
+ - "**/*.entity.ts"
4
+ ---
5
+
6
+ # NestJS Entity Standards
7
+
8
+ ## Structure
9
+
10
+ ```typescript
11
+ import {
12
+ Entity,
13
+ PrimaryGeneratedColumn,
14
+ Column,
15
+ CreateDateColumn,
16
+ UpdateDateColumn,
17
+ DeleteDateColumn,
18
+ } from 'typeorm'
19
+
20
+ @Entity('users')
21
+ export class User {
22
+ @PrimaryGeneratedColumn('uuid')
23
+ id: string
24
+
25
+ @Column({ unique: true })
26
+ email: string
27
+
28
+ @CreateDateColumn()
29
+ createdAt: Date
30
+
31
+ @UpdateDateColumn()
32
+ updatedAt: Date
33
+
34
+ @DeleteDateColumn()
35
+ deletedAt?: Date // Soft delete
36
+ }
37
+ ```
38
+
39
+ ## Requirements
40
+
41
+ - UUID primary keys (@PrimaryGeneratedColumn('uuid'))
42
+ - Timestamps (createdAt, updatedAt)
43
+ - Soft delete (deletedAt with @DeleteDateColumn)
44
+ - Explicit table name in @Entity()
45
+ - Export from barrel (index.ts)
46
+
47
+ ## Relationships
48
+
49
+ ```typescript
50
+ import { Entity, ManyToOne, OneToMany, JoinColumn } from 'typeorm'
51
+ import { User } from 'src/users/entities'
52
+ import { OrderItem } from 'src/orders/entities'
53
+
54
+ @Entity('orders')
55
+ export class Order {
56
+ @PrimaryGeneratedColumn('uuid')
57
+ id: string
58
+
59
+ @ManyToOne(() => User, user => user.orders)
60
+ @JoinColumn({ name: 'user_id' })
61
+ user: User
62
+
63
+ @Column({ name: 'user_id' })
64
+ userId: string
65
+
66
+ @OneToMany(() => OrderItem, item => item.order)
67
+ items: OrderItem[]
68
+
69
+ @CreateDateColumn()
70
+ createdAt: Date
71
+
72
+ @UpdateDateColumn()
73
+ updatedAt: Date
74
+
75
+ @DeleteDateColumn()
76
+ deletedAt?: Date
77
+ }
78
+ ```
79
+
80
+ ## Column Options
81
+
82
+ ```typescript
83
+ @Column({ length: 100 })
84
+ firstName: string
85
+
86
+ @Column({ type: 'decimal', precision: 10, scale: 2 })
87
+ price: number
88
+
89
+ @Column({ type: 'enum', enum: OrderStatus, default: OrderStatus.PENDING })
90
+ status: OrderStatus
91
+
92
+ @Column({ nullable: true })
93
+ description?: string
94
+ ```
95
+
96
+ ## Forbidden Patterns
97
+
98
+ - Auto-increment integer primary keys
99
+ - Missing timestamps
100
+ - Missing soft delete
101
+ - No explicit table name
102
+ - Relative imports