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