@joktec/skills 0.1.4 → 0.1.7

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 (47) hide show
  1. package/README.md +4 -2
  2. package/dist/claude/skills/advanced-typescript-design/SKILL.md +60 -0
  3. package/dist/claude/skills/advanced-typescript-design/agents/openai.yaml +4 -0
  4. package/dist/claude/skills/advanced-typescript-design/references/advanced.md +219 -0
  5. package/dist/claude/skills/advanced-typescript-design/references/simple.md +149 -0
  6. package/dist/claude/skills/joktec-mongo-skill/SKILL.md +9 -2
  7. package/dist/claude/skills/joktec-mongo-skill/references/repository.md +14 -11
  8. package/dist/claude/skills/joktec-mongo-skill/references/schema-and-plugins.md +43 -7
  9. package/dist/claude/skills/joktec-mysql-skill/SKILL.md +5 -2
  10. package/dist/claude/skills/joktec-mysql-skill/references/entities.md +59 -51
  11. package/dist/claude/skills/joktec-mysql-skill/references/repository.md +15 -1
  12. package/dist/claude/skills/joktec-tool-skill/references/tools.md +1 -0
  13. package/dist/codex/skills/advanced-typescript-design/SKILL.md +60 -0
  14. package/dist/codex/skills/advanced-typescript-design/agents/openai.yaml +4 -0
  15. package/dist/codex/skills/advanced-typescript-design/references/advanced.md +219 -0
  16. package/dist/codex/skills/advanced-typescript-design/references/simple.md +149 -0
  17. package/dist/codex/skills/joktec-mongo-skill/SKILL.md +9 -2
  18. package/dist/codex/skills/joktec-mongo-skill/references/repository.md +14 -11
  19. package/dist/codex/skills/joktec-mongo-skill/references/schema-and-plugins.md +43 -7
  20. package/dist/codex/skills/joktec-mysql-skill/SKILL.md +5 -2
  21. package/dist/codex/skills/joktec-mysql-skill/references/entities.md +59 -51
  22. package/dist/codex/skills/joktec-mysql-skill/references/repository.md +15 -1
  23. package/dist/codex/skills/joktec-tool-skill/references/tools.md +1 -0
  24. package/dist/copilot/.github/copilot-instructions.md +577 -71
  25. package/dist/cursor/.cursor/rules/advanced-typescript-design.mdc +437 -0
  26. package/dist/cursor/.cursor/rules/joktec-mongo-skill.mdc +66 -20
  27. package/dist/cursor/.cursor/rules/joktec-mysql-skill.mdc +79 -54
  28. package/dist/cursor/.cursor/rules/joktec-tool-skill.mdc +1 -0
  29. package/dist/gemini/GEMINI.md +579 -71
  30. package/dist/windsurf/.windsurf/rules/advanced-typescript-design.md +433 -0
  31. package/dist/windsurf/.windsurf/rules/joktec-mongo-skill.md +66 -20
  32. package/dist/windsurf/.windsurf/rules/joktec-mysql-skill.md +79 -54
  33. package/dist/windsurf/.windsurf/rules/joktec-tool-skill.md +1 -0
  34. package/package.json +6 -3
  35. package/scripts/sync-pack-version.mjs +38 -0
  36. package/skill-pack.json +35 -1
  37. package/skills/advanced-typescript-design/SKILL.md +60 -0
  38. package/skills/advanced-typescript-design/agents/openai.yaml +4 -0
  39. package/skills/advanced-typescript-design/references/advanced.md +219 -0
  40. package/skills/advanced-typescript-design/references/simple.md +149 -0
  41. package/skills/joktec-mongo-skill/SKILL.md +9 -2
  42. package/skills/joktec-mongo-skill/references/repository.md +14 -11
  43. package/skills/joktec-mongo-skill/references/schema-and-plugins.md +43 -7
  44. package/skills/joktec-mysql-skill/SKILL.md +5 -2
  45. package/skills/joktec-mysql-skill/references/entities.md +59 -51
  46. package/skills/joktec-mysql-skill/references/repository.md +15 -1
  47. package/skills/joktec-tool-skill/references/tools.md +1 -0
@@ -267,9 +267,16 @@ Use this skill for MongoDB-backed resources that rely on JokTec's Mongoose/Typeg
267
267
  - Keep schema classes, app repositories, and app-specific queries in the consumer app.
268
268
  - Extend `MongoRepo<T, ID>` for app repositories.
269
269
  - Preserve `conId` when the app has multiple Mongo connections.
270
- - Use schema-first decorators when a schema class should be reused as a DTO source.
270
+ - Use schema-first decorators when a schema class should be reused as a DTO source; wrappers should reduce repeated Typegoose, validator, transformer, and Swagger stacks.
271
+ - Use `RefId<T>` for stored reference id fields and `PopulatedRef<T>` for populated virtual fields.
272
+ - Use `@Schema({ kind: 'embedded' })` for value objects without `_id` or timestamps.
273
+ - Use `@Schema({ kind: 'subdocument' })` for embedded documents that need their own `_id` and timestamps.
274
+ - Use `@Prop({ kind: 'virtual', mode: 'getter' })` for computed getters that need expose/Swagger metadata without persistence.
275
+ - Use `@Prop({ ref: () => Target, foreignField, localField })` for populate-one virtuals when inferred defaults are enough.
276
+ - Use `@Prop({ type: () => [Target], ref: () => Target, foreignField, localField })` for populate-array virtuals.
277
+ - Use `@Prop({ kind: 'map', type: Object })` for map/snapshot payloads that must keep their raw shape.
271
278
  - Treat ObjectId casting and regex behavior as safety-sensitive.
272
- - If guidance is insufficient, read this skill's references and inspect `../joktec-framework` package source or GitHub fallback before assuming APIs.
279
+ - For real migrations, inspect `node_modules/@joktec/mongo` first, then installed README or GitHub package docs, then GitHub source before assuming APIs.
273
280
 
274
281
  ## References
275
282
 
@@ -286,16 +293,18 @@ Use this skill for MongoDB-backed resources that rely on JokTec's Mongoose/Typeg
286
293
 
287
294
  When blocked, inspect:
288
295
 
289
- - `packages/databases/mongo/README.md`
290
- - `packages/databases/mongo/AGENTS.md`
291
- - `packages/databases/mongo/src/index.ts`
292
- - `packages/databases/mongo/src/mongo.module.ts`
293
- - `packages/databases/mongo/src/mongo.service.ts`
294
- - `packages/databases/mongo/src/mongo.repo.ts`
295
- - `packages/databases/mongo/src/helpers/mongo.helper.ts`
296
- - `packages/databases/mongo/src/helpers/mongo.pipeline.ts`
297
- - `packages/databases/mongo/src/helpers/mongo.utils.ts`
298
- - `packages/databases/mongo/src/models/*`
296
+ - Consumer project first: `node_modules/@joktec/mongo`.
297
+ - Installed docs next: `node_modules/@joktec/mongo/README.md`.
298
+ - GitHub docs next: `https://github.com/joktec/joktec-framework/tree/main/packages/databases/mongo`.
299
+ - GitHub source fallback:
300
+ - `packages/databases/mongo/src/index.ts`
301
+ - `packages/databases/mongo/src/mongo.module.ts`
302
+ - `packages/databases/mongo/src/mongo.service.ts`
303
+ - `packages/databases/mongo/src/mongo.repo.ts`
304
+ - `packages/databases/mongo/src/helpers/mongo.helper.ts`
305
+ - `packages/databases/mongo/src/helpers/mongo.pipeline.ts`
306
+ - `packages/databases/mongo/src/helpers/mongo.utils.ts`
307
+ - `packages/databases/mongo/src/models/*`
299
308
 
300
309
  ## Module Setup
301
310
 
@@ -317,7 +326,8 @@ Repository checklist:
317
326
  - Keep schema-specific query helpers in the app repository, not in controllers.
318
327
  - Use repository methods for standard reads so query parsing, soft delete, populate, and pagination stay consistent.
319
328
  - Pass transaction/session options through read-modify-write flows when the app uses transactions.
320
- - Normalize returned documents through repository/service response paths so ObjectId values do not leak unexpectedly into DTOs.
329
+ - Repository read paths should return schema class instances with normalized ObjectId/string values, including populated and deep-populated values.
330
+ - Code that needs raw Mongoose documents should use `MongoService.getModel(...)` or Typegoose/Mongoose APIs directly.
321
331
 
322
332
  ## Query Safety
323
333
 
@@ -352,13 +362,20 @@ Cursor checklist:
352
362
 
353
363
  When blocked, inspect:
354
364
 
355
- - `packages/databases/mongo/src/decorators/scheme.decorator.ts`
356
- - `packages/databases/mongo/src/decorators/prop.decorator.ts`
357
- - `packages/databases/mongo/src/decorators/props/*`
358
- - `packages/databases/mongo/src/models/mongo.schema.ts`
359
- - `packages/databases/mongo/src/plugins/paranoid.plugin.ts`
360
- - `packages/databases/mongo/src/plugins/strict-reference.plugin.ts`
361
- - `packages/databases/mongo/src/plugins/transform.plugin.ts`
365
+ - Consumer project first: `node_modules/@joktec/mongo`.
366
+ - Package docs next: `node_modules/@joktec/mongo/README.md`.
367
+ - GitHub docs next: `https://github.com/joktec/joktec-framework/tree/main/packages/databases/mongo`.
368
+ - GitHub source fallback:
369
+ - `packages/databases/mongo/src/decorators/schema.decorator.ts`
370
+ - `packages/databases/mongo/src/decorators/schema.options.ts`
371
+ - `packages/databases/mongo/src/decorators/prop.decorator.ts`
372
+ - `packages/databases/mongo/src/decorators/props/*`
373
+ - `packages/databases/mongo/src/models/mongo.ref.ts`
374
+ - `packages/databases/mongo/src/models/object-id.ts`
375
+ - `packages/databases/mongo/src/models/mongo.schema.ts`
376
+ - `packages/databases/mongo/src/plugins/paranoid.plugin.ts`
377
+ - `packages/databases/mongo/src/plugins/strict-reference.plugin.ts`
378
+ - `packages/databases/mongo/src/plugins/transform.plugin.ts`
362
379
 
363
380
  ## Schema Decorators
364
381
 
@@ -373,6 +390,35 @@ Best practice:
373
390
  - Pass custom validators/transforms explicitly rather than adding hidden global behavior.
374
391
  - Keep maps, snapshots, and dynamic objects explicit so helper conversion does not alter their shape.
375
392
  - Keep app-level reference semantics visible; strict reference plugin checks existence, but the app still owns domain rules.
393
+ - Use `RefId<T>` for persisted id fields and `PopulatedRef<T>` for populated virtual instance fields.
394
+ - Use lazy `type` resolvers such as `type: () => User` or `type: () => [User]` when the wrapper cannot infer the runtime class.
395
+ - Use `@Schema({ kind: 'embedded' })` for value objects without `_id` or timestamps.
396
+ - Use `@Schema({ kind: 'subdocument' })` for embedded documents that need `_id` and timestamps but should not create a collection.
397
+ - Use `@Prop({ kind: 'virtual', mode: 'getter', comment, optional, hidden, expose, swagger })` for computed getters that only need class-transformer and Swagger metadata.
398
+ - Use `@Prop({ ref: () => User, foreignField, localField })` for populate-one virtuals when inferred defaults are enough.
399
+ - Use `@Prop({ type: () => [User], ref: () => User, foreignField, localField })` for populate-array virtuals.
400
+ - Use `@Prop({ kind: 'map', type: Object })` for raw maps/snapshots instead of passing `PropType.MAP` at the call site.
401
+
402
+ Common mappings:
403
+
404
+ | Use case | Preferred shape |
405
+ | --- | --- |
406
+ | Stored single reference id | `fieldId?: RefId<User>` with `@Prop({ type: ObjectId, ref: () => User })` |
407
+ | Stored reference id array | `fieldIds?: RefId<User>[]` with `@Prop({ type: [ObjectId], ref: () => User })` |
408
+ | Embedded value object | `@Schema({ kind: 'embedded' })` on the nested class |
409
+ | Embedded document | `@Schema({ kind: 'subdocument' })` on the nested class |
410
+ | Raw map/snapshot | `@Prop({ kind: 'map', type: Object })` |
411
+ | Populated single virtual | `field?: PopulatedRef<User>` with `@Prop({ ref: () => User, foreignField: '_id', localField: 'fieldId' })` |
412
+ | Populated virtual array | `fields?: PopulatedRef<User>[]` with `@Prop({ type: () => [User], ref: () => User, foreignField: '_id', localField: 'fieldIds' })` |
413
+ | Computed getter | `@Prop({ kind: 'virtual', mode: 'getter', comment: '...' }) get value() { ... }` |
414
+
415
+ Populate inference:
416
+
417
+ - `ref` + `localField` + `foreignField` marks the field as virtual populate.
418
+ - Populate-one can fallback to the same class from `ref`.
419
+ - Populate arrays still need `type: () => [Target]` because runtime reflection only sees `Array`.
420
+ - `justOne` defaults to `true` for non-array populate fields.
421
+ - Swagger examples default to `{}` or `[]` for populated fields unless explicitly overridden.
376
422
 
377
423
  ## Plugins
378
424
 
@@ -409,8 +455,11 @@ Use this skill for relational resources backed by JokTec's TypeORM wrapper.
409
455
  - Treat `mysql`, `mariadb`, and `postgres` as the first-class dialects.
410
456
  - Keep `sync` explicit and normally enabled only by an owner process or development bootstrap.
411
457
  - Do not add new behavior to deprecated `MysqlFinder`; use `MysqlRepo.qb()` and `MysqlHelper` paths.
412
- - When migrating an entity to the new schema-first decorators, migrate the whole property decorator stack, not only the TypeORM primary key decorator.
413
- - If guidance is insufficient, read this skill's references and inspect `../joktec-framework` package source or GitHub fallback before assuming APIs.
458
+ - Use schema-first `@Column`, `@PrimaryColumn`, and `@TimestampColumn` wrappers when an entity also acts as DTO metadata.
459
+ - Use `@Column({ kind: 'virtual' })` for computed getters that need expose/Swagger metadata without persistence.
460
+ - Use `immutable` for API read-only metadata; TypeORM `update: false` remains storage write behavior and is also inferred as Swagger read-only when `immutable` is not set.
461
+ - Do not use `@joktec/mysql` for Mongo/ObjectId columns, even though TypeORM has Mongo-related APIs.
462
+ - For real migrations, inspect the installed `@joktec/mysql` source in the consumer project's `node_modules` first. If that is insufficient, read GitHub package docs, then GitHub source. Use the local `../joktec-framework` checkout only when you are working inside the JokTec development workspace.
414
463
 
415
464
  ## References
416
465
 
@@ -425,13 +474,29 @@ Use this skill for relational resources backed by JokTec's TypeORM wrapper.
425
474
 
426
475
  ## Source Lookup
427
476
 
428
- When blocked, inspect:
477
+ When blocked in a consumer project, inspect the installed package first:
478
+
479
+ - `node_modules/@joktec/mysql/README.md`
480
+ - `node_modules/@joktec/mysql/AGENTS.md` when published with the package
481
+ - `node_modules/@joktec/mysql/dist/index.d.ts`
482
+ - `node_modules/@joktec/mysql/dist/decorators/column.decorator.d.ts`
483
+ - `node_modules/@joktec/mysql/dist/decorators/columns/column.type.d.ts`
484
+ - `node_modules/@joktec/mysql/dist/decorators/timestamp.decorator.d.ts`
485
+
486
+ If the installed package is missing enough detail, use the GitHub package docs next:
487
+
488
+ - `https://github.com/joktec/joktec-framework/tree/main/packages/databases/mysql`
489
+
490
+ Use GitHub source only after package docs and installed types are not enough:
429
491
 
430
492
  - `packages/databases/mysql/src/decorators/table.decorator.ts`
431
493
  - `packages/databases/mysql/src/decorators/column.decorator.ts`
432
494
  - `packages/databases/mysql/src/decorators/columns/column.type.ts`
433
495
  - `packages/databases/mysql/src/decorators/columns/column.factory.ts`
434
496
  - `packages/databases/mysql/src/decorators/columns/primary.column.ts`
497
+ - `packages/databases/mysql/src/decorators/columns/timestamp.column.ts`
498
+ - `packages/databases/mysql/src/decorators/columns/virtual.column.ts`
499
+ - `packages/databases/mysql/src/decorators/columns/object.column.ts`
435
500
  - `packages/databases/mysql/src/decorators/columns/string.column.ts`
436
501
  - `packages/databases/mysql/src/decorators/columns/number.column.ts`
437
502
  - `packages/databases/mysql/src/decorators/columns/transform.column.ts`
@@ -439,7 +504,7 @@ When blocked, inspect:
439
504
 
440
505
  ## Schema-First Entity Pattern
441
506
 
442
- Use `@Tables`, `@Column`, and `@PrimaryColumn` from `@joktec/mysql` when an entity should also act as the source class for mapped DTOs.
507
+ Use `@Tables`, `@Column`, `@PrimaryColumn`, and `@TimestampColumn` from `@joktec/mysql` when an entity should also act as the source class for mapped DTOs.
443
508
 
444
509
  The new decorators are not thin TypeORM aliases. They are schema-first wrappers that compose:
445
510
 
@@ -448,11 +513,18 @@ The new decorators are not thin TypeORM aliases. They are schema-first wrappers
448
513
  - `class-transformer` expose/exclude behavior.
449
514
  - Swagger property metadata.
450
515
 
451
- When migrating old entities, remove duplicate property decorators from `typeorm`, `class-validator`, `class-transformer`, and Swagger when the wrapper option can represent the same behavior.
516
+ The wrapper can also represent virtual computed getters and nested JSON/jsonb class payloads. Do not use this package for Mongo/ObjectId columns.
517
+
518
+ Wrapper philosophy:
452
519
 
453
- ## Legacy Decorator Migration
520
+ - prefer one schema declaration that carries persistence, validation, transform, and Swagger metadata
521
+ - use wrapper options before duplicating `@ApiProperty`, `@Expose`, `@Type`, or common validators
522
+ - use raw TypeORM only for advanced cases that the wrapper does not model cleanly
523
+ - keep storage write behavior and API documentation behavior distinct when needed
454
524
 
455
- Migrate a whole property at a time. Do not only replace `PrimaryGeneratedColumn`.
525
+ ## Current Decorator Capabilities
526
+
527
+ Use the package README and actual installed source for full migration details. This skill only keeps the common mappings that help an agent recognize old patterns.
456
528
 
457
529
  Common mappings:
458
530
 
@@ -461,11 +533,21 @@ Common mappings:
461
533
  | `@PrimaryGeneratedColumn()` | `@PrimaryColumn('increment')` |
462
534
  | `@PrimaryGeneratedColumn('uuid')` | `@PrimaryColumn('uuid')` |
463
535
  | app-generated ordered UUID id | `@PrimaryColumn('uuidv7')` |
536
+ | `@CreateDateColumn(...)` | `@TimestampColumn('create', ...)` |
537
+ | `@UpdateDateColumn(...)` | `@TimestampColumn('update', ...)` |
538
+ | `@DeleteDateColumn(...)` | `@TimestampColumn('delete', ...)` |
539
+ | TypeORM `@VersionColumn(...)` | `@Column({ kind: 'version', ... })` |
540
+ | TypeORM `@VirtualColumn(...)` | `@Column({ kind: 'virtual', mode: 'sql', query, ... })` |
541
+ | TypeORM `@ViewColumn(...)` | `@Column({ kind: 'view', ... })` |
464
542
  | `@Column(...)` | `@Column(...)` from `@joktec/mysql` |
543
+ | `@RelationId(...)` | `@Column({ kind: 'relation-id', relationId })` |
465
544
  | `@IsNotEmpty()` | `@Column({ required: true })` |
466
545
  | `@IsOptional()` | `@Column({ required: false })` or nullable TypeORM option when storage allows null |
467
546
  | `@IsEmail()` | `@Column({ isEmail: true })` |
468
547
  | `@IsMobilePhone()` | `@Column({ isPhone: true })` |
548
+ | `@IsInt()` | `@Column({ isInt: true })` or an integer column type |
549
+ | `@IsUUID()` | `@Column({ isUUID: true })` |
550
+ | `@IsObject()` | `@Column({ isObject: true })` or a JSON column |
469
551
  | `@IsHexColor()` | `@Column({ isHexColor: true })` |
470
552
  | `@IsUrl()` | `@Column({ isUrl: true })` |
471
553
  | `@MinLength(n)` | `@Column({ minLength: n })` |
@@ -476,53 +558,28 @@ Common mappings:
476
558
  | `@Expose({ groups })` | `@Column({ groups })` |
477
559
  | `@Exclude({ toPlainOnly: true })` plus hidden Swagger | `@Column({ hidden: true })` |
478
560
  | `@ApiProperty(...)` | `@Column({ swagger: ... })`, or native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength` |
561
+ | `@ValidateNested()` + `@Type(() => Preference)` | `@Column('jsonb', { nested: Preference })` |
562
+ | `@ValidateNested({ each: true })` + `@Type(() => Preference)` | `@Column('jsonb', { nested: Preference, each: true })` |
563
+ | `@Expose()` + `@ApiProperty(...)` on a getter | `@Column({ kind: 'virtual', ... })` |
564
+ | Swagger `readOnly: true` | `@Column({ immutable: true })` or TypeORM `update: false` when ORM updates must also be blocked |
479
565
 
480
- Preserve decorators only when the wrapper cannot express them, by passing them through `decorators: [...]`.
481
-
482
- Migration checklist:
483
-
484
- - Replace TypeORM column decorators with wrappers from `@joktec/mysql`.
485
- - Remove duplicate `class-validator` decorators when equivalent wrapper options exist.
486
- - Remove duplicate `class-transformer` decorators when `hidden` or `groups` expresses the same behavior.
487
- - Move Swagger examples/descriptions/limits into wrapper options where possible.
488
- - Preserve custom validators/transforms only through `decorators: [...]`.
489
- - Keep database-specific options such as `type`, `length`, `nullable`, `unique`, `default`, `enum`, and `comment`.
490
- - Rebuild and run entity-related tests after migration because DTO metadata and TypeORM metadata both change.
491
-
492
- Example migration:
493
-
494
- ```ts
495
- // Before
496
- @Column({ type: 'varchar', length: 255 })
497
- @IsEmail()
498
- @IsNotEmpty()
499
- @Expose()
500
- @ApiProperty({ example: 'user@example.com' })
501
- email!: string;
502
-
503
- // After
504
- @Column('varchar', {
505
- length: 255,
506
- required: true,
507
- isEmail: true,
508
- example: 'user@example.com',
509
- })
510
- email!: string;
511
- ```
566
+ ## Read-Only Metadata
512
567
 
513
- For hidden fields:
568
+ `immutable` is the API read-only hint used by the JokTec MySQL wrapper. TypeORM `update: false` is the ORM write behavior. The wrapper maps both to Swagger `readOnly` when appropriate:
514
569
 
515
- ```ts
516
- // Before
517
- @Column({ type: 'varchar', length: 255 })
518
- @Exclude({ toPlainOnly: true })
519
- @ApiHideProperty()
520
- password!: string;
570
+ - `immutable` has priority over `update: false`
571
+ - `update: false` implies Swagger `readOnly` only when `immutable` is not set
572
+ - `swagger.readOnly` remains the final explicit override
521
573
 
522
- // After
523
- @Column('varchar', { length: 255, hidden: true })
524
- password!: string;
525
- ```
574
+ Some field kinds default to API read-only because they are system-managed or computed:
575
+
576
+ - primary keys
577
+ - timestamp columns
578
+ - version columns
579
+ - view columns
580
+ - virtual getter and SQL virtual columns
581
+ - relation-id columns
582
+ - tree level columns
526
583
 
527
584
  ## Primary Keys
528
585
 
@@ -543,7 +600,21 @@ The stable dialects are MySQL, MariaDB, and Postgres. Dialect capabilities own d
543
600
 
544
601
  ## Source Lookup
545
602
 
546
- When blocked, inspect:
603
+ When blocked in a consumer project, inspect installed package docs and types first:
604
+
605
+ - `node_modules/@joktec/mysql/README.md`
606
+ - `node_modules/@joktec/mysql/AGENTS.md` when published with the package
607
+ - `node_modules/@joktec/mysql/dist/index.d.ts`
608
+ - `node_modules/@joktec/mysql/dist/mysql.module.d.ts`
609
+ - `node_modules/@joktec/mysql/dist/mysql.service.d.ts`
610
+ - `node_modules/@joktec/mysql/dist/mysql.repo.d.ts`
611
+ - `node_modules/@joktec/mysql/dist/models/mysql.request.d.ts`
612
+
613
+ If the installed package is insufficient, read GitHub package docs next:
614
+
615
+ - `https://github.com/joktec/joktec-framework/tree/main/packages/databases/mysql`
616
+
617
+ Use GitHub source only after installed types and package docs are not enough:
547
618
 
548
619
  - `packages/databases/mysql/README.md`
549
620
  - `packages/databases/mysql/AGENTS.md`
@@ -942,6 +1013,7 @@ Best practice:
942
1013
  - Use the package service for outbound HTTP so retry/proxy/metrics behavior stays centralized.
943
1014
  - Keep external endpoint URLs and credentials in runtime config.
944
1015
  - Be careful with ESM/CommonJS import changes in HTTP/Axios ecosystem packages.
1016
+ - `HttpService.buildAgent(proxy, opts)` expects proxy identity in `HttpProxyConfig` and agent tuning in Node `AgentOptions`; inspect the installed source before adapting to proxy-agent major-version changes.
945
1017
  - Test request behavior with mocks unless the test is an explicit consumer integration scenario.
946
1018
 
947
1019
  ## File
@@ -969,3 +1041,439 @@ Best practice:
969
1041
  - Do not scatter raw Axios instances across the app when `@joktec/http` should own shared behavior.
970
1042
  - Do not commit webhook URLs or proxy credentials.
971
1043
  - Do not use tool packages as hidden places for app business rules.
1044
+
1045
+ ---
1046
+
1047
+ ## Advanced TypeScript Design
1048
+
1049
+ Packages: TypeScript, NestJS
1050
+
1051
+ ## Overview
1052
+
1053
+ Act as a TypeScript architecture partner. Choose the simplest design that preserves clear boundaries, runtime correctness, and useful compile-time guarantees.
1054
+
1055
+ Use design patterns as vocabulary and pressure tests, not as decoration. Prefer local project conventions, readable APIs, and low-friction extension points before adding type-level machinery.
1056
+
1057
+ ## Architectural Mindset
1058
+
1059
+ - Start from the domain boundary: identify entity, request/response, service, repository, client, decorator, loader, and integration responsibilities.
1060
+ - Keep public APIs narrow and stable. Make extension explicit through interfaces, abstract classes, generic constraints, or composition.
1061
+ - Use classes when lifecycle, inheritance hooks, decorators, or framework reflection matter. Use plain functions/types when behavior is stateless or purely transformational.
1062
+ - Let runtime validation and compile-time types reinforce each other. Do not pretend TypeScript types validate untrusted runtime data.
1063
+ - Do not assume TypeScript generics, interfaces, unions, or array element types exist at runtime through `reflect-metadata`.
1064
+ - Escalate type complexity only when it removes real duplication, prevents invalid states, or makes an API substantially safer.
1065
+ - Check existing code before inventing a new pattern; mirror the repository's style when it already solves the same class of problem.
1066
+
1067
+ ## Public API Compatibility
1068
+
1069
+ - Treat exported types, classes, decorators, config objects, modules, and provider APIs as public contracts.
1070
+ - Prefer additive changes over breaking renames, deleted fields, changed generic parameter order, or narrower accepted input shapes.
1071
+ - Before changing exported generic types, check downstream inference from normal call sites and verify that common extension patterns still compile.
1072
+ - If a breaking type or runtime contract change is unavoidable, report migration impact explicitly and include the smallest migration path.
1073
+
1074
+ ## Pattern Vocabulary
1075
+
1076
+ Use the classic catalog as shared language, including the TypeScript examples catalog from Refactoring.Guru.
1077
+
1078
+ - Creational Patterns: Abstract Factory, Builder, Factory Method, Prototype, Singleton.
1079
+ - Structural Patterns: Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy.
1080
+ - Behavioral Patterns: Chain of Responsibility, Iterator, Memento, State, Template Method, Command, Mediator, Observer, Strategy, Visitor.
1081
+
1082
+ Treat pattern names as a starting point for design discussion. Validate whether the implementation needs the pattern's tradeoffs, or whether a direct function, data object, or interface is enough.
1083
+
1084
+ ## Agent Workflow
1085
+
1086
+ 1. Inspect local code first when working inside a repository. Look for existing abstractions, decorators, DTO types, factory functions, lifecycle hooks, and tests.
1087
+ 2. Classify the task:
1088
+ - Use `references/simple.md` for everyday TypeScript, OOP, data modeling, classes, interfaces, types, records, maps, arrays, simple decorators, and pragmatic refactors.
1089
+ - Use `references/advanced.md` for generic framework code, recursive mapped types, `infer`, distributed/deferred conditional types, reflection metadata, advanced decorators, type-safe builders, plugin architectures, or expert pattern selection.
1090
+ 3. Choose the least complex pattern that solves the force in front of you. Record why a simpler alternative was not enough when choosing advanced machinery.
1091
+ 4. Design the public surface before implementation: inputs, outputs, extension points, error behavior, lifecycle, and type inference experience.
1092
+ 5. Implement incrementally. Keep runtime behavior testable, and add focused type-level checks when exported generic or decorator behavior is subtle.
1093
+ 6. Review for overengineering: remove unused generic parameters, speculative base classes, unnecessary inheritance, and type utilities that do not protect a real API.
1094
+
1095
+ ## Repository Signals
1096
+
1097
+ In JokTec-style TypeScript, expect patterns such as:
1098
+
1099
+ - Generic request/query types with recursive conditions and sort/populate typing.
1100
+ - Factory functions that return decorated NestJS classes.
1101
+ - Abstract services and clients with template methods for lifecycle-specific behavior.
1102
+ - Decorator factories that compose validation, Swagger, transformation, metrics, and integration metadata.
1103
+ - Loader/registry patterns that collect decorator metadata and wire runtime behavior during module initialization.
1104
+
1105
+ ## Bundled References
1106
+
1107
+ ### references/advanced.md
1108
+
1109
+ # Advanced TypeScript Design Guidance
1110
+
1111
+ Use this reference for framework-level TypeScript, generic libraries, decorator infrastructure, metadata-driven loaders, and APIs where compile-time inference is part of the product experience.
1112
+
1113
+ ## Escalation Criteria
1114
+
1115
+ Reach for advanced TypeScript only when at least one is true:
1116
+
1117
+ - The API is reused widely and type inference prevents real misuse.
1118
+ - The runtime model is already generic, recursive, or metadata-driven.
1119
+ - The abstraction eliminates repeated boilerplate across many entities, DTOs, repositories, services, clients, or transports.
1120
+ - The type-level design mirrors a stable domain contract, not a speculative future.
1121
+ - Tests or examples can prove both runtime behavior and developer ergonomics.
1122
+
1123
+ If the advanced type exists only to feel clever, delete it.
1124
+
1125
+ ## Infer, Conditional, and Deferred Types
1126
+
1127
+ - Use `infer` to extract return types, payloads, entity types, DTO shapes, tuple elements, and callback signatures from source contracts.
1128
+ - Control distributive conditional types intentionally. Wrap operands in tuples, such as `[T] extends [U]`, when union distribution is not wanted.
1129
+ - Prefer named intermediate aliases when nested conditionals exceed two branches.
1130
+ - Use `never` as a filter, but verify that it cannot erase useful error information from public APIs.
1131
+ - Treat deferred conditional types and generic inference as public UX: callers should get helpful autocomplete and errors without manual type arguments.
1132
+
1133
+ ## Recursive and Mapped Types
1134
+
1135
+ - Use recursive mapped types for query languages, nested sort/select/populate APIs, deep partials, and entity graph traversal.
1136
+ - Add clear stop conditions for primitives, dates, arrays, functions, and branded values.
1137
+ - Use branded or opaque types for special primitives such as `ObjectId`, `UserId`, tenant IDs, cursors, or external reference IDs when plain strings would blur domain boundaries.
1138
+ - Avoid infinite or overly expensive type recursion. Keep recursion shallow enough for editor performance.
1139
+ - Preserve optionality and readonly modifiers intentionally with `+?`, `-?`, `readonly`, and `-readonly`.
1140
+ - Separate query operator typing from entity typing so the operator model remains testable and reusable.
1141
+
1142
+ ## Reflection and Decorators
1143
+
1144
+ - Use `reflect-metadata` only when runtime type information materially improves the API: schema generation, validation composition, serialization, dependency injection, or loader registration.
1145
+ - Remember that reflected TypeScript types are lossy at runtime. Arrays, unions, generics, and interfaces need explicit options or factories.
1146
+ - Prefer decorator factories that normalize options, resolve type factories, compose framework decorators, and define one clear metadata contract.
1147
+ - Keep advanced decorators thin at the call site and explicit internally: clone options, sanitize runtime-only fields, then compose validators, transformers, docs, and persistence metadata.
1148
+ - For method decorators, preserve `this`, return values, thrown errors, and async behavior unless the decorator explicitly changes them.
1149
+ - Use function source parsing only as a last-resort runtime technique for decorator infrastructure, such as mapping method argument names. Keep it isolated, deterministic, and covered by tests because minification, transpilation, defaults, destructuring, and comments can break it.
1150
+ - Test decorator behavior through a class that uses it, especially for metadata, wrapping behavior, and dependency injection.
1151
+
1152
+ ## Type-Level Verification
1153
+
1154
+ - Add type-level tests when changing exported generic utilities, query DSLs, decorators, builders, or public inference-heavy APIs.
1155
+ - Prefer the project's existing compile/type test setup. If available, use `tsd`, `expect-type`, `vitest`/`jest` type helpers, or a dedicated `tsc --noEmit` fixture.
1156
+ - Include positive inference examples from normal call sites, not only explicit generic arguments.
1157
+ - Include negative examples with `@ts-expect-error` when an invalid state must stay rejected.
1158
+ - Verify runtime tests separately when decorators, reflection metadata, validation, transformation, or loaders are involved.
1159
+
1160
+ ## Expert Pattern Selection
1161
+
1162
+ - Abstract Factory fits families of related clients, repositories, or transport adapters that must be created consistently.
1163
+ - Builder fits fluent configuration with required-step guarantees; type-state builders can enforce completeness but should stay readable.
1164
+ - Factory Method fits framework hooks that create DTOs, pagination wrappers, controllers, or provider instances.
1165
+ - Prototype fits cloning configured objects when construction is expensive or stateful.
1166
+ - Singleton should usually be delegated to the DI container; avoid hand-rolled global state.
1167
+ - Adapter fits third-party client normalization and migration layers.
1168
+ - Bridge fits separating abstraction from implementation, such as transport-agnostic messaging APIs over Rabbit, Kafka, or Redis.
1169
+ - Composite fits tree-shaped filters, pipelines, menu/routes, or nested query conditions.
1170
+ - Decorator fits metrics, retries, circuit breakers, serialization, validation, or publishing side effects around existing behavior.
1171
+ - Facade fits a stable service hiding multiple low-level collaborators.
1172
+ - Flyweight fits large repeated metadata or schema objects only after measuring memory pressure.
1173
+ - Proxy fits lazy clients, caching, access control, retries, and remote boundaries.
1174
+ - Chain of Responsibility fits validation, middleware, parsing, and request pipelines.
1175
+ - Command fits queued work, replayable operations, and undoable actions.
1176
+ - Iterator fits cursor pagination and collection traversal without exposing storage details.
1177
+ - Mediator fits module coordination where direct dependencies would become tangled.
1178
+ - Memento fits snapshots, rollbacks, and state restoration.
1179
+ - Observer fits event streams and pub/sub, with explicit unsubscribe and error policy.
1180
+ - State fits lifecycle-heavy clients, jobs, or connections with mode-specific behavior.
1181
+ - Strategy fits interchangeable algorithms selected by config or runtime context.
1182
+ - Template Method fits abstract base services/clients that own lifecycle while subclasses implement `init`, `start`, `stop`, `validate`, or `transform` steps.
1183
+ - Visitor fits operations over stable object structures when adding new operations is more common than adding new node types.
1184
+
1185
+ ## Symbolic Examples
1186
+
1187
+ Use examples like these as compact templates for thinking. Keep production implementations smaller or larger depending on the actual force.
1188
+
1189
+ ### Type-Safe Event Map
1190
+
1191
+ ```typescript
1192
+ type EventMap = {
1193
+ "user.created": { id: string };
1194
+ "invoice.paid": { invoiceId: string; amount: number };
1195
+ };
1196
+
1197
+ class EventBus<TEvents extends Record<string, unknown>> {
1198
+ on<K extends keyof TEvents>(event: K, handler: (payload: TEvents[K]) => void) {}
1199
+ emit<K extends keyof TEvents>(event: K, payload: TEvents[K]) {}
1200
+ }
1201
+
1202
+ const bus = new EventBus<EventMap>();
1203
+ bus.emit("invoice.paid", { invoiceId: "inv_1", amount: 100 });
1204
+ ```
1205
+
1206
+ Use this for Observer/Mediator-style APIs where event names and payloads must stay coupled.
1207
+
1208
+ ### API Contract Inference
1209
+
1210
+ ```typescript
1211
+ type Endpoint = {
1212
+ "/users/:id": {
1213
+ GET: { params: { id: string }; response: User };
1214
+ PATCH: { params: { id: string }; body: Partial<User>; response: User };
1215
+ };
1216
+ };
1217
+
1218
+ type ResponseOf<T> = T extends { response: infer R } ? R : never;
1219
+
1220
+ class ApiClient<TContract extends Record<string, any>> {
1221
+ request<Path extends keyof TContract, Method extends keyof TContract[Path]>(
1222
+ path: Path,
1223
+ method: Method,
1224
+ ): Promise<ResponseOf<TContract[Path][Method]>> {
1225
+ return null as any;
1226
+ }
1227
+ }
1228
+ ```
1229
+
1230
+ Use this when a contract object should drive call-site inference.
1231
+
1232
+ ### Type-State Builder
1233
+
1234
+ ```typescript
1235
+ type With<K extends string> = Record<K, true>;
1236
+
1237
+ class JobBuilder<State = {}> {
1238
+ queue(name: string): JobBuilder<State & With<"queue">> {
1239
+ return this as any;
1240
+ }
1241
+
1242
+ handler(fn: () => Promise<void>): JobBuilder<State & With<"handler">> {
1243
+ return this as any;
1244
+ }
1245
+
1246
+ build(this: State extends With<"queue"> & With<"handler"> ? JobBuilder<State> : never) {
1247
+ return {};
1248
+ }
1249
+ }
1250
+ ```
1251
+
1252
+ Use this when incomplete configuration is common and worth rejecting at compile time.
1253
+
1254
+ ### Recursive Query Shape
1255
+
1256
+ ```typescript
1257
+ type Primitive = string | number | boolean | Date;
1258
+ type FieldOp<T> = T | { $eq?: T; $in?: T[] };
1259
+ type Brand<T, Name extends string> = T & { readonly __brand: Name };
1260
+ type ObjectId = Brand<string, "ObjectId">;
1261
+
1262
+ type Query<T> = {
1263
+ [K in keyof T]?: T[K] extends Primitive
1264
+ ? FieldOp<T[K]>
1265
+ : T[K] extends Array<infer U>
1266
+ ? Query<U>
1267
+ : Query<T[K]>;
1268
+ } & {
1269
+ $or?: Query<T>[];
1270
+ };
1271
+ ```
1272
+
1273
+ Use this for Composite-style nested filters, but add stop conditions before expanding it.
1274
+
1275
+ ### Opaque ID Boundary
1276
+
1277
+ ```typescript
1278
+ type Brand<T, Name extends string> = T & { readonly __brand: Name };
1279
+ type UserId = Brand<string, "UserId">;
1280
+ type PostId = Brand<string, "PostId">;
1281
+
1282
+ function asUserId(value: string): UserId {
1283
+ return value as UserId;
1284
+ }
1285
+
1286
+ function findUser(id: UserId) {}
1287
+
1288
+ findUser(asUserId("u_1"));
1289
+ // @ts-expect-error raw strings are not accepted here
1290
+ findUser("u_1");
1291
+ ```
1292
+
1293
+ Use this when a domain primitive crosses many generic/query layers and accidental mixing would be costly.
1294
+
1295
+ ### Decorator Wrapper with Preserved Method Contract
1296
+
1297
+ ```typescript
1298
+ function Around(run: (next: () => unknown) => unknown): MethodDecorator {
1299
+ return (_, __, descriptor) => {
1300
+ const original = descriptor.value;
1301
+
1302
+ descriptor.value = function (...args: unknown[]) {
1303
+ return run(() => original.apply(this, args));
1304
+ };
1305
+ };
1306
+ }
1307
+ ```
1308
+
1309
+ Use this for metrics, retry, logging, or publishing side effects; preserve `this`, args, return values, and thrown errors.
1310
+
1311
+ ## JokTec-Style Signals to Reuse
1312
+
1313
+ - Recursive query typing can combine entity properties with operator unions, nested entity traversal, and logical `$or`/`$and` shapes.
1314
+ - Base services and clients commonly use Template Method: the base class owns lifecycle and shared behavior while subclasses provide specific implementation steps.
1315
+ - Controller factories can return decorated classes to avoid repetitive NestJS endpoint scaffolding while preserving DTO-specific metadata.
1316
+ - Decorator infrastructure often composes Swagger, validation, transformation, persistence, and metric behavior from one options object.
1317
+ - Rabbit loaders show a metadata registry plus module-init loader pattern: decorators declare intent; loaders resolve providers and connect runtime consumers.
1318
+
1319
+ ## Advanced Review Checklist
1320
+
1321
+ - Does every generic parameter appear in the public contract or implementation?
1322
+ - Can inference succeed from normal call-site arguments?
1323
+ - Does the type-level model match runtime validation and transformation?
1324
+ - Are metadata keys centralized and collision-resistant?
1325
+ - Are decorator side effects documented by tests?
1326
+ - Is editor performance acceptable after adding recursive or conditional types?
1327
+ - Is there a simpler Strategy, Adapter, or function-based design that would provide the same value?
1328
+
1329
+ ### references/simple.md
1330
+
1331
+ # Simple TypeScript Design Guidance
1332
+
1333
+ Use this reference for ordinary application and library work where readability, stable APIs, and maintainable TypeScript matter more than type-level cleverness.
1334
+
1335
+ ## Default Practices
1336
+
1337
+ - Prefer explicit, small interfaces for public boundaries and concrete classes for runtime behavior with lifecycle, dependency injection, or decorators.
1338
+ - Use `type` for unions, mapped shapes, conditional aliases, and composition. Use `interface` for object contracts intended to be implemented or extended.
1339
+ - Keep primitive aliases meaningful. A `UserId` alias can clarify intent, but it does not add runtime safety unless paired with validation or branding.
1340
+ - Model data with plain objects when behavior is absent. Add classes when construction, methods, inheritance hooks, decorators, or framework reflection are required.
1341
+ - Keep DTOs, entities, requests, and responses separate when they have different validation, persistence, or transport concerns.
1342
+ - Avoid `any` at public boundaries. Use `unknown` for untrusted data, then narrow or validate it.
1343
+ - Prefer narrow generic constraints such as `T extends Entity` over unconstrained `T` when the implementation depends on object semantics.
1344
+
1345
+ ## Classes, Interfaces, and OOP
1346
+
1347
+ - Use abstract classes for shared runtime behavior, protected hooks, and constructor-injected dependencies.
1348
+ - Use interfaces for contracts that should not carry runtime behavior.
1349
+ - Prefer composition over inheritance when variants differ by collaborator rather than lifecycle.
1350
+ - Keep protected hooks purposeful: `afterInit`, `transform`, `validate`, and `map` are good when subclasses are expected to customize one stable step.
1351
+ - Avoid deep inheritance chains. If a third level appears, consider Strategy, Adapter, or composition.
1352
+
1353
+ ## Common Data Structures
1354
+
1355
+ - Use `Record<K, V>` when the key set is known or constrained.
1356
+ - Use `{ [key: string]: V }` when the object is truly open-ended.
1357
+ - Use `Map<K, V>` when keys are not strings, insertion order matters, or frequent add/remove operations are central.
1358
+ - Use arrays for ordered collections and tuples for fixed positional contracts.
1359
+ - Use discriminated unions for state or command variants instead of loose booleans.
1360
+ - Keep hash-like caches private unless callers need iteration, eviction, or explicit lifecycle.
1361
+
1362
+ ## Basic Types and Utilities
1363
+
1364
+ - Use union literals for finite options: status, mode, operation, direction.
1365
+ - Use `Pick`, `Omit`, `Partial`, `Required`, `Readonly`, `Record`, `Extract`, and `Exclude` before writing custom utilities.
1366
+ - Use `keyof` and indexed access types for property-safe APIs.
1367
+ - Use overloads sparingly; prefer a single options object when overloads become hard to read.
1368
+ - Keep mapped types shallow unless the data is truly nested and the API benefits from deep transformation.
1369
+
1370
+ ## Simple Decorators
1371
+
1372
+ - Use decorator factories to attach framework metadata or compose existing decorators.
1373
+ - Keep decorator options serializable and explicit where possible.
1374
+ - Separate metadata collection from runtime execution. A decorator should usually register intent; a loader/service should execute it later.
1375
+ - Avoid parsing function source in ordinary decorators. If runtime argument-name mapping truly requires it, escalate to `advanced.md` and isolate the parser behind tests.
1376
+ - Test decorators at the behavior boundary, not only by checking metadata keys.
1377
+
1378
+ ## Pattern Choices
1379
+
1380
+ - Use Factory Method or simple factory functions when object creation varies by type or config.
1381
+ - Use Builder for stepwise configuration only when partially built objects are common or order matters.
1382
+ - Use Adapter to normalize third-party APIs behind project interfaces.
1383
+ - Use Facade to simplify a noisy subsystem for callers.
1384
+ - Use Decorator when behavior should wrap a method/object without changing its public contract.
1385
+ - Use Template Method when a base class owns an algorithm and subclasses fill in specific steps.
1386
+ - Use Strategy when an algorithm family changes independently from the caller.
1387
+ - Use Observer or Mediator for event-style communication, but keep ownership and error handling explicit.
1388
+
1389
+ ## Symbolic Examples
1390
+
1391
+ Use examples like these to reason about shape and tradeoffs. Keep final code adapted to the repository style.
1392
+
1393
+ ### Strategy with a Narrow Interface
1394
+
1395
+ ```typescript
1396
+ interface PriceStrategy {
1397
+ total(items: CartItem[]): number;
1398
+ }
1399
+
1400
+ class RetailPrice implements PriceStrategy {
1401
+ total(items: CartItem[]) {
1402
+ return items.reduce((sum, item) => sum + item.price, 0);
1403
+ }
1404
+ }
1405
+
1406
+ class WholesalePrice implements PriceStrategy {
1407
+ total(items: CartItem[]) {
1408
+ return items.reduce((sum, item) => sum + item.price * 0.9, 0);
1409
+ }
1410
+ }
1411
+
1412
+ class CheckoutService {
1413
+ constructor(private readonly strategy: PriceStrategy) {}
1414
+
1415
+ quote(items: CartItem[]) {
1416
+ return this.strategy.total(items);
1417
+ }
1418
+ }
1419
+ ```
1420
+
1421
+ Use this when the caller should not know which algorithm is active.
1422
+
1423
+ ### Adapter for Third-Party Boundaries
1424
+
1425
+ ```typescript
1426
+ interface MessageBus {
1427
+ publish(topic: string, payload: unknown): Promise<void>;
1428
+ }
1429
+
1430
+ class RabbitBusAdapter implements MessageBus {
1431
+ constructor(private readonly rabbit: RabbitClient) {}
1432
+
1433
+ publish(topic: string, payload: unknown) {
1434
+ return this.rabbit.sendToQueue(topic, JSON.stringify(payload));
1435
+ }
1436
+ }
1437
+ ```
1438
+
1439
+ Use this when external clients have noisy or unstable APIs.
1440
+
1441
+ ### Template Method for Lifecycle Hooks
1442
+
1443
+ ```typescript
1444
+ abstract class ManagedClient<TConfig, TClient> {
1445
+ async connect(config: TConfig) {
1446
+ const client = await this.create(config);
1447
+ await this.start(client);
1448
+ return client;
1449
+ }
1450
+
1451
+ protected abstract create(config: TConfig): Promise<TClient>;
1452
+ protected abstract start(client: TClient): Promise<void>;
1453
+ }
1454
+ ```
1455
+
1456
+ Use this when the base class owns lifecycle order and subclasses fill the variable steps.
1457
+
1458
+ ### Simple Decorator Metadata
1459
+
1460
+ ```typescript
1461
+ const HANDLER_KEY = "app:handler";
1462
+
1463
+ function Handler(name: string): MethodDecorator {
1464
+ return (_, __, descriptor) => {
1465
+ Reflect.defineMetadata(HANDLER_KEY, name, descriptor.value);
1466
+ };
1467
+ }
1468
+ ```
1469
+
1470
+ Use this when methods declare intent and another loader executes it later.
1471
+
1472
+ ## Practical Review Checklist
1473
+
1474
+ - Can a teammate understand the public API without reading private helpers?
1475
+ - Does the type design represent real runtime rules?
1476
+ - Are names domain-specific enough to explain intent?
1477
+ - Is the pattern solving current duplication or variability?
1478
+ - Are validation, transformation, persistence, and transport concerns separated?
1479
+ - Are tests focused on behavior that the abstraction promises to preserve?