@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.
- package/README.md +20 -4
- package/bin/joktec-skills.mjs +33 -27
- package/dist/claude/skills/joktec-adapter-skill/SKILL.md +5 -0
- package/dist/claude/skills/joktec-adapter-skill/references/adapters.md +28 -0
- package/dist/claude/skills/joktec-broker-skill/SKILL.md +5 -0
- package/dist/claude/skills/joktec-broker-skill/references/brokers.md +29 -0
- package/dist/claude/skills/joktec-common-skill/SKILL.md +4 -0
- package/dist/claude/skills/joktec-common-skill/references/core.md +56 -0
- package/dist/claude/skills/joktec-common-skill/references/utils-cron.md +28 -0
- package/dist/claude/skills/joktec-database-extended-skill/SKILL.md +5 -0
- package/dist/claude/skills/joktec-database-extended-skill/references/extended-databases.md +24 -0
- package/dist/claude/skills/joktec-framework-skill/SKILL.md +1 -0
- package/dist/claude/skills/joktec-framework-skill/references/framework-map.md +34 -0
- package/dist/claude/skills/joktec-integration-skill/SKILL.md +5 -0
- package/dist/claude/skills/joktec-integration-skill/references/integrations.md +29 -0
- package/dist/claude/skills/joktec-mongo-skill/SKILL.md +5 -0
- package/dist/claude/skills/joktec-mongo-skill/references/repository.md +43 -0
- package/dist/claude/skills/joktec-mongo-skill/references/schema-and-plugins.md +29 -0
- package/dist/claude/skills/joktec-mysql-skill/SKILL.md +7 -1
- package/dist/claude/skills/joktec-mysql-skill/references/entities.md +100 -0
- package/dist/claude/skills/joktec-mysql-skill/references/repository.md +49 -0
- package/dist/claude/skills/joktec-tool-skill/SKILL.md +5 -0
- package/dist/claude/skills/joktec-tool-skill/references/tools.md +35 -0
- package/dist/codex/skills/joktec-adapter-skill/SKILL.md +5 -0
- package/dist/codex/skills/joktec-adapter-skill/references/adapters.md +28 -0
- package/dist/codex/skills/joktec-broker-skill/SKILL.md +5 -0
- package/dist/codex/skills/joktec-broker-skill/references/brokers.md +29 -0
- package/dist/codex/skills/joktec-common-skill/SKILL.md +4 -0
- package/dist/codex/skills/joktec-common-skill/references/core.md +56 -0
- package/dist/codex/skills/joktec-common-skill/references/utils-cron.md +28 -0
- package/dist/codex/skills/joktec-database-extended-skill/SKILL.md +5 -0
- package/dist/codex/skills/joktec-database-extended-skill/references/extended-databases.md +24 -0
- package/dist/codex/skills/joktec-framework-skill/SKILL.md +1 -0
- package/dist/codex/skills/joktec-framework-skill/references/framework-map.md +34 -0
- package/dist/codex/skills/joktec-integration-skill/SKILL.md +5 -0
- package/dist/codex/skills/joktec-integration-skill/references/integrations.md +29 -0
- package/dist/codex/skills/joktec-mongo-skill/SKILL.md +5 -0
- package/dist/codex/skills/joktec-mongo-skill/references/repository.md +43 -0
- package/dist/codex/skills/joktec-mongo-skill/references/schema-and-plugins.md +29 -0
- package/dist/codex/skills/joktec-mysql-skill/SKILL.md +7 -1
- package/dist/codex/skills/joktec-mysql-skill/references/entities.md +100 -0
- package/dist/codex/skills/joktec-mysql-skill/references/repository.md +49 -0
- package/dist/codex/skills/joktec-tool-skill/SKILL.md +5 -0
- package/dist/codex/skills/joktec-tool-skill/references/tools.md +35 -0
- package/dist/copilot/.github/copilot-instructions.md +495 -1
- package/dist/cursor/.cursor/rules/joktec-adapter-skill.mdc +29 -0
- package/dist/cursor/.cursor/rules/joktec-broker-skill.mdc +30 -0
- package/dist/cursor/.cursor/rules/joktec-common-skill.mdc +85 -0
- package/dist/cursor/.cursor/rules/joktec-database-extended-skill.mdc +25 -0
- package/dist/cursor/.cursor/rules/joktec-framework-skill.mdc +35 -0
- package/dist/cursor/.cursor/rules/joktec-integration-skill.mdc +30 -0
- package/dist/cursor/.cursor/rules/joktec-mongo-skill.mdc +73 -0
- package/dist/cursor/.cursor/rules/joktec-mysql-skill.mdc +152 -1
- package/dist/cursor/.cursor/rules/joktec-tool-skill.mdc +36 -0
- package/dist/gemini/GEMINI.md +495 -1
- package/dist/windsurf/.windsurf/rules/joktec-adapter-skill.md +29 -0
- package/dist/windsurf/.windsurf/rules/joktec-broker-skill.md +30 -0
- package/dist/windsurf/.windsurf/rules/joktec-common-skill.md +85 -0
- package/dist/windsurf/.windsurf/rules/joktec-database-extended-skill.md +25 -0
- package/dist/windsurf/.windsurf/rules/joktec-framework-skill.md +35 -0
- package/dist/windsurf/.windsurf/rules/joktec-integration-skill.md +30 -0
- package/dist/windsurf/.windsurf/rules/joktec-mongo-skill.md +73 -0
- package/dist/windsurf/.windsurf/rules/joktec-mysql-skill.md +152 -1
- package/dist/windsurf/.windsurf/rules/joktec-tool-skill.md +36 -0
- package/package.json +1 -1
- package/scripts/validate-skills.mjs +32 -0
- package/skill-pack.json +261 -52
- package/skills/joktec-adapter-skill/SKILL.md +5 -0
- package/skills/joktec-adapter-skill/references/adapters.md +28 -0
- package/skills/joktec-broker-skill/SKILL.md +5 -0
- package/skills/joktec-broker-skill/references/brokers.md +29 -0
- package/skills/joktec-common-skill/SKILL.md +4 -0
- package/skills/joktec-common-skill/references/core.md +56 -0
- package/skills/joktec-common-skill/references/utils-cron.md +28 -0
- package/skills/joktec-database-extended-skill/SKILL.md +5 -0
- package/skills/joktec-database-extended-skill/references/extended-databases.md +24 -0
- package/skills/joktec-framework-skill/SKILL.md +1 -0
- package/skills/joktec-framework-skill/references/framework-map.md +34 -0
- package/skills/joktec-integration-skill/SKILL.md +5 -0
- package/skills/joktec-integration-skill/references/integrations.md +29 -0
- package/skills/joktec-mongo-skill/SKILL.md +5 -0
- package/skills/joktec-mongo-skill/references/repository.md +43 -0
- package/skills/joktec-mongo-skill/references/schema-and-plugins.md +29 -0
- package/skills/joktec-mysql-skill/SKILL.md +7 -1
- package/skills/joktec-mysql-skill/references/entities.md +100 -0
- package/skills/joktec-mysql-skill/references/repository.md +49 -0
- package/skills/joktec-tool-skill/SKILL.md +5 -0
- package/skills/joktec-tool-skill/references/tools.md +35 -0
package/dist/gemini/GEMINI.md
CHANGED
|
@@ -26,6 +26,7 @@ Start here when a task mentions JokTec generally, multiple `@joktec/*` packages,
|
|
|
26
26
|
- Prefer config-driven module setup and `conId` when a package supports multiple clients.
|
|
27
27
|
- Preserve NestJS module boundaries, dependency injection, lifecycle hooks, and exported package APIs.
|
|
28
28
|
- Do not invent behavior for unfinished or missing packages.
|
|
29
|
+
- If a focused skill is loaded without this entrypoint, still apply source-first lookup before assuming APIs.
|
|
29
30
|
|
|
30
31
|
## Reference
|
|
31
32
|
|
|
@@ -37,6 +38,25 @@ Read `references/framework-map.md` when the task needs package selection, depend
|
|
|
37
38
|
|
|
38
39
|
# JokTec Framework Map
|
|
39
40
|
|
|
41
|
+
## Source-First Operating Protocol
|
|
42
|
+
|
|
43
|
+
Treat this skill pack as curated guidance, not the final implementation truth. When a task is unclear, or when a package API seems different from the skill text:
|
|
44
|
+
|
|
45
|
+
1. Inspect the consumer project first to understand the package versions and local usage pattern.
|
|
46
|
+
2. Prefer local framework source at `../joktec-framework` when available.
|
|
47
|
+
3. Read package `README.md`, nearest `AGENTS.md`, and `src/index.ts` before changing code.
|
|
48
|
+
4. If local source is unavailable, use `https://github.com/joktec/joktec-framework` as fallback.
|
|
49
|
+
5. Do not invent behavior that is not visible in framework source or package docs.
|
|
50
|
+
6. If package docs and source conflict, source code wins and the mismatch should be treated as documentation drift.
|
|
51
|
+
|
|
52
|
+
High-value source files:
|
|
53
|
+
|
|
54
|
+
- `AGENTS.md` and `docs/agents/*` for framework-level architecture and runtime policy.
|
|
55
|
+
- `packages/<family>/AGENTS.md` for family boundaries.
|
|
56
|
+
- `packages/<family>/<package>/README.md` for developer-facing usage.
|
|
57
|
+
- `packages/<family>/<package>/src/index.ts` for public API.
|
|
58
|
+
- Package config/module/service/repository files for real runtime behavior.
|
|
59
|
+
|
|
40
60
|
## Package Families
|
|
41
61
|
|
|
42
62
|
- `@joktec/core`: bootstrap, config, logger, metrics, guards, base abstractions, transports, pagination, Bull.
|
|
@@ -54,6 +74,12 @@ Read `references/framework-map.md` when the task needs package selection, depend
|
|
|
54
74
|
|
|
55
75
|
Consumer apps depend on concrete `@joktec/*` packages. Concrete packages usually depend on `@joktec/core` and `@joktec/utils`. Keep app-specific schemas, handlers, and business semantics outside reusable packages.
|
|
56
76
|
|
|
77
|
+
Do not reverse the dependency direction:
|
|
78
|
+
|
|
79
|
+
- reusable packages must not import from `apps/`
|
|
80
|
+
- `common` packages must not depend on concrete adapters/brokers/databases
|
|
81
|
+
- consumer apps own business workflows, DTO composition, schemas/entities, queue names, topics, and provider credentials
|
|
82
|
+
|
|
57
83
|
## Common Consumer App Pattern
|
|
58
84
|
|
|
59
85
|
1. Register package modules in the app module or repository module.
|
|
@@ -61,6 +87,15 @@ Consumer apps depend on concrete `@joktec/*` packages. Concrete packages usually
|
|
|
61
87
|
3. Extend the package repository base class when the package provides one.
|
|
62
88
|
4. Use `BaseService`, `BaseController`, or transport helpers from `@joktec/core` when the app follows standard CRUD or message patterns.
|
|
63
89
|
|
|
90
|
+
## Skill Selection
|
|
91
|
+
|
|
92
|
+
- Use `joktec-common-skill` for BaseController/BaseService/config/pagination/client lifecycle/utils/cron.
|
|
93
|
+
- Use `joktec-mongo-skill` when the resource uses Mongo schemas, MongoRepo, Typegoose decorators, plugins, or ObjectId-safe queries.
|
|
94
|
+
- Use `joktec-mysql-skill` when the resource uses TypeORM entities, MysqlRepo, SQL dialect behavior, transactions, or schema-first column decorators.
|
|
95
|
+
- Use broker/adapter/integration/tool skills for provider wiring; keep business semantics in the consumer app.
|
|
96
|
+
|
|
97
|
+
When using the ecosystem `npx skills` installer, install `joktec-framework-skill` and `joktec-common-skill` together with any focused package skill. The current ecosystem installer does not auto-resolve dependencies from frontmatter.
|
|
98
|
+
|
|
64
99
|
---
|
|
65
100
|
|
|
66
101
|
## JokTec Common Skill
|
|
@@ -83,6 +118,7 @@ Use this skill for shared framework primitives, low-level helpers, cron utilitie
|
|
|
83
118
|
- Use page, offset, or cursor pagination contracts from core; let database packages execute storage-specific pagination.
|
|
84
119
|
- Use `AbstractClientService` patterns for client packages that need config, lifecycle, retry, and `conId`.
|
|
85
120
|
- Use `@joktec/utils` for shared helpers instead of duplicating conversion, validation, hashing, or UUID logic.
|
|
121
|
+
- If guidance is insufficient, read this skill's references and inspect `../joktec-framework` package source or GitHub fallback before assuming APIs.
|
|
86
122
|
|
|
87
123
|
## References
|
|
88
124
|
|
|
@@ -95,24 +131,80 @@ Use this skill for shared framework primitives, low-level helpers, cron utilitie
|
|
|
95
131
|
|
|
96
132
|
# Common Core Usage
|
|
97
133
|
|
|
134
|
+
## Source Lookup
|
|
135
|
+
|
|
136
|
+
When blocked, inspect these framework files before guessing:
|
|
137
|
+
|
|
138
|
+
- `packages/common/core/README.md`
|
|
139
|
+
- `packages/common/core/AGENTS.md`
|
|
140
|
+
- `packages/common/core/src/index.ts`
|
|
141
|
+
- `packages/common/core/src/abstractions/*`
|
|
142
|
+
- `packages/common/core/src/models/base.request.ts`
|
|
143
|
+
- `packages/common/core/src/models/base.response.ts`
|
|
144
|
+
- `packages/common/core/src/models/paginations/*`
|
|
145
|
+
- `packages/common/core/src/client/abstract-client.service.ts`
|
|
146
|
+
- `packages/common/core/src/infras/application.ts`
|
|
147
|
+
- `packages/common/core/src/modules/*`
|
|
148
|
+
|
|
98
149
|
## Runtime Bootstrap
|
|
99
150
|
|
|
100
151
|
Use the application bootstrap helpers from `@joktec/core` for gateway and microservice runtimes. Keep runtime behavior config-driven.
|
|
101
152
|
|
|
153
|
+
Best practice:
|
|
154
|
+
|
|
155
|
+
- Use `Application.bootstrap(AppModule)` instead of hand-rolling Nest bootstrap unless the consumer app has a specific runtime reason.
|
|
156
|
+
- Keep gateway-only behavior in gateway runtime modules and microservice-only behavior in micro runtime modules.
|
|
157
|
+
- Register framework modules through their dynamic module APIs when provided.
|
|
158
|
+
- Do not duplicate config parsing, logger setup, metrics setup, or process lifecycle hooks in consumer apps.
|
|
159
|
+
|
|
102
160
|
## CRUD Abstractions
|
|
103
161
|
|
|
104
162
|
- `BaseController` creates standard REST CRUD endpoints for DTO-backed resources.
|
|
105
163
|
- `BaseService` delegates repository operations through the shared repository contract.
|
|
106
164
|
- `ClientController` and `ClientService` provide generated microservice CRUD patterns.
|
|
107
165
|
|
|
166
|
+
Use BaseController/BaseService when the resource follows standard CRUD. Avoid them when the endpoint has domain-specific command semantics, multi-step transactions, or non-standard authorization that would make the generic abstraction obscure behavior.
|
|
167
|
+
|
|
168
|
+
Controller checklist:
|
|
169
|
+
|
|
170
|
+
- choose the DTO/entity class intentionally
|
|
171
|
+
- set `paginationMode` for the representative Swagger response shape
|
|
172
|
+
- use `customDto.paginationDto` only when the built-in page/offset/cursor response does not represent the API
|
|
173
|
+
- keep auth/guards/interceptors consistent with app conventions
|
|
174
|
+
- avoid putting business branching in controller methods when it belongs in the service
|
|
175
|
+
|
|
108
176
|
## Pagination
|
|
109
177
|
|
|
110
178
|
Request priority is cursor, then offset, then page. `BaseController.paginationMode` affects Swagger response shape; runtime selection remains request-driven unless the app service narrows it.
|
|
111
179
|
|
|
180
|
+
Best practice:
|
|
181
|
+
|
|
182
|
+
- Use page pagination for admin tables and simple back-office views.
|
|
183
|
+
- Use offset pagination for mobile-style load-more when the data set is moderate and stable enough.
|
|
184
|
+
- Use cursor pagination for feeds, timelines, frequently inserted lists, or large tables.
|
|
185
|
+
- Do not document cursor support for a resource unless the underlying repository package actually supports it.
|
|
186
|
+
- When using cursor mode, ensure the database layer has stable sort keys and tie-breakers.
|
|
187
|
+
|
|
112
188
|
## Client Lifecycle
|
|
113
189
|
|
|
114
190
|
Use `ClientConfig`, `AbstractClientService`, and `conId` when building or consuming packages that support multiple client connections.
|
|
115
191
|
|
|
192
|
+
Client package checklist:
|
|
193
|
+
|
|
194
|
+
- config class validates all required runtime options
|
|
195
|
+
- service startup fails clearly when the native client cannot initialize
|
|
196
|
+
- shutdown closes native connections only when initialized
|
|
197
|
+
- `conId` is preserved through service/repository calls
|
|
198
|
+
- logs do not leak credentials or full connection strings
|
|
199
|
+
- retries and debug behavior are config-driven
|
|
200
|
+
|
|
201
|
+
## Do Not
|
|
202
|
+
|
|
203
|
+
- Do not import concrete package or app code into `@joktec/core`.
|
|
204
|
+
- Do not bypass shared pagination contracts with ad-hoc response shapes for standard CRUD.
|
|
205
|
+
- Do not add new public symbols without exporting them through `src/index.ts`.
|
|
206
|
+
- Do not silently swallow bootstrap/client initialization failures.
|
|
207
|
+
|
|
116
208
|
### references/utils-cron.md
|
|
117
209
|
|
|
118
210
|
# Utils And Cron Usage
|
|
@@ -123,12 +215,40 @@ Use `@joktec/utils` for common generators, validators, converters, hashing helpe
|
|
|
123
215
|
|
|
124
216
|
Prefer package helpers over app-local reimplementation when behavior should stay consistent across services.
|
|
125
217
|
|
|
218
|
+
Source lookup:
|
|
219
|
+
|
|
220
|
+
- `packages/common/utils/README.md`
|
|
221
|
+
- `packages/common/utils/src/index.ts`
|
|
222
|
+
- `packages/common/utils/src/helpers/*`
|
|
223
|
+
- `packages/common/utils/src/validators/*`
|
|
224
|
+
- `packages/common/utils/src/constants/*`
|
|
225
|
+
|
|
226
|
+
Best practice:
|
|
227
|
+
|
|
228
|
+
- Use shared validators from `@joktec/utils` when building schema-first entity/schema decorators.
|
|
229
|
+
- Use shared generators for IDs, tokens, random values, and hashes when consistency matters.
|
|
230
|
+
- Keep utility usage deterministic in tests; mock time/randomness where needed.
|
|
231
|
+
- Do not add framework-level dependencies to `utils`.
|
|
232
|
+
|
|
126
233
|
## Cron
|
|
127
234
|
|
|
128
235
|
Use `@joktec/cron` when a consumer app needs scheduled jobs, job worker contracts, or decorator-driven cron registration.
|
|
129
236
|
|
|
130
237
|
Keep job business logic in the consumer app. The package provides scheduling abstractions, not domain behavior.
|
|
131
238
|
|
|
239
|
+
Source lookup:
|
|
240
|
+
|
|
241
|
+
- `packages/common/cron/README.md`
|
|
242
|
+
- `packages/common/cron/src/index.ts`
|
|
243
|
+
- cron decorators, models, scheduler services, and worker contracts under `src/`
|
|
244
|
+
|
|
245
|
+
Best practice:
|
|
246
|
+
|
|
247
|
+
- Keep job names, schedules, concurrency, and retry behavior visible in the consumer app.
|
|
248
|
+
- Make cron handlers idempotent.
|
|
249
|
+
- Avoid enabling the same cron owner in multiple processes unless the package/app has explicit locking semantics.
|
|
250
|
+
- Treat cron runtime as infrastructure orchestration; domain writes still belong in app services/repositories.
|
|
251
|
+
|
|
132
252
|
## Types
|
|
133
253
|
|
|
134
254
|
Use `@joktec/types` when a consumer workflow needs generated JokTec package config schema/type artifacts. Treat the framework repository as source-of-truth for the generated schema shape.
|
|
@@ -149,6 +269,7 @@ Use this skill for MongoDB-backed resources that rely on JokTec's Mongoose/Typeg
|
|
|
149
269
|
- Preserve `conId` when the app has multiple Mongo connections.
|
|
150
270
|
- Use schema-first decorators when a schema class should be reused as a DTO source.
|
|
151
271
|
- 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.
|
|
152
273
|
|
|
153
274
|
## References
|
|
154
275
|
|
|
@@ -161,14 +282,43 @@ Use this skill for MongoDB-backed resources that rely on JokTec's Mongoose/Typeg
|
|
|
161
282
|
|
|
162
283
|
# Mongo Repository Usage
|
|
163
284
|
|
|
285
|
+
## Source Lookup
|
|
286
|
+
|
|
287
|
+
When blocked, inspect:
|
|
288
|
+
|
|
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/*`
|
|
299
|
+
|
|
164
300
|
## Module Setup
|
|
165
301
|
|
|
166
302
|
Register schemas with `MongoModule.forRoot({ conId, models: [...] })`. Use the same `conId` in app repositories when using non-default connections.
|
|
167
303
|
|
|
304
|
+
Best practice:
|
|
305
|
+
|
|
306
|
+
- Register app schema classes in the consumer app repository module.
|
|
307
|
+
- Use one owner process for index creation in multi-process deployments.
|
|
308
|
+
- Preserve `conId` through service/repo constructors for multi-connection apps.
|
|
309
|
+
- Do not rely on the global mongoose model registry when `MongoService` provides connection-aware resolution.
|
|
310
|
+
|
|
168
311
|
## Repository Pattern
|
|
169
312
|
|
|
170
313
|
Extend `MongoRepo` and pass the schema class to the base constructor. Services can then use `BaseService` from `@joktec/core`.
|
|
171
314
|
|
|
315
|
+
Repository checklist:
|
|
316
|
+
|
|
317
|
+
- Keep schema-specific query helpers in the app repository, not in controllers.
|
|
318
|
+
- Use repository methods for standard reads so query parsing, soft delete, populate, and pagination stay consistent.
|
|
319
|
+
- 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.
|
|
321
|
+
|
|
172
322
|
## Query Safety
|
|
173
323
|
|
|
174
324
|
- Root `id` can act as an API alias for `_id` in query conditions.
|
|
@@ -176,30 +326,73 @@ Extend `MongoRepo` and pass the schema class to the base constructor. Services c
|
|
|
176
326
|
- `$like`, `$begin`, and `$end` escape regex input by default.
|
|
177
327
|
- Do not rely on broad conversion when storing raw snapshots, maps, or nested subdocuments.
|
|
178
328
|
|
|
329
|
+
Anti-patterns:
|
|
330
|
+
|
|
331
|
+
- Do not convert every nested `id` key into `_id`; only API-facing query aliases should be converted.
|
|
332
|
+
- Do not cast every 24-character hex string into ObjectId; fields like `externalId`, `code`, and `slug` may be strings.
|
|
333
|
+
- Do not inject soft-delete conditions into unknown nested aggregate branches unless the target collection is known.
|
|
334
|
+
|
|
179
335
|
## Pagination
|
|
180
336
|
|
|
181
337
|
`MongoRepo.paginate` supports page, offset, and cursor responses. Cursor mode defaults to `_id`; custom `cursorKey` appends `_id` as a tie-breaker.
|
|
182
338
|
|
|
339
|
+
Cursor checklist:
|
|
340
|
+
|
|
341
|
+
- Use `_id` for default Mongo cursor ordering.
|
|
342
|
+
- Use `createdAt` or another indexed stable key when the product requires chronological cursor behavior.
|
|
343
|
+
- Append `_id` as a tie-breaker for non-unique cursor keys.
|
|
344
|
+
- Fetch `limit + 1` records and generate `nextCursor` only when another page exists.
|
|
345
|
+
- Treat cursor tokens as opaque; clients should not parse them.
|
|
346
|
+
|
|
183
347
|
### references/schema-and-plugins.md
|
|
184
348
|
|
|
185
349
|
# Mongo Schema And Plugins
|
|
186
350
|
|
|
351
|
+
## Source Lookup
|
|
352
|
+
|
|
353
|
+
When blocked, inspect:
|
|
354
|
+
|
|
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`
|
|
362
|
+
|
|
187
363
|
## Schema Decorators
|
|
188
364
|
|
|
189
365
|
Use `@Schema` and `@Prop` wrappers from `@joktec/mongo` for Typegoose schema metadata plus validation, transform, and Swagger metadata.
|
|
190
366
|
|
|
191
367
|
Avoid mutating shared option objects across multiple properties.
|
|
192
368
|
|
|
369
|
+
Best practice:
|
|
370
|
+
|
|
371
|
+
- Use schema-first decorators when the schema should be reused by DTO mapped types.
|
|
372
|
+
- Keep raw `@prop` or raw Mongoose decorators only when the wrapper cannot express the behavior.
|
|
373
|
+
- Pass custom validators/transforms explicitly rather than adding hidden global behavior.
|
|
374
|
+
- Keep maps, snapshots, and dynamic objects explicit so helper conversion does not alter their shape.
|
|
375
|
+
- Keep app-level reference semantics visible; strict reference plugin checks existence, but the app still owns domain rules.
|
|
376
|
+
|
|
193
377
|
## Plugins
|
|
194
378
|
|
|
195
379
|
- Paranoid plugin handles soft delete filtering and must respect aggregate first-stage constraints such as `$geoNear`.
|
|
196
380
|
- Strict reference plugin validates referenced documents and must resolve models through the active connection.
|
|
197
381
|
- Transform plugin centralizes common document transformation and should not break Mongo update operators.
|
|
198
382
|
|
|
383
|
+
Plugin checklist:
|
|
384
|
+
|
|
385
|
+
- Paranoid aggregate injection must not come before `$geoNear`.
|
|
386
|
+
- Strict reference checks must be connection-aware in multi-connection apps.
|
|
387
|
+
- Transform behavior must preserve update operators such as `$set`, `$inc`, `$push`, and `$addToSet`.
|
|
388
|
+
- Do not treat plugins as a replacement for app authorization or domain validation.
|
|
389
|
+
|
|
199
390
|
## Debug Output
|
|
200
391
|
|
|
201
392
|
Use `mongoDebug(collection, method, ...args)` when a Mongoose debug callback should be rendered as a Mongo shell-friendly command.
|
|
202
393
|
|
|
394
|
+
Debug output is for developer diagnostics. Do not log credentials or sensitive document payloads in production logs.
|
|
395
|
+
|
|
203
396
|
---
|
|
204
397
|
|
|
205
398
|
## JokTec MySQL Skill
|
|
@@ -216,11 +409,13 @@ Use this skill for relational resources backed by JokTec's TypeORM wrapper.
|
|
|
216
409
|
- Treat `mysql`, `mariadb`, and `postgres` as the first-class dialects.
|
|
217
410
|
- Keep `sync` explicit and normally enabled only by an owner process or development bootstrap.
|
|
218
411
|
- 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.
|
|
219
414
|
|
|
220
415
|
## References
|
|
221
416
|
|
|
222
417
|
- Read `references/repository.md` for connection lifecycle, repository usage, query safety, transaction, and cursor behavior.
|
|
223
|
-
- Read `references/entities.md` for `@Tables`, `@Column`, `@PrimaryColumn`, uuidv7, and
|
|
418
|
+
- Read `references/entities.md` for `@Tables`, `@Column`, `@PrimaryColumn`, uuidv7, dialect guidance, and legacy decorator migration rules.
|
|
224
419
|
|
|
225
420
|
## Bundled References
|
|
226
421
|
|
|
@@ -228,15 +423,115 @@ Use this skill for relational resources backed by JokTec's TypeORM wrapper.
|
|
|
228
423
|
|
|
229
424
|
# MySQL Entity Decorators
|
|
230
425
|
|
|
426
|
+
## Source Lookup
|
|
427
|
+
|
|
428
|
+
When blocked, inspect:
|
|
429
|
+
|
|
430
|
+
- `packages/databases/mysql/src/decorators/table.decorator.ts`
|
|
431
|
+
- `packages/databases/mysql/src/decorators/column.decorator.ts`
|
|
432
|
+
- `packages/databases/mysql/src/decorators/columns/column.type.ts`
|
|
433
|
+
- `packages/databases/mysql/src/decorators/columns/column.factory.ts`
|
|
434
|
+
- `packages/databases/mysql/src/decorators/columns/primary.column.ts`
|
|
435
|
+
- `packages/databases/mysql/src/decorators/columns/string.column.ts`
|
|
436
|
+
- `packages/databases/mysql/src/decorators/columns/number.column.ts`
|
|
437
|
+
- `packages/databases/mysql/src/decorators/columns/transform.column.ts`
|
|
438
|
+
- `packages/databases/mysql/src/decorators/columns/swagger.column.ts`
|
|
439
|
+
|
|
231
440
|
## Schema-First Entity Pattern
|
|
232
441
|
|
|
233
442
|
Use `@Tables`, `@Column`, and `@PrimaryColumn` from `@joktec/mysql` when an entity should also act as the source class for mapped DTOs.
|
|
234
443
|
|
|
444
|
+
The new decorators are not thin TypeORM aliases. They are schema-first wrappers that compose:
|
|
445
|
+
|
|
446
|
+
- TypeORM column/primary column metadata.
|
|
447
|
+
- `class-validator` behavior through `@joktec/utils` validators.
|
|
448
|
+
- `class-transformer` expose/exclude behavior.
|
|
449
|
+
- Swagger property metadata.
|
|
450
|
+
|
|
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.
|
|
452
|
+
|
|
453
|
+
## Legacy Decorator Migration
|
|
454
|
+
|
|
455
|
+
Migrate a whole property at a time. Do not only replace `PrimaryGeneratedColumn`.
|
|
456
|
+
|
|
457
|
+
Common mappings:
|
|
458
|
+
|
|
459
|
+
| Legacy decorators | New decorator shape |
|
|
460
|
+
| --- | --- |
|
|
461
|
+
| `@PrimaryGeneratedColumn()` | `@PrimaryColumn('increment')` |
|
|
462
|
+
| `@PrimaryGeneratedColumn('uuid')` | `@PrimaryColumn('uuid')` |
|
|
463
|
+
| app-generated ordered UUID id | `@PrimaryColumn('uuidv7')` |
|
|
464
|
+
| `@Column(...)` | `@Column(...)` from `@joktec/mysql` |
|
|
465
|
+
| `@IsNotEmpty()` | `@Column({ required: true })` |
|
|
466
|
+
| `@IsOptional()` | `@Column({ required: false })` or nullable TypeORM option when storage allows null |
|
|
467
|
+
| `@IsEmail()` | `@Column({ isEmail: true })` |
|
|
468
|
+
| `@IsMobilePhone()` | `@Column({ isPhone: true })` |
|
|
469
|
+
| `@IsHexColor()` | `@Column({ isHexColor: true })` |
|
|
470
|
+
| `@IsUrl()` | `@Column({ isUrl: true })` |
|
|
471
|
+
| `@MinLength(n)` | `@Column({ minLength: n })` |
|
|
472
|
+
| `@MaxLength(n)` | `@Column({ maxLength: n })` |
|
|
473
|
+
| `@Min(n)` | `@Column({ min: n })` |
|
|
474
|
+
| `@Max(n)` | `@Column({ max: n })` |
|
|
475
|
+
| `@Expose()` | default behavior of `@Column(...)` |
|
|
476
|
+
| `@Expose({ groups })` | `@Column({ groups })` |
|
|
477
|
+
| `@Exclude({ toPlainOnly: true })` plus hidden Swagger | `@Column({ hidden: true })` |
|
|
478
|
+
| `@ApiProperty(...)` | `@Column({ swagger: ... })`, or native options such as `example`, `comment`, `deprecated`, `min`, `max`, `minLength`, `maxLength` |
|
|
479
|
+
|
|
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
|
+
```
|
|
512
|
+
|
|
513
|
+
For hidden fields:
|
|
514
|
+
|
|
515
|
+
```ts
|
|
516
|
+
// Before
|
|
517
|
+
@Column({ type: 'varchar', length: 255 })
|
|
518
|
+
@Exclude({ toPlainOnly: true })
|
|
519
|
+
@ApiHideProperty()
|
|
520
|
+
password!: string;
|
|
521
|
+
|
|
522
|
+
// After
|
|
523
|
+
@Column('varchar', { length: 255, hidden: true })
|
|
524
|
+
password!: string;
|
|
525
|
+
```
|
|
526
|
+
|
|
235
527
|
## Primary Keys
|
|
236
528
|
|
|
237
529
|
- Prefer numeric auto-increment keys for write-heavy MySQL tables.
|
|
238
530
|
- Use UUIDs when the app needs globally unique or public identifiers.
|
|
239
531
|
- Prefer `uuidv7` over random UUIDs when the id participates in ordered indexes or cursor-like access.
|
|
532
|
+
- When switching from UUID v4 to uuidv7, verify downstream code does not assume random UUID ordering.
|
|
533
|
+
|
|
534
|
+
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.
|
|
240
535
|
|
|
241
536
|
## Dialects
|
|
242
537
|
|
|
@@ -246,28 +541,77 @@ The stable dialects are MySQL, MariaDB, and Postgres. Dialect capabilities own d
|
|
|
246
541
|
|
|
247
542
|
# MySQL Repository Usage
|
|
248
543
|
|
|
544
|
+
## Source Lookup
|
|
545
|
+
|
|
546
|
+
When blocked, inspect:
|
|
547
|
+
|
|
548
|
+
- `packages/databases/mysql/README.md`
|
|
549
|
+
- `packages/databases/mysql/AGENTS.md`
|
|
550
|
+
- `packages/databases/mysql/src/index.ts`
|
|
551
|
+
- `packages/databases/mysql/src/mysql.module.ts`
|
|
552
|
+
- `packages/databases/mysql/src/mysql.service.ts`
|
|
553
|
+
- `packages/databases/mysql/src/mysql.repo.ts`
|
|
554
|
+
- `packages/databases/mysql/src/helpers/mysql.helper.ts`
|
|
555
|
+
- `packages/databases/mysql/src/helpers/mysql.finder.ts`
|
|
556
|
+
- `packages/databases/mysql/src/services/mysql.dialect.ts`
|
|
557
|
+
- `packages/databases/mysql/src/models/*`
|
|
558
|
+
|
|
249
559
|
## Module Setup
|
|
250
560
|
|
|
251
561
|
Register entities with `MysqlModule.forRoot({ conId, models: [...] })`. Use `conId` for multiple DataSources.
|
|
252
562
|
|
|
563
|
+
Best practice:
|
|
564
|
+
|
|
565
|
+
- Register consumer app entities in an app repository module.
|
|
566
|
+
- Keep `sync` disabled in request-facing processes unless the app intentionally owns schema sync.
|
|
567
|
+
- Use one controlled owner process for schema sync/migration in multi-process deployments.
|
|
568
|
+
- Preserve `conId` when resolving repositories or transaction-scoped managers.
|
|
569
|
+
|
|
253
570
|
## Repository Pattern
|
|
254
571
|
|
|
255
572
|
Extend `MysqlRepo` and pass the entity class to the base constructor. Services can use `BaseService` when CRUD behavior follows the shared contract.
|
|
256
573
|
|
|
574
|
+
Repository checklist:
|
|
575
|
+
|
|
576
|
+
- Keep entity-specific SQL helpers in the app repository, not in controllers.
|
|
577
|
+
- Use `MysqlRepo.qb()` and repository methods for standard reads so field validation, relation loading, soft delete, and pagination stay consistent.
|
|
578
|
+
- Do not add new behavior to `MysqlFinder`; it is deprecated compatibility code.
|
|
579
|
+
- Keep read/write operations in the same transaction context when the app passes a manager or query runner.
|
|
580
|
+
|
|
257
581
|
## Query Safety
|
|
258
582
|
|
|
259
583
|
- Validate field paths against TypeORM metadata before interpolating SQL identifiers.
|
|
260
584
|
- Use parameter binding for values.
|
|
261
585
|
- Keep logical operators such as `$and` and `$or` grouped through QueryBuilder behavior.
|
|
262
586
|
|
|
587
|
+
Anti-patterns:
|
|
588
|
+
|
|
589
|
+
- Do not interpolate user-provided field names or relation names into SQL without TypeORM metadata validation.
|
|
590
|
+
- Do not assume MySQL-only syntax when the package supports MySQL, MariaDB, and Postgres.
|
|
591
|
+
- Do not use a relation/populate path unless it maps to entity metadata.
|
|
592
|
+
|
|
263
593
|
## Pagination
|
|
264
594
|
|
|
265
595
|
`MysqlRepo.paginate` supports page, offset, and cursor responses. Cursor mode defaults to `createdAt` plus primary key columns. Custom cursor keys must be mapped columns.
|
|
266
596
|
|
|
597
|
+
Cursor checklist:
|
|
598
|
+
|
|
599
|
+
- Use `createdAt + primary key` as the default stable cursor.
|
|
600
|
+
- Add primary keys as tie-breakers for non-unique cursor keys.
|
|
601
|
+
- Ensure cursor keys are indexed for hot list endpoints.
|
|
602
|
+
- Validate cursor payload shape before building SQL.
|
|
603
|
+
- Treat cursor tokens as opaque; clients should not parse them.
|
|
604
|
+
|
|
267
605
|
## Transactions
|
|
268
606
|
|
|
269
607
|
When using transaction-scoped operations, pass the manager or query runner through repository options so pre-read and write operations use the same context.
|
|
270
608
|
|
|
609
|
+
Transaction checklist:
|
|
610
|
+
|
|
611
|
+
- Use one manager/query runner for read-modify-write flows.
|
|
612
|
+
- Rollback tests should prove that both pre-read dependent writes and writes are transaction-scoped.
|
|
613
|
+
- Avoid mixing default repositories and transaction-scoped repositories in one operation.
|
|
614
|
+
|
|
271
615
|
---
|
|
272
616
|
|
|
273
617
|
## JokTec Broker Skill
|
|
@@ -289,6 +633,7 @@ Use this skill for message broker packages.
|
|
|
289
633
|
- Use broker decorators for transport wiring, not for domain policy.
|
|
290
634
|
- Preserve config-driven client selection and `conId` when available.
|
|
291
635
|
- Keep topic, queue, and routing names explicit in app configuration or decorators.
|
|
636
|
+
- If guidance is insufficient, read this skill's references and inspect `../joktec-framework` package source or GitHub fallback before assuming APIs.
|
|
292
637
|
|
|
293
638
|
## Reference
|
|
294
639
|
|
|
@@ -300,10 +645,22 @@ Read `references/brokers.md` for setup and package-specific notes.
|
|
|
300
645
|
|
|
301
646
|
# Broker Usage
|
|
302
647
|
|
|
648
|
+
## Source Lookup
|
|
649
|
+
|
|
650
|
+
When blocked, inspect:
|
|
651
|
+
|
|
652
|
+
- `packages/brokers/README.md`
|
|
653
|
+
- `packages/brokers/AGENTS.md`
|
|
654
|
+
- `packages/brokers/<package>/README.md`
|
|
655
|
+
- `packages/brokers/<package>/src/index.ts`
|
|
656
|
+
- package decorators, loaders, config, and service files under `src/`
|
|
657
|
+
|
|
303
658
|
## Runtime Pattern
|
|
304
659
|
|
|
305
660
|
Broker services follow `AbstractClientService` lifecycle. Loader classes discover decorator metadata after module initialization. Apps define producers, consumers, and message semantics.
|
|
306
661
|
|
|
662
|
+
Use broker packages for transport wiring, not for business workflow ownership. The consuming app owns event names, payload contracts, idempotency, retry policy, dead-letter behavior, and handler semantics.
|
|
663
|
+
|
|
307
664
|
## Package Notes
|
|
308
665
|
|
|
309
666
|
- Kafka: check topic existence and broker advertised listeners in local development.
|
|
@@ -311,6 +668,23 @@ Broker services follow `AbstractClientService` lifecycle. Loader classes discove
|
|
|
311
668
|
- SQS: local ElasticMQ-style environments may require queues to exist before consumers start.
|
|
312
669
|
- Redcast: use Redis-backed list, stream, or pub/sub behavior when a lightweight broker is enough.
|
|
313
670
|
|
|
671
|
+
## Best Practices
|
|
672
|
+
|
|
673
|
+
- Start consumers only in processes that should own subscriptions.
|
|
674
|
+
- Keep producer and consumer payload DTOs versionable and explicit.
|
|
675
|
+
- Use config paths or module options for topic/queue names when supported.
|
|
676
|
+
- Make handlers idempotent; brokers may redeliver.
|
|
677
|
+
- Add observable effects for consumer tests rather than asserting log text.
|
|
678
|
+
- Keep broker health/preflight checks separate from business request handling.
|
|
679
|
+
- In local stacks, verify broker-specific infrastructure: Kafka topics, Rabbit exchanges/queues, SQS queues, Redis password/db.
|
|
680
|
+
|
|
681
|
+
## Anti-Patterns
|
|
682
|
+
|
|
683
|
+
- Do not hide domain workflows inside decorators or broker package services.
|
|
684
|
+
- Do not assume auto-create topic/queue behavior unless the package and local broker support it.
|
|
685
|
+
- Do not run the same consumer group/queue owner in every process by accident.
|
|
686
|
+
- Do not swallow message handling errors without retry/dead-letter visibility.
|
|
687
|
+
|
|
314
688
|
---
|
|
315
689
|
|
|
316
690
|
## JokTec Adapter Skill
|
|
@@ -332,6 +706,7 @@ Use this skill for pluggable external capability adapters.
|
|
|
332
706
|
- Use validated config and `conId` where supported.
|
|
333
707
|
- Keep secrets and credentials in app config or runtime environment, never in code.
|
|
334
708
|
- Prefer adapter services over direct SDK usage in app services.
|
|
709
|
+
- If guidance is insufficient, read this skill's references and inspect `../joktec-framework` package source or GitHub fallback before assuming APIs.
|
|
335
710
|
|
|
336
711
|
## Reference
|
|
337
712
|
|
|
@@ -343,10 +718,22 @@ Read `references/adapters.md` for setup and package-specific notes.
|
|
|
343
718
|
|
|
344
719
|
# Adapter Usage
|
|
345
720
|
|
|
721
|
+
## Source Lookup
|
|
722
|
+
|
|
723
|
+
When blocked, inspect:
|
|
724
|
+
|
|
725
|
+
- `packages/adapters/README.md`
|
|
726
|
+
- `packages/adapters/AGENTS.md`
|
|
727
|
+
- `packages/adapters/<package>/README.md`
|
|
728
|
+
- `packages/adapters/<package>/src/index.ts`
|
|
729
|
+
- package module/config/service files under `src/`
|
|
730
|
+
|
|
346
731
|
## Runtime Pattern
|
|
347
732
|
|
|
348
733
|
Adapters are global Nest modules. Services own native client creation and expose package-specific operations.
|
|
349
734
|
|
|
735
|
+
Most adapters follow `AbstractClientService`: config is validated, native clients are created by the service, `conId` selects the connection, and shutdown/retry/debug behavior should remain package-owned.
|
|
736
|
+
|
|
350
737
|
## Package Notes
|
|
351
738
|
|
|
352
739
|
- Cacher: choose local, Redis, or Memcached stores based on runtime config.
|
|
@@ -354,6 +741,22 @@ Adapters are global Nest modules. Services own native client creation and expose
|
|
|
354
741
|
- Notifier: keep push provider configuration outside app business logic.
|
|
355
742
|
- Storage: keep storage metadata and object operations behind the adapter service.
|
|
356
743
|
|
|
744
|
+
## Best Practices
|
|
745
|
+
|
|
746
|
+
- Import adapter modules in the application layer, then inject services into domain services.
|
|
747
|
+
- Keep provider credentials, endpoints, bucket names, SMTP secrets, and push credentials in runtime config.
|
|
748
|
+
- Keep business payload composition in the consuming app. The adapter should send/cache/store, not decide product semantics.
|
|
749
|
+
- Use `conId` for multiple providers or tenants instead of creating ad-hoc service instances.
|
|
750
|
+
- Normalize provider errors at the package/app boundary so controllers do not branch on SDK-specific messages.
|
|
751
|
+
- Mock SDK clients in unit tests; run live provider checks only in explicit integration or consumer harness tests.
|
|
752
|
+
|
|
753
|
+
## Anti-Patterns
|
|
754
|
+
|
|
755
|
+
- Do not put email template business rules inside `@joktec/mailer`.
|
|
756
|
+
- Do not hardcode S3 buckets, Redis URLs, SMTP credentials, or notification tokens in source.
|
|
757
|
+
- Do not bypass adapter services by importing provider SDK clients directly throughout the app.
|
|
758
|
+
- Do not assume every adapter has identical method names; read each package README/source before calling.
|
|
759
|
+
|
|
357
760
|
---
|
|
358
761
|
|
|
359
762
|
## JokTec Extended Database Skill
|
|
@@ -374,6 +777,7 @@ Use this skill for database clients that are not Mongo or MySQL.
|
|
|
374
777
|
- Use package services for client lifecycle and connection config.
|
|
375
778
|
- Do not claim parity with Mongo/MySQL repository behavior unless the package implements it.
|
|
376
779
|
- Use package README and source as final truth before adding advanced behavior.
|
|
780
|
+
- If guidance is insufficient, read this skill's references and inspect `../joktec-framework` package source or GitHub fallback before assuming APIs.
|
|
377
781
|
|
|
378
782
|
## Reference
|
|
379
783
|
|
|
@@ -385,6 +789,16 @@ Read `references/extended-databases.md` for package boundaries and usage notes.
|
|
|
385
789
|
|
|
386
790
|
# Extended Database Usage
|
|
387
791
|
|
|
792
|
+
## Source Lookup
|
|
793
|
+
|
|
794
|
+
When blocked, inspect:
|
|
795
|
+
|
|
796
|
+
- `packages/databases/README.md`
|
|
797
|
+
- `packages/databases/AGENTS.md`
|
|
798
|
+
- `packages/databases/<package>/README.md`
|
|
799
|
+
- `packages/databases/<package>/src/index.ts`
|
|
800
|
+
- package config/module/service files under `src/`
|
|
801
|
+
|
|
388
802
|
## Package Boundaries
|
|
389
803
|
|
|
390
804
|
Extended database packages expose reusable clients and helpers for specific data systems. They should not contain consumer app schemas or business-specific query policy.
|
|
@@ -395,6 +809,20 @@ Extended database packages expose reusable clients and helpers for specific data
|
|
|
395
809
|
- Arango and BigQuery are separate client packages; verify the README/source before assuming repository-like CRUD support.
|
|
396
810
|
- Use local package tests or consumer harnesses only when the target service stack is available.
|
|
397
811
|
|
|
812
|
+
## Best Practices
|
|
813
|
+
|
|
814
|
+
- Treat these packages as client wrappers unless source explicitly exposes a repository abstraction.
|
|
815
|
+
- Keep index names, dataset names, query templates, and domain-specific projections in the consumer app.
|
|
816
|
+
- Validate credentials and endpoints through config; never commit service account data.
|
|
817
|
+
- Keep retries, timeouts, and debug logging visible in config.
|
|
818
|
+
- Use provider-specific tests/mocks for package logic and live stack tests only when credentials/services are intentionally available.
|
|
819
|
+
|
|
820
|
+
## Anti-Patterns
|
|
821
|
+
|
|
822
|
+
- Do not apply MongoRepo/MysqlRepo assumptions to Elastic/Arango/BigQuery.
|
|
823
|
+
- Do not introduce app schemas or business query policy into reusable database clients.
|
|
824
|
+
- Do not claim support for a provider feature unless the package source or README shows it.
|
|
825
|
+
|
|
398
826
|
---
|
|
399
827
|
|
|
400
828
|
## JokTec Integration Skill
|
|
@@ -414,6 +842,7 @@ Use this skill for third-party integration packages.
|
|
|
414
842
|
- Use package services instead of direct SDK initialization in app code.
|
|
415
843
|
- Preserve app-neutral service behavior; consumer apps own domain workflows.
|
|
416
844
|
- Verify current package README/source before relying on advanced provider features.
|
|
845
|
+
- If guidance is insufficient, read this skill's references and inspect `../joktec-framework` package source or GitHub fallback before assuming APIs.
|
|
417
846
|
|
|
418
847
|
## Reference
|
|
419
848
|
|
|
@@ -425,14 +854,43 @@ Read `references/integrations.md` for provider-specific notes.
|
|
|
425
854
|
|
|
426
855
|
# Integration Usage
|
|
427
856
|
|
|
857
|
+
## Source Lookup
|
|
858
|
+
|
|
859
|
+
When blocked, inspect:
|
|
860
|
+
|
|
861
|
+
- `packages/integrations/README.md`
|
|
862
|
+
- `packages/integrations/AGENTS.md`
|
|
863
|
+
- `packages/integrations/<package>/README.md`
|
|
864
|
+
- `packages/integrations/<package>/src/index.ts`
|
|
865
|
+
- package config/module/service files under `src/`
|
|
866
|
+
|
|
428
867
|
## Firebase
|
|
429
868
|
|
|
430
869
|
Use the integration module and service to initialize Firebase Admin clients from validated config. Keep credential files local or environment-provided.
|
|
431
870
|
|
|
871
|
+
Best practice:
|
|
872
|
+
|
|
873
|
+
- Keep service account JSON, private keys, and project credentials out of git.
|
|
874
|
+
- Prefer environment-specific config or ignored local credential files.
|
|
875
|
+
- Keep notification/user/storage/product semantics in the consumer app.
|
|
876
|
+
- Mock Firebase Admin SDK in package tests; use live credentials only in explicit integration environments.
|
|
877
|
+
|
|
432
878
|
## GPT
|
|
433
879
|
|
|
434
880
|
Use the integration package for reusable GPT client setup. Keep prompt/business policy in the consumer app, not in the generic package.
|
|
435
881
|
|
|
882
|
+
Best practice:
|
|
883
|
+
|
|
884
|
+
- Keep prompts, model choice policy, tool schemas, and product safety rules in the consumer app.
|
|
885
|
+
- Keep API keys in secret management or environment config.
|
|
886
|
+
- Verify current package completeness before relying on advanced APIs; `@joktec/gpt` may lag behind provider SDK changes.
|
|
887
|
+
|
|
888
|
+
## Anti-Patterns
|
|
889
|
+
|
|
890
|
+
- Do not commit real credential files.
|
|
891
|
+
- Do not encode product-specific prompts or notification logic into the reusable integration package.
|
|
892
|
+
- Do not assume provider SDK behavior without checking package source and provider docs when APIs are unstable.
|
|
893
|
+
|
|
436
894
|
---
|
|
437
895
|
|
|
438
896
|
## JokTec Tool Skill
|
|
@@ -453,6 +911,7 @@ Use this skill for reusable utility services.
|
|
|
453
911
|
- Use config-driven clients instead of direct ad hoc setup in app code.
|
|
454
912
|
- Preserve retry, metrics, proxy, and upload behavior where the package exposes it.
|
|
455
913
|
- Keep alert tokens and webhook URLs in runtime config only.
|
|
914
|
+
- If guidance is insufficient, read this skill's references and inspect `../joktec-framework` package source or GitHub fallback before assuming APIs.
|
|
456
915
|
|
|
457
916
|
## Reference
|
|
458
917
|
|
|
@@ -464,14 +923,49 @@ Read `references/tools.md` for package-specific usage notes.
|
|
|
464
923
|
|
|
465
924
|
# Tool Usage
|
|
466
925
|
|
|
926
|
+
## Source Lookup
|
|
927
|
+
|
|
928
|
+
When blocked, inspect:
|
|
929
|
+
|
|
930
|
+
- `packages/tools/README.md`
|
|
931
|
+
- `packages/tools/AGENTS.md`
|
|
932
|
+
- `packages/tools/<package>/README.md`
|
|
933
|
+
- `packages/tools/<package>/src/index.ts`
|
|
934
|
+
- package config/module/service/helper files under `src/`
|
|
935
|
+
|
|
467
936
|
## HTTP
|
|
468
937
|
|
|
469
938
|
Use `@joktec/http` for Axios-backed requests, uploads, proxy agent support, retry config, and metrics where exposed.
|
|
470
939
|
|
|
940
|
+
Best practice:
|
|
941
|
+
|
|
942
|
+
- Use the package service for outbound HTTP so retry/proxy/metrics behavior stays centralized.
|
|
943
|
+
- Keep external endpoint URLs and credentials in runtime config.
|
|
944
|
+
- Be careful with ESM/CommonJS import changes in HTTP/Axios ecosystem packages.
|
|
945
|
+
- Test request behavior with mocks unless the test is an explicit consumer integration scenario.
|
|
946
|
+
|
|
471
947
|
## File
|
|
472
948
|
|
|
473
949
|
Use `@joktec/file` for shared file helpers and classification behavior instead of duplicating local utility code.
|
|
474
950
|
|
|
951
|
+
Best practice:
|
|
952
|
+
|
|
953
|
+
- Keep filesystem paths and temporary directories environment-specific.
|
|
954
|
+
- Validate upload/file inputs before passing them into business workflows.
|
|
955
|
+
- Use package helpers for MIME/classification behavior when consistency matters across services.
|
|
956
|
+
|
|
475
957
|
## Alert
|
|
476
958
|
|
|
477
959
|
Use `@joktec/alert` for Slack-compatible webhook alerts. Keep webhook URLs and credentials out of source control.
|
|
960
|
+
|
|
961
|
+
Best practice:
|
|
962
|
+
|
|
963
|
+
- Treat alert messages as operational notifications, not business workflows.
|
|
964
|
+
- Do not leak secrets, tokens, connection strings, or personal data into alert payloads.
|
|
965
|
+
- `@joktec/alert` is present but less complete than core database/client packages; inspect source before depending on advanced behavior.
|
|
966
|
+
|
|
967
|
+
## Anti-Patterns
|
|
968
|
+
|
|
969
|
+
- Do not scatter raw Axios instances across the app when `@joktec/http` should own shared behavior.
|
|
970
|
+
- Do not commit webhook URLs or proxy credentials.
|
|
971
|
+
- Do not use tool packages as hidden places for app business rules.
|