@joktec/skills 0.1.2 → 0.1.4

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 (88) hide show
  1. package/README.md +20 -4
  2. package/bin/joktec-skills.mjs +33 -27
  3. package/dist/claude/skills/joktec-adapter-skill/SKILL.md +5 -0
  4. package/dist/claude/skills/joktec-adapter-skill/references/adapters.md +28 -0
  5. package/dist/claude/skills/joktec-broker-skill/SKILL.md +5 -0
  6. package/dist/claude/skills/joktec-broker-skill/references/brokers.md +29 -0
  7. package/dist/claude/skills/joktec-common-skill/SKILL.md +4 -0
  8. package/dist/claude/skills/joktec-common-skill/references/core.md +56 -0
  9. package/dist/claude/skills/joktec-common-skill/references/utils-cron.md +28 -0
  10. package/dist/claude/skills/joktec-database-extended-skill/SKILL.md +5 -0
  11. package/dist/claude/skills/joktec-database-extended-skill/references/extended-databases.md +24 -0
  12. package/dist/claude/skills/joktec-framework-skill/SKILL.md +1 -0
  13. package/dist/claude/skills/joktec-framework-skill/references/framework-map.md +34 -0
  14. package/dist/claude/skills/joktec-integration-skill/SKILL.md +5 -0
  15. package/dist/claude/skills/joktec-integration-skill/references/integrations.md +29 -0
  16. package/dist/claude/skills/joktec-mongo-skill/SKILL.md +5 -0
  17. package/dist/claude/skills/joktec-mongo-skill/references/repository.md +43 -0
  18. package/dist/claude/skills/joktec-mongo-skill/references/schema-and-plugins.md +29 -0
  19. package/dist/claude/skills/joktec-mysql-skill/SKILL.md +7 -1
  20. package/dist/claude/skills/joktec-mysql-skill/references/entities.md +100 -0
  21. package/dist/claude/skills/joktec-mysql-skill/references/repository.md +49 -0
  22. package/dist/claude/skills/joktec-tool-skill/SKILL.md +5 -0
  23. package/dist/claude/skills/joktec-tool-skill/references/tools.md +35 -0
  24. package/dist/codex/skills/joktec-adapter-skill/SKILL.md +5 -0
  25. package/dist/codex/skills/joktec-adapter-skill/references/adapters.md +28 -0
  26. package/dist/codex/skills/joktec-broker-skill/SKILL.md +5 -0
  27. package/dist/codex/skills/joktec-broker-skill/references/brokers.md +29 -0
  28. package/dist/codex/skills/joktec-common-skill/SKILL.md +4 -0
  29. package/dist/codex/skills/joktec-common-skill/references/core.md +56 -0
  30. package/dist/codex/skills/joktec-common-skill/references/utils-cron.md +28 -0
  31. package/dist/codex/skills/joktec-database-extended-skill/SKILL.md +5 -0
  32. package/dist/codex/skills/joktec-database-extended-skill/references/extended-databases.md +24 -0
  33. package/dist/codex/skills/joktec-framework-skill/SKILL.md +1 -0
  34. package/dist/codex/skills/joktec-framework-skill/references/framework-map.md +34 -0
  35. package/dist/codex/skills/joktec-integration-skill/SKILL.md +5 -0
  36. package/dist/codex/skills/joktec-integration-skill/references/integrations.md +29 -0
  37. package/dist/codex/skills/joktec-mongo-skill/SKILL.md +5 -0
  38. package/dist/codex/skills/joktec-mongo-skill/references/repository.md +43 -0
  39. package/dist/codex/skills/joktec-mongo-skill/references/schema-and-plugins.md +29 -0
  40. package/dist/codex/skills/joktec-mysql-skill/SKILL.md +7 -1
  41. package/dist/codex/skills/joktec-mysql-skill/references/entities.md +100 -0
  42. package/dist/codex/skills/joktec-mysql-skill/references/repository.md +49 -0
  43. package/dist/codex/skills/joktec-tool-skill/SKILL.md +5 -0
  44. package/dist/codex/skills/joktec-tool-skill/references/tools.md +35 -0
  45. package/dist/copilot/.github/copilot-instructions.md +495 -1
  46. package/dist/cursor/.cursor/rules/joktec-adapter-skill.mdc +29 -0
  47. package/dist/cursor/.cursor/rules/joktec-broker-skill.mdc +30 -0
  48. package/dist/cursor/.cursor/rules/joktec-common-skill.mdc +85 -0
  49. package/dist/cursor/.cursor/rules/joktec-database-extended-skill.mdc +25 -0
  50. package/dist/cursor/.cursor/rules/joktec-framework-skill.mdc +35 -0
  51. package/dist/cursor/.cursor/rules/joktec-integration-skill.mdc +30 -0
  52. package/dist/cursor/.cursor/rules/joktec-mongo-skill.mdc +73 -0
  53. package/dist/cursor/.cursor/rules/joktec-mysql-skill.mdc +152 -1
  54. package/dist/cursor/.cursor/rules/joktec-tool-skill.mdc +36 -0
  55. package/dist/gemini/GEMINI.md +495 -1
  56. package/dist/windsurf/.windsurf/rules/joktec-adapter-skill.md +29 -0
  57. package/dist/windsurf/.windsurf/rules/joktec-broker-skill.md +30 -0
  58. package/dist/windsurf/.windsurf/rules/joktec-common-skill.md +85 -0
  59. package/dist/windsurf/.windsurf/rules/joktec-database-extended-skill.md +25 -0
  60. package/dist/windsurf/.windsurf/rules/joktec-framework-skill.md +35 -0
  61. package/dist/windsurf/.windsurf/rules/joktec-integration-skill.md +30 -0
  62. package/dist/windsurf/.windsurf/rules/joktec-mongo-skill.md +73 -0
  63. package/dist/windsurf/.windsurf/rules/joktec-mysql-skill.md +152 -1
  64. package/dist/windsurf/.windsurf/rules/joktec-tool-skill.md +36 -0
  65. package/package.json +1 -1
  66. package/scripts/validate-skills.mjs +32 -0
  67. package/skill-pack.json +261 -52
  68. package/skills/joktec-adapter-skill/SKILL.md +5 -0
  69. package/skills/joktec-adapter-skill/references/adapters.md +28 -0
  70. package/skills/joktec-broker-skill/SKILL.md +5 -0
  71. package/skills/joktec-broker-skill/references/brokers.md +29 -0
  72. package/skills/joktec-common-skill/SKILL.md +4 -0
  73. package/skills/joktec-common-skill/references/core.md +56 -0
  74. package/skills/joktec-common-skill/references/utils-cron.md +28 -0
  75. package/skills/joktec-database-extended-skill/SKILL.md +5 -0
  76. package/skills/joktec-database-extended-skill/references/extended-databases.md +24 -0
  77. package/skills/joktec-framework-skill/SKILL.md +1 -0
  78. package/skills/joktec-framework-skill/references/framework-map.md +34 -0
  79. package/skills/joktec-integration-skill/SKILL.md +5 -0
  80. package/skills/joktec-integration-skill/references/integrations.md +29 -0
  81. package/skills/joktec-mongo-skill/SKILL.md +5 -0
  82. package/skills/joktec-mongo-skill/references/repository.md +43 -0
  83. package/skills/joktec-mongo-skill/references/schema-and-plugins.md +29 -0
  84. package/skills/joktec-mysql-skill/SKILL.md +7 -1
  85. package/skills/joktec-mysql-skill/references/entities.md +100 -0
  86. package/skills/joktec-mysql-skill/references/repository.md +49 -0
  87. package/skills/joktec-tool-skill/SKILL.md +5 -0
  88. package/skills/joktec-tool-skill/references/tools.md +35 -0
@@ -16,11 +16,13 @@ Use this skill for relational resources backed by JokTec's TypeORM wrapper.
16
16
  - Treat `mysql`, `mariadb`, and `postgres` as the first-class dialects.
17
17
  - Keep `sync` explicit and normally enabled only by an owner process or development bootstrap.
18
18
  - Do not add new behavior to deprecated `MysqlFinder`; use `MysqlRepo.qb()` and `MysqlHelper` paths.
19
+ - When migrating an entity to the new schema-first decorators, migrate the whole property decorator stack, not only the TypeORM primary key decorator.
20
+ - If guidance is insufficient, read this skill's references and inspect `../joktec-framework` package source or GitHub fallback before assuming APIs.
19
21
 
20
22
  ## References
21
23
 
22
24
  - Read `references/repository.md` for connection lifecycle, repository usage, query safety, transaction, and cursor behavior.
23
- - Read `references/entities.md` for `@Tables`, `@Column`, `@PrimaryColumn`, uuidv7, and dialect guidance.
25
+ - Read `references/entities.md` for `@Tables`, `@Column`, `@PrimaryColumn`, uuidv7, dialect guidance, and legacy decorator migration rules.
24
26
 
25
27
  ## Bundled References
26
28
 
@@ -28,15 +30,115 @@ Use this skill for relational resources backed by JokTec's TypeORM wrapper.
28
30
 
29
31
  # MySQL Entity Decorators
30
32
 
33
+ ## Source Lookup
34
+
35
+ When blocked, inspect:
36
+
37
+ - `packages/databases/mysql/src/decorators/table.decorator.ts`
38
+ - `packages/databases/mysql/src/decorators/column.decorator.ts`
39
+ - `packages/databases/mysql/src/decorators/columns/column.type.ts`
40
+ - `packages/databases/mysql/src/decorators/columns/column.factory.ts`
41
+ - `packages/databases/mysql/src/decorators/columns/primary.column.ts`
42
+ - `packages/databases/mysql/src/decorators/columns/string.column.ts`
43
+ - `packages/databases/mysql/src/decorators/columns/number.column.ts`
44
+ - `packages/databases/mysql/src/decorators/columns/transform.column.ts`
45
+ - `packages/databases/mysql/src/decorators/columns/swagger.column.ts`
46
+
31
47
  ## Schema-First Entity Pattern
32
48
 
33
49
  Use `@Tables`, `@Column`, and `@PrimaryColumn` from `@joktec/mysql` when an entity should also act as the source class for mapped DTOs.
34
50
 
51
+ The new decorators are not thin TypeORM aliases. They are schema-first wrappers that compose:
52
+
53
+ - TypeORM column/primary column metadata.
54
+ - `class-validator` behavior through `@joktec/utils` validators.
55
+ - `class-transformer` expose/exclude behavior.
56
+ - Swagger property metadata.
57
+
58
+ 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.
59
+
60
+ ## Legacy Decorator Migration
61
+
62
+ Migrate a whole property at a time. Do not only replace `PrimaryGeneratedColumn`.
63
+
64
+ Common mappings:
65
+
66
+ | Legacy decorators | New decorator shape |
67
+ | --- | --- |
68
+ | `@PrimaryGeneratedColumn()` | `@PrimaryColumn('increment')` |
69
+ | `@PrimaryGeneratedColumn('uuid')` | `@PrimaryColumn('uuid')` |
70
+ | app-generated ordered UUID id | `@PrimaryColumn('uuidv7')` |
71
+ | `@Column(...)` | `@Column(...)` from `@joktec/mysql` |
72
+ | `@IsNotEmpty()` | `@Column({ required: true })` |
73
+ | `@IsOptional()` | `@Column({ required: false })` or nullable TypeORM option when storage allows null |
74
+ | `@IsEmail()` | `@Column({ isEmail: true })` |
75
+ | `@IsMobilePhone()` | `@Column({ isPhone: true })` |
76
+ | `@IsHexColor()` | `@Column({ isHexColor: true })` |
77
+ | `@IsUrl()` | `@Column({ isUrl: true })` |
78
+ | `@MinLength(n)` | `@Column({ minLength: n })` |
79
+ | `@MaxLength(n)` | `@Column({ maxLength: n })` |
80
+ | `@Min(n)` | `@Column({ min: n })` |
81
+ | `@Max(n)` | `@Column({ max: n })` |
82
+ | `@Expose()` | default behavior of `@Column(...)` |
83
+ | `@Expose({ groups })` | `@Column({ groups })` |
84
+ | `@Exclude({ toPlainOnly: true })` plus hidden Swagger | `@Column({ hidden: true })` |
85
+ | `@ApiProperty(...)` | `@Column({ swagger: ... })`, or native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength` |
86
+
87
+ Preserve decorators only when the wrapper cannot express them, by passing them through `decorators: [...]`.
88
+
89
+ Migration checklist:
90
+
91
+ - Replace TypeORM column decorators with wrappers from `@joktec/mysql`.
92
+ - Remove duplicate `class-validator` decorators when equivalent wrapper options exist.
93
+ - Remove duplicate `class-transformer` decorators when `hidden` or `groups` expresses the same behavior.
94
+ - Move Swagger examples/descriptions/limits into wrapper options where possible.
95
+ - Preserve custom validators/transforms only through `decorators: [...]`.
96
+ - Keep database-specific options such as `type`, `length`, `nullable`, `unique`, `default`, `enum`, and `comment`.
97
+ - Rebuild and run entity-related tests after migration because DTO metadata and TypeORM metadata both change.
98
+
99
+ Example migration:
100
+
101
+ ```ts
102
+ // Before
103
+ @Column({ type: 'varchar', length: 255 })
104
+ @IsEmail()
105
+ @IsNotEmpty()
106
+ @Expose()
107
+ @ApiProperty({ example: 'user@example.com' })
108
+ email!: string;
109
+
110
+ // After
111
+ @Column('varchar', {
112
+ length: 255,
113
+ required: true,
114
+ isEmail: true,
115
+ example: 'user@example.com',
116
+ })
117
+ email!: string;
118
+ ```
119
+
120
+ For hidden fields:
121
+
122
+ ```ts
123
+ // Before
124
+ @Column({ type: 'varchar', length: 255 })
125
+ @Exclude({ toPlainOnly: true })
126
+ @ApiHideProperty()
127
+ password!: string;
128
+
129
+ // After
130
+ @Column('varchar', { length: 255, hidden: true })
131
+ password!: string;
132
+ ```
133
+
35
134
  ## Primary Keys
36
135
 
37
136
  - Prefer numeric auto-increment keys for write-heavy MySQL tables.
38
137
  - Use UUIDs when the app needs globally unique or public identifiers.
39
138
  - Prefer `uuidv7` over random UUIDs when the id participates in ordered indexes or cursor-like access.
139
+ - When switching from UUID v4 to uuidv7, verify downstream code does not assume random UUID ordering.
140
+
141
+ Do not blindly convert every primary key to uuidv7. Keep numeric increment keys when the table is internal, write-heavy, and does not need public/global identifiers.
40
142
 
41
143
  ## Dialects
42
144
 
@@ -46,24 +148,73 @@ The stable dialects are MySQL, MariaDB, and Postgres. Dialect capabilities own d
46
148
 
47
149
  # MySQL Repository Usage
48
150
 
151
+ ## Source Lookup
152
+
153
+ When blocked, inspect:
154
+
155
+ - `packages/databases/mysql/README.md`
156
+ - `packages/databases/mysql/AGENTS.md`
157
+ - `packages/databases/mysql/src/index.ts`
158
+ - `packages/databases/mysql/src/mysql.module.ts`
159
+ - `packages/databases/mysql/src/mysql.service.ts`
160
+ - `packages/databases/mysql/src/mysql.repo.ts`
161
+ - `packages/databases/mysql/src/helpers/mysql.helper.ts`
162
+ - `packages/databases/mysql/src/helpers/mysql.finder.ts`
163
+ - `packages/databases/mysql/src/services/mysql.dialect.ts`
164
+ - `packages/databases/mysql/src/models/*`
165
+
49
166
  ## Module Setup
50
167
 
51
168
  Register entities with `MysqlModule.forRoot({ conId, models: [...] })`. Use `conId` for multiple DataSources.
52
169
 
170
+ Best practice:
171
+
172
+ - Register consumer app entities in an app repository module.
173
+ - Keep `sync` disabled in request-facing processes unless the app intentionally owns schema sync.
174
+ - Use one controlled owner process for schema sync/migration in multi-process deployments.
175
+ - Preserve `conId` when resolving repositories or transaction-scoped managers.
176
+
53
177
  ## Repository Pattern
54
178
 
55
179
  Extend `MysqlRepo` and pass the entity class to the base constructor. Services can use `BaseService` when CRUD behavior follows the shared contract.
56
180
 
181
+ Repository checklist:
182
+
183
+ - Keep entity-specific SQL helpers in the app repository, not in controllers.
184
+ - Use `MysqlRepo.qb()` and repository methods for standard reads so field validation, relation loading, soft delete, and pagination stay consistent.
185
+ - Do not add new behavior to `MysqlFinder`; it is deprecated compatibility code.
186
+ - Keep read/write operations in the same transaction context when the app passes a manager or query runner.
187
+
57
188
  ## Query Safety
58
189
 
59
190
  - Validate field paths against TypeORM metadata before interpolating SQL identifiers.
60
191
  - Use parameter binding for values.
61
192
  - Keep logical operators such as `$and` and `$or` grouped through QueryBuilder behavior.
62
193
 
194
+ Anti-patterns:
195
+
196
+ - Do not interpolate user-provided field names or relation names into SQL without TypeORM metadata validation.
197
+ - Do not assume MySQL-only syntax when the package supports MySQL, MariaDB, and Postgres.
198
+ - Do not use a relation/populate path unless it maps to entity metadata.
199
+
63
200
  ## Pagination
64
201
 
65
202
  `MysqlRepo.paginate` supports page, offset, and cursor responses. Cursor mode defaults to `createdAt` plus primary key columns. Custom cursor keys must be mapped columns.
66
203
 
204
+ Cursor checklist:
205
+
206
+ - Use `createdAt + primary key` as the default stable cursor.
207
+ - Add primary keys as tie-breakers for non-unique cursor keys.
208
+ - Ensure cursor keys are indexed for hot list endpoints.
209
+ - Validate cursor payload shape before building SQL.
210
+ - Treat cursor tokens as opaque; clients should not parse them.
211
+
67
212
  ## Transactions
68
213
 
69
214
  When using transaction-scoped operations, pass the manager or query runner through repository options so pre-read and write operations use the same context.
215
+
216
+ Transaction checklist:
217
+
218
+ - Use one manager/query runner for read-modify-write flows.
219
+ - Rollback tests should prove that both pre-read dependent writes and writes are transaction-scoped.
220
+ - Avoid mixing default repositories and transaction-scoped repositories in one operation.
@@ -20,6 +20,7 @@ Use this skill for reusable utility services.
20
20
  - Use config-driven clients instead of direct ad hoc setup in app code.
21
21
  - Preserve retry, metrics, proxy, and upload behavior where the package exposes it.
22
22
  - Keep alert tokens and webhook URLs in runtime config only.
23
+ - If guidance is insufficient, read this skill's references and inspect `../joktec-framework` package source or GitHub fallback before assuming APIs.
23
24
 
24
25
  ## Reference
25
26
 
@@ -31,14 +32,49 @@ Read `references/tools.md` for package-specific usage notes.
31
32
 
32
33
  # Tool Usage
33
34
 
35
+ ## Source Lookup
36
+
37
+ When blocked, inspect:
38
+
39
+ - `packages/tools/README.md`
40
+ - `packages/tools/AGENTS.md`
41
+ - `packages/tools/<package>/README.md`
42
+ - `packages/tools/<package>/src/index.ts`
43
+ - package config/module/service/helper files under `src/`
44
+
34
45
  ## HTTP
35
46
 
36
47
  Use `@joktec/http` for Axios-backed requests, uploads, proxy agent support, retry config, and metrics where exposed.
37
48
 
49
+ Best practice:
50
+
51
+ - Use the package service for outbound HTTP so retry/proxy/metrics behavior stays centralized.
52
+ - Keep external endpoint URLs and credentials in runtime config.
53
+ - Be careful with ESM/CommonJS import changes in HTTP/Axios ecosystem packages.
54
+ - Test request behavior with mocks unless the test is an explicit consumer integration scenario.
55
+
38
56
  ## File
39
57
 
40
58
  Use `@joktec/file` for shared file helpers and classification behavior instead of duplicating local utility code.
41
59
 
60
+ Best practice:
61
+
62
+ - Keep filesystem paths and temporary directories environment-specific.
63
+ - Validate upload/file inputs before passing them into business workflows.
64
+ - Use package helpers for MIME/classification behavior when consistency matters across services.
65
+
42
66
  ## Alert
43
67
 
44
68
  Use `@joktec/alert` for Slack-compatible webhook alerts. Keep webhook URLs and credentials out of source control.
69
+
70
+ Best practice:
71
+
72
+ - Treat alert messages as operational notifications, not business workflows.
73
+ - Do not leak secrets, tokens, connection strings, or personal data into alert payloads.
74
+ - `@joktec/alert` is present but less complete than core database/client packages; inspect source before depending on advanced behavior.
75
+
76
+ ## Anti-Patterns
77
+
78
+ - Do not scatter raw Axios instances across the app when `@joktec/http` should own shared behavior.
79
+ - Do not commit webhook URLs or proxy credentials.
80
+ - Do not use tool packages as hidden places for app business rules.