@joktec/skills 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/README.md +20 -4
  2. package/bin/joktec-skills.mjs +33 -27
  3. package/dist/claude/skills/joktec-adapter-skill/SKILL.md +5 -0
  4. package/dist/claude/skills/joktec-adapter-skill/references/adapters.md +28 -0
  5. package/dist/claude/skills/joktec-broker-skill/SKILL.md +5 -0
  6. package/dist/claude/skills/joktec-broker-skill/references/brokers.md +29 -0
  7. package/dist/claude/skills/joktec-common-skill/SKILL.md +4 -0
  8. package/dist/claude/skills/joktec-common-skill/references/core.md +56 -0
  9. package/dist/claude/skills/joktec-common-skill/references/utils-cron.md +28 -0
  10. package/dist/claude/skills/joktec-database-extended-skill/SKILL.md +5 -0
  11. package/dist/claude/skills/joktec-database-extended-skill/references/extended-databases.md +24 -0
  12. package/dist/claude/skills/joktec-framework-skill/SKILL.md +1 -0
  13. package/dist/claude/skills/joktec-framework-skill/references/framework-map.md +34 -0
  14. package/dist/claude/skills/joktec-integration-skill/SKILL.md +5 -0
  15. package/dist/claude/skills/joktec-integration-skill/references/integrations.md +29 -0
  16. package/dist/claude/skills/joktec-mongo-skill/SKILL.md +5 -0
  17. package/dist/claude/skills/joktec-mongo-skill/references/repository.md +43 -0
  18. package/dist/claude/skills/joktec-mongo-skill/references/schema-and-plugins.md +29 -0
  19. package/dist/claude/skills/joktec-mysql-skill/SKILL.md +7 -1
  20. package/dist/claude/skills/joktec-mysql-skill/references/entities.md +100 -0
  21. package/dist/claude/skills/joktec-mysql-skill/references/repository.md +49 -0
  22. package/dist/claude/skills/joktec-tool-skill/SKILL.md +5 -0
  23. package/dist/claude/skills/joktec-tool-skill/references/tools.md +35 -0
  24. package/dist/codex/skills/joktec-adapter-skill/SKILL.md +5 -0
  25. package/dist/codex/skills/joktec-adapter-skill/references/adapters.md +28 -0
  26. package/dist/codex/skills/joktec-broker-skill/SKILL.md +5 -0
  27. package/dist/codex/skills/joktec-broker-skill/references/brokers.md +29 -0
  28. package/dist/codex/skills/joktec-common-skill/SKILL.md +4 -0
  29. package/dist/codex/skills/joktec-common-skill/references/core.md +56 -0
  30. package/dist/codex/skills/joktec-common-skill/references/utils-cron.md +28 -0
  31. package/dist/codex/skills/joktec-database-extended-skill/SKILL.md +5 -0
  32. package/dist/codex/skills/joktec-database-extended-skill/references/extended-databases.md +24 -0
  33. package/dist/codex/skills/joktec-framework-skill/SKILL.md +1 -0
  34. package/dist/codex/skills/joktec-framework-skill/references/framework-map.md +34 -0
  35. package/dist/codex/skills/joktec-integration-skill/SKILL.md +5 -0
  36. package/dist/codex/skills/joktec-integration-skill/references/integrations.md +29 -0
  37. package/dist/codex/skills/joktec-mongo-skill/SKILL.md +5 -0
  38. package/dist/codex/skills/joktec-mongo-skill/references/repository.md +43 -0
  39. package/dist/codex/skills/joktec-mongo-skill/references/schema-and-plugins.md +29 -0
  40. package/dist/codex/skills/joktec-mysql-skill/SKILL.md +7 -1
  41. package/dist/codex/skills/joktec-mysql-skill/references/entities.md +100 -0
  42. package/dist/codex/skills/joktec-mysql-skill/references/repository.md +49 -0
  43. package/dist/codex/skills/joktec-tool-skill/SKILL.md +5 -0
  44. package/dist/codex/skills/joktec-tool-skill/references/tools.md +35 -0
  45. package/dist/copilot/.github/copilot-instructions.md +495 -1
  46. package/dist/cursor/.cursor/rules/joktec-adapter-skill.mdc +29 -0
  47. package/dist/cursor/.cursor/rules/joktec-broker-skill.mdc +30 -0
  48. package/dist/cursor/.cursor/rules/joktec-common-skill.mdc +85 -0
  49. package/dist/cursor/.cursor/rules/joktec-database-extended-skill.mdc +25 -0
  50. package/dist/cursor/.cursor/rules/joktec-framework-skill.mdc +35 -0
  51. package/dist/cursor/.cursor/rules/joktec-integration-skill.mdc +30 -0
  52. package/dist/cursor/.cursor/rules/joktec-mongo-skill.mdc +73 -0
  53. package/dist/cursor/.cursor/rules/joktec-mysql-skill.mdc +152 -1
  54. package/dist/cursor/.cursor/rules/joktec-tool-skill.mdc +36 -0
  55. package/dist/gemini/GEMINI.md +495 -1
  56. package/dist/windsurf/.windsurf/rules/joktec-adapter-skill.md +29 -0
  57. package/dist/windsurf/.windsurf/rules/joktec-broker-skill.md +30 -0
  58. package/dist/windsurf/.windsurf/rules/joktec-common-skill.md +85 -0
  59. package/dist/windsurf/.windsurf/rules/joktec-database-extended-skill.md +25 -0
  60. package/dist/windsurf/.windsurf/rules/joktec-framework-skill.md +35 -0
  61. package/dist/windsurf/.windsurf/rules/joktec-integration-skill.md +30 -0
  62. package/dist/windsurf/.windsurf/rules/joktec-mongo-skill.md +73 -0
  63. package/dist/windsurf/.windsurf/rules/joktec-mysql-skill.md +152 -1
  64. package/dist/windsurf/.windsurf/rules/joktec-tool-skill.md +36 -0
  65. package/package.json +1 -1
  66. package/scripts/validate-skills.mjs +32 -0
  67. package/skill-pack.json +261 -52
  68. package/skills/joktec-adapter-skill/SKILL.md +5 -0
  69. package/skills/joktec-adapter-skill/references/adapters.md +28 -0
  70. package/skills/joktec-broker-skill/SKILL.md +5 -0
  71. package/skills/joktec-broker-skill/references/brokers.md +29 -0
  72. package/skills/joktec-common-skill/SKILL.md +4 -0
  73. package/skills/joktec-common-skill/references/core.md +56 -0
  74. package/skills/joktec-common-skill/references/utils-cron.md +28 -0
  75. package/skills/joktec-database-extended-skill/SKILL.md +5 -0
  76. package/skills/joktec-database-extended-skill/references/extended-databases.md +24 -0
  77. package/skills/joktec-framework-skill/SKILL.md +1 -0
  78. package/skills/joktec-framework-skill/references/framework-map.md +34 -0
  79. package/skills/joktec-integration-skill/SKILL.md +5 -0
  80. package/skills/joktec-integration-skill/references/integrations.md +29 -0
  81. package/skills/joktec-mongo-skill/SKILL.md +5 -0
  82. package/skills/joktec-mongo-skill/references/repository.md +43 -0
  83. package/skills/joktec-mongo-skill/references/schema-and-plugins.md +29 -0
  84. package/skills/joktec-mysql-skill/SKILL.md +7 -1
  85. package/skills/joktec-mysql-skill/references/entities.md +100 -0
  86. package/skills/joktec-mysql-skill/references/repository.md +49 -0
  87. package/skills/joktec-tool-skill/SKILL.md +5 -0
  88. package/skills/joktec-tool-skill/references/tools.md +35 -0
package/README.md CHANGED
@@ -109,19 +109,28 @@ The result is less prompt repetition, better package boundary discipline, and mo
109
109
 
110
110
  `joktec-framework-skill` is the required entrypoint skill. Installers should always include it so agents can route from a generic JokTec request to the correct focused skill.
111
111
 
112
- `joktec-common-skill` is the default foundation skill. Focused package skills such as Mongo, MySQL, brokers, adapters, integrations, and tools depend on the entrypoint and recommend the common skill because most package usage flows rely on core config, lifecycle, or base abstractions.
112
+ `joktec-common-skill` is the required foundation skill. It depends on `joktec-framework-skill`. Focused package skills such as Mongo, MySQL, brokers, adapters, integrations, and tools depend on both `joktec-framework-skill` and `joktec-common-skill` because most package usage flows rely on core config, lifecycle, or base abstractions.
113
113
 
114
114
  Dependency metadata lives in `skill-pack.json`:
115
115
 
116
116
  ```json
117
117
  {
118
118
  "id": "joktec-mongo-skill",
119
- "dependencies": ["joktec-framework-skill"],
120
- "recommended": ["joktec-common-skill"]
119
+ "dependencies": ["joktec-framework-skill", "joktec-common-skill"],
120
+ "recommended": []
121
121
  }
122
122
  ```
123
123
 
124
- The CLI resolves `dependencies` automatically. `recommended` skills are shown to the user and can be installed with `--yes` or explicit selection.
124
+ The `@joktec/skills` CLI resolves `dependencies` automatically.
125
+
126
+ The ecosystem `npx skills` CLI currently installs exactly the skills selected in its prompt. When using it, select dependencies manually or pass them explicitly:
127
+
128
+ ```bash
129
+ npx skills add joktec/joktec-skills -a codex --project . \
130
+ --skill joktec-framework-skill joktec-common-skill joktec-mongo-skill
131
+ ```
132
+
133
+ `npx skills` also writes a project-level `skills-lock.json`. Keep that file if the project wants reproducible skill updates or restore support through the ecosystem CLI.
125
134
 
126
135
  ---
127
136
 
@@ -197,6 +206,13 @@ Install focused skills. Required dependencies are included automatically:
197
206
  npx @joktec/skills add mongo,mysql --agent codex --project .
198
207
  ```
199
208
 
209
+ Using the ecosystem `skills` CLI:
210
+
211
+ ```bash
212
+ npx skills add joktec/joktec-skills -a codex --project . \
213
+ --skill joktec-framework-skill joktec-common-skill joktec-mongo-skill
214
+ ```
215
+
200
216
  Install for multiple agents:
201
217
 
202
218
  ```bash
@@ -5,7 +5,7 @@ import path from 'node:path';
5
5
  import readline from 'node:readline';
6
6
  import readlinePromises from 'node:readline/promises';
7
7
  import { stdin as input, stdout as output } from 'node:process';
8
- import { DIST_DIR, ROOT, ensureDir, loadSkills, readJson, writeFile } from '../scripts/lib.mjs';
8
+ import { DIST_DIR, ROOT, ensureDir, loadSkills, readJson } from '../scripts/lib.mjs';
9
9
 
10
10
  const AGENTS = ['codex', 'claude', 'cursor', 'gemini', 'copilot', 'windsurf'];
11
11
  const DEFAULT_SOURCE = 'https://github.com/joktec/joktec-skills.git';
@@ -268,22 +268,6 @@ function executeOperations(operations, force, dryRun) {
268
268
  }
269
269
  }
270
270
 
271
- function writeManifest(project, pack, agents, skillIds, dryRun) {
272
- const file = path.join(project, '.joktec-skills.json');
273
- const existing = fs.existsSync(file) ? readJson(file) : {};
274
- const manifest = {
275
- package: '@joktec/skills',
276
- version: pack.version,
277
- installedAt: new Date().toISOString(),
278
- agents: Array.from(new Set([...(existing.agents || []), ...agents])).sort(),
279
- skills: Array.from(new Set([...(existing.skills || []), ...skillIds])).sort(),
280
- frameworkBaseline: pack.frameworkBaseline,
281
- packageBaseline: pack.packageBaseline,
282
- };
283
- if (!dryRun) writeFile(file, JSON.stringify(manifest, null, 2));
284
- return manifest;
285
- }
286
-
287
271
  function logo() {
288
272
  console.log(color.dim(` ██╗ ██████╗ ██╗ ██╗████████╗███████╗ ██████╗
289
273
  ██║██╔═══██╗██║ ██╔╝╚══██╔══╝██╔════╝██╔════╝
@@ -346,15 +330,26 @@ function buildInstalledLines(project, operations, skillIds, dryRun) {
346
330
  ]);
347
331
  }
348
332
 
333
+ function stripAnsi(value) {
334
+ return String(value).replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, '');
335
+ }
336
+
337
+ function fitLine(value) {
338
+ const width = Math.max(40, (output.columns || 100) - 4);
339
+ const plain = stripAnsi(value);
340
+ if (plain.length <= width) return value;
341
+ return `${plain.slice(0, width - 1)}…`;
342
+ }
343
+
349
344
  function renderMultiSelect(items, cursor, selected, message) {
350
- readline.cursorTo(output, 0);
351
- readline.clearScreenDown(output);
352
- console.log(`${color.green('◇')} ${message} ${color.dim('(space to toggle, enter to confirm)')}`);
345
+ const lines = [`${color.green('◇')} ${message} ${color.dim('(space to toggle, enter to confirm)')}`];
353
346
  for (let i = 0; i < items.length; i += 1) {
354
347
  const marker = selected.has(items[i].value) ? color.green('●') : '○';
355
348
  const pointer = i === cursor ? color.cyan('›') : ' ';
356
- console.log(`│ ${pointer} ${marker} ${items[i].label}`);
349
+ lines.push(`│ ${pointer} ${marker} ${fitLine(items[i].label)}`);
357
350
  }
351
+ output.write(`${lines.join('\n')}\n`);
352
+ return lines.length;
358
353
  }
359
354
 
360
355
  async function multiSelect(items, defaults, message) {
@@ -362,12 +357,22 @@ async function multiSelect(items, defaults, message) {
362
357
 
363
358
  const selected = new Set(defaults);
364
359
  let cursor = 0;
360
+ let renderedLines = 0;
365
361
  output.write('\n');
366
362
  readline.emitKeypressEvents(input);
367
363
  input.setRawMode(true);
368
364
 
369
365
  try {
370
366
  return await new Promise(resolve => {
367
+ const redraw = () => {
368
+ if (renderedLines) {
369
+ readline.moveCursor(output, 0, -renderedLines);
370
+ readline.cursorTo(output, 0);
371
+ readline.clearScreenDown(output);
372
+ }
373
+ renderedLines = renderMultiSelect(items, cursor, selected, message);
374
+ };
375
+
371
376
  const onKey = (str, key) => {
372
377
  if (key.name === 'c' && key.ctrl) {
373
378
  input.setRawMode(false);
@@ -383,15 +388,16 @@ async function multiSelect(items, defaults, message) {
383
388
  if (key.name === 'return') {
384
389
  input.off('keypress', onKey);
385
390
  input.setRawMode(false);
391
+ if (renderedLines) readline.moveCursor(output, 0, -renderedLines);
386
392
  readline.cursorTo(output, 0);
387
393
  readline.clearScreenDown(output);
388
394
  resolve(Array.from(selected));
389
395
  return;
390
396
  }
391
- renderMultiSelect(items, cursor, selected, message);
397
+ redraw();
392
398
  };
393
399
 
394
- renderMultiSelect(items, cursor, selected, message);
400
+ redraw();
395
401
  input.on('keypress', onKey);
396
402
  });
397
403
  } finally {
@@ -410,6 +416,7 @@ async function confirm(message, yes) {
410
416
 
411
417
  async function addCommand(args) {
412
418
  const { pack } = loadSkills();
419
+ const pkg = readJson(path.join(ROOT, 'package.json'));
413
420
  const project = path.resolve(args.project || '.');
414
421
  const source = consumeSourceToken(args);
415
422
  const agents = parseAgents(args.agent);
@@ -427,11 +434,12 @@ async function addCommand(args) {
427
434
  selected = await multiSelect(
428
435
  pack.skills.map(skill => ({
429
436
  value: skill.id,
430
- label: `${skill.id} ${color.dim(`(${skill.packages.join(', ')})`)}`,
437
+ label: `${skill.id} (${skill.packages.join(', ')})`,
431
438
  })),
432
439
  pack.skills.filter(skill => skill.requiredByDefault).map(skill => skill.id),
433
440
  'Select skills to install',
434
441
  );
442
+ step('Select skills to install', selected.join(', '));
435
443
  } else {
436
444
  selected = resolveSkillIds(pack, requested, Boolean(args.all));
437
445
  step('Select skills to install', selected.join(', '));
@@ -457,15 +465,13 @@ async function addCommand(args) {
457
465
  }
458
466
 
459
467
  executeOperations(operations, Boolean(args.force), Boolean(args['dry-run']));
460
- const manifest = writeManifest(project, pack, agents, resolution.selected, Boolean(args['dry-run']));
461
468
 
462
469
  step(args['dry-run'] ? 'Dry run complete' : 'Installation complete');
463
470
  box(
464
471
  `${args['dry-run'] ? 'Planned' : 'Installed'} ${resolution.selected.length} skills`,
465
472
  buildInstalledLines(project, operations, resolution.selected, Boolean(args['dry-run'])),
466
473
  );
467
- console.log(`│ ${color.dim(`Manifest: ${displayPath(path.join(project, '.joktec-skills.json'))}`)}`);
468
- console.log(`│ ${color.dim(`@joktec/skills ${manifest.version}`)}`);
474
+ console.log(`│ ${color.dim(`@joktec/skills ${pkg.version}`)}`);
469
475
  console.log('│');
470
476
  done('Review skills before use; they run with full agent permissions.');
471
477
  }
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: joktec-adapter-skill
3
3
  description: Use when wiring or using JokTec adapter packages @joktec/cacher, @joktec/mailer, @joktec/notifier, or @joktec/storage for cache, mail delivery, push notifications, object storage, config-driven clients, and app-neutral adapter services.
4
+ metadata:
5
+ dependencies:
6
+ - joktec-framework-skill
7
+ - joktec-common-skill
4
8
  ---
5
9
 
6
10
  # JokTec Adapter Skill
@@ -20,6 +24,7 @@ Use this skill for pluggable external capability adapters.
20
24
  - Use validated config and `conId` where supported.
21
25
  - Keep secrets and credentials in app config or runtime environment, never in code.
22
26
  - Prefer adapter services over direct SDK usage in app services.
27
+ - If guidance is insufficient, read this skill's references and inspect `../joktec-framework` package source or GitHub fallback before assuming APIs.
23
28
 
24
29
  ## Reference
25
30
 
@@ -1,12 +1,40 @@
1
1
  # Adapter Usage
2
2
 
3
+ ## Source Lookup
4
+
5
+ When blocked, inspect:
6
+
7
+ - `packages/adapters/README.md`
8
+ - `packages/adapters/AGENTS.md`
9
+ - `packages/adapters/<package>/README.md`
10
+ - `packages/adapters/<package>/src/index.ts`
11
+ - package module/config/service files under `src/`
12
+
3
13
  ## Runtime Pattern
4
14
 
5
15
  Adapters are global Nest modules. Services own native client creation and expose package-specific operations.
6
16
 
17
+ 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.
18
+
7
19
  ## Package Notes
8
20
 
9
21
  - Cacher: choose local, Redis, or Memcached stores based on runtime config.
10
22
  - Mailer: centralize mail transport configuration in the service that owns outbound email.
11
23
  - Notifier: keep push provider configuration outside app business logic.
12
24
  - Storage: keep storage metadata and object operations behind the adapter service.
25
+
26
+ ## Best Practices
27
+
28
+ - Import adapter modules in the application layer, then inject services into domain services.
29
+ - Keep provider credentials, endpoints, bucket names, SMTP secrets, and push credentials in runtime config.
30
+ - Keep business payload composition in the consuming app. The adapter should send/cache/store, not decide product semantics.
31
+ - Use `conId` for multiple providers or tenants instead of creating ad-hoc service instances.
32
+ - Normalize provider errors at the package/app boundary so controllers do not branch on SDK-specific messages.
33
+ - Mock SDK clients in unit tests; run live provider checks only in explicit integration or consumer harness tests.
34
+
35
+ ## Anti-Patterns
36
+
37
+ - Do not put email template business rules inside `@joktec/mailer`.
38
+ - Do not hardcode S3 buckets, Redis URLs, SMTP credentials, or notification tokens in source.
39
+ - Do not bypass adapter services by importing provider SDK clients directly throughout the app.
40
+ - Do not assume every adapter has identical method names; read each package README/source before calling.
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: joktec-broker-skill
3
3
  description: Use when wiring or using JokTec broker packages @joktec/kafka, @joktec/rabbit, @joktec/sqs, or @joktec/redcast, including client config, producer decorators, consumer loaders, message handlers, auto-binding, and app-level broker flows.
4
+ metadata:
5
+ dependencies:
6
+ - joktec-framework-skill
7
+ - joktec-common-skill
4
8
  ---
5
9
 
6
10
  # JokTec Broker Skill
@@ -20,6 +24,7 @@ Use this skill for message broker packages.
20
24
  - Use broker decorators for transport wiring, not for domain policy.
21
25
  - Preserve config-driven client selection and `conId` when available.
22
26
  - Keep topic, queue, and routing names explicit in app configuration or decorators.
27
+ - If guidance is insufficient, read this skill's references and inspect `../joktec-framework` package source or GitHub fallback before assuming APIs.
23
28
 
24
29
  ## Reference
25
30
 
@@ -1,12 +1,41 @@
1
1
  # Broker Usage
2
2
 
3
+ ## Source Lookup
4
+
5
+ When blocked, inspect:
6
+
7
+ - `packages/brokers/README.md`
8
+ - `packages/brokers/AGENTS.md`
9
+ - `packages/brokers/<package>/README.md`
10
+ - `packages/brokers/<package>/src/index.ts`
11
+ - package decorators, loaders, config, and service files under `src/`
12
+
3
13
  ## Runtime Pattern
4
14
 
5
15
  Broker services follow `AbstractClientService` lifecycle. Loader classes discover decorator metadata after module initialization. Apps define producers, consumers, and message semantics.
6
16
 
17
+ 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.
18
+
7
19
  ## Package Notes
8
20
 
9
21
  - Kafka: check topic existence and broker advertised listeners in local development.
10
22
  - RabbitMQ: use module options and decorators for exchanges, queues, and bindings.
11
23
  - SQS: local ElasticMQ-style environments may require queues to exist before consumers start.
12
24
  - Redcast: use Redis-backed list, stream, or pub/sub behavior when a lightweight broker is enough.
25
+
26
+ ## Best Practices
27
+
28
+ - Start consumers only in processes that should own subscriptions.
29
+ - Keep producer and consumer payload DTOs versionable and explicit.
30
+ - Use config paths or module options for topic/queue names when supported.
31
+ - Make handlers idempotent; brokers may redeliver.
32
+ - Add observable effects for consumer tests rather than asserting log text.
33
+ - Keep broker health/preflight checks separate from business request handling.
34
+ - In local stacks, verify broker-specific infrastructure: Kafka topics, Rabbit exchanges/queues, SQS queues, Redis password/db.
35
+
36
+ ## Anti-Patterns
37
+
38
+ - Do not hide domain workflows inside decorators or broker package services.
39
+ - Do not assume auto-create topic/queue behavior unless the package and local broker support it.
40
+ - Do not run the same consumer group/queue owner in every process by accident.
41
+ - Do not swallow message handling errors without retry/dead-letter visibility.
@@ -1,6 +1,9 @@
1
1
  ---
2
2
  name: joktec-common-skill
3
3
  description: Use when implementing or wiring @joktec/core, @joktec/utils, or @joktec/cron in a consumer app, especially BaseController, BaseService, pagination, config, client lifecycle, bootstrap, cron decorators, or utility helpers.
4
+ metadata:
5
+ dependencies:
6
+ - joktec-framework-skill
4
7
  ---
5
8
 
6
9
  # JokTec Common Skill
@@ -21,6 +24,7 @@ Use this skill for shared framework primitives, low-level helpers, cron utilitie
21
24
  - Use page, offset, or cursor pagination contracts from core; let database packages execute storage-specific pagination.
22
25
  - Use `AbstractClientService` patterns for client packages that need config, lifecycle, retry, and `conId`.
23
26
  - Use `@joktec/utils` for shared helpers instead of duplicating conversion, validation, hashing, or UUID logic.
27
+ - If guidance is insufficient, read this skill's references and inspect `../joktec-framework` package source or GitHub fallback before assuming APIs.
24
28
 
25
29
  ## References
26
30
 
@@ -1,19 +1,75 @@
1
1
  # Common Core Usage
2
2
 
3
+ ## Source Lookup
4
+
5
+ When blocked, inspect these framework files before guessing:
6
+
7
+ - `packages/common/core/README.md`
8
+ - `packages/common/core/AGENTS.md`
9
+ - `packages/common/core/src/index.ts`
10
+ - `packages/common/core/src/abstractions/*`
11
+ - `packages/common/core/src/models/base.request.ts`
12
+ - `packages/common/core/src/models/base.response.ts`
13
+ - `packages/common/core/src/models/paginations/*`
14
+ - `packages/common/core/src/client/abstract-client.service.ts`
15
+ - `packages/common/core/src/infras/application.ts`
16
+ - `packages/common/core/src/modules/*`
17
+
3
18
  ## Runtime Bootstrap
4
19
 
5
20
  Use the application bootstrap helpers from `@joktec/core` for gateway and microservice runtimes. Keep runtime behavior config-driven.
6
21
 
22
+ Best practice:
23
+
24
+ - Use `Application.bootstrap(AppModule)` instead of hand-rolling Nest bootstrap unless the consumer app has a specific runtime reason.
25
+ - Keep gateway-only behavior in gateway runtime modules and microservice-only behavior in micro runtime modules.
26
+ - Register framework modules through their dynamic module APIs when provided.
27
+ - Do not duplicate config parsing, logger setup, metrics setup, or process lifecycle hooks in consumer apps.
28
+
7
29
  ## CRUD Abstractions
8
30
 
9
31
  - `BaseController` creates standard REST CRUD endpoints for DTO-backed resources.
10
32
  - `BaseService` delegates repository operations through the shared repository contract.
11
33
  - `ClientController` and `ClientService` provide generated microservice CRUD patterns.
12
34
 
35
+ 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.
36
+
37
+ Controller checklist:
38
+
39
+ - choose the DTO/entity class intentionally
40
+ - set `paginationMode` for the representative Swagger response shape
41
+ - use `customDto.paginationDto` only when the built-in page/offset/cursor response does not represent the API
42
+ - keep auth/guards/interceptors consistent with app conventions
43
+ - avoid putting business branching in controller methods when it belongs in the service
44
+
13
45
  ## Pagination
14
46
 
15
47
  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.
16
48
 
49
+ Best practice:
50
+
51
+ - Use page pagination for admin tables and simple back-office views.
52
+ - Use offset pagination for mobile-style load-more when the data set is moderate and stable enough.
53
+ - Use cursor pagination for feeds, timelines, frequently inserted lists, or large tables.
54
+ - Do not document cursor support for a resource unless the underlying repository package actually supports it.
55
+ - When using cursor mode, ensure the database layer has stable sort keys and tie-breakers.
56
+
17
57
  ## Client Lifecycle
18
58
 
19
59
  Use `ClientConfig`, `AbstractClientService`, and `conId` when building or consuming packages that support multiple client connections.
60
+
61
+ Client package checklist:
62
+
63
+ - config class validates all required runtime options
64
+ - service startup fails clearly when the native client cannot initialize
65
+ - shutdown closes native connections only when initialized
66
+ - `conId` is preserved through service/repository calls
67
+ - logs do not leak credentials or full connection strings
68
+ - retries and debug behavior are config-driven
69
+
70
+ ## Do Not
71
+
72
+ - Do not import concrete package or app code into `@joktec/core`.
73
+ - Do not bypass shared pagination contracts with ad-hoc response shapes for standard CRUD.
74
+ - Do not add new public symbols without exporting them through `src/index.ts`.
75
+ - Do not silently swallow bootstrap/client initialization failures.
@@ -6,12 +6,40 @@ Use `@joktec/utils` for common generators, validators, converters, hashing helpe
6
6
 
7
7
  Prefer package helpers over app-local reimplementation when behavior should stay consistent across services.
8
8
 
9
+ Source lookup:
10
+
11
+ - `packages/common/utils/README.md`
12
+ - `packages/common/utils/src/index.ts`
13
+ - `packages/common/utils/src/helpers/*`
14
+ - `packages/common/utils/src/validators/*`
15
+ - `packages/common/utils/src/constants/*`
16
+
17
+ Best practice:
18
+
19
+ - Use shared validators from `@joktec/utils` when building schema-first entity/schema decorators.
20
+ - Use shared generators for IDs, tokens, random values, and hashes when consistency matters.
21
+ - Keep utility usage deterministic in tests; mock time/randomness where needed.
22
+ - Do not add framework-level dependencies to `utils`.
23
+
9
24
  ## Cron
10
25
 
11
26
  Use `@joktec/cron` when a consumer app needs scheduled jobs, job worker contracts, or decorator-driven cron registration.
12
27
 
13
28
  Keep job business logic in the consumer app. The package provides scheduling abstractions, not domain behavior.
14
29
 
30
+ Source lookup:
31
+
32
+ - `packages/common/cron/README.md`
33
+ - `packages/common/cron/src/index.ts`
34
+ - cron decorators, models, scheduler services, and worker contracts under `src/`
35
+
36
+ Best practice:
37
+
38
+ - Keep job names, schedules, concurrency, and retry behavior visible in the consumer app.
39
+ - Make cron handlers idempotent.
40
+ - Avoid enabling the same cron owner in multiple processes unless the package/app has explicit locking semantics.
41
+ - Treat cron runtime as infrastructure orchestration; domain writes still belong in app services/repositories.
42
+
15
43
  ## Types
16
44
 
17
45
  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.
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: joktec-database-extended-skill
3
3
  description: Use when working with extended JokTec database packages @joktec/elastic, @joktec/arango, or @joktec/bigquery in a consumer app, including app-neutral client setup, config-driven lifecycle, and package-specific query/service usage.
4
+ metadata:
5
+ dependencies:
6
+ - joktec-framework-skill
7
+ - joktec-common-skill
4
8
  ---
5
9
 
6
10
  # JokTec Extended Database Skill
@@ -19,6 +23,7 @@ Use this skill for database clients that are not Mongo or MySQL.
19
23
  - Use package services for client lifecycle and connection config.
20
24
  - Do not claim parity with Mongo/MySQL repository behavior unless the package implements it.
21
25
  - Use package README and source as final truth before adding advanced behavior.
26
+ - If guidance is insufficient, read this skill's references and inspect `../joktec-framework` package source or GitHub fallback before assuming APIs.
22
27
 
23
28
  ## Reference
24
29
 
@@ -1,5 +1,15 @@
1
1
  # Extended Database Usage
2
2
 
3
+ ## Source Lookup
4
+
5
+ When blocked, inspect:
6
+
7
+ - `packages/databases/README.md`
8
+ - `packages/databases/AGENTS.md`
9
+ - `packages/databases/<package>/README.md`
10
+ - `packages/databases/<package>/src/index.ts`
11
+ - package config/module/service files under `src/`
12
+
3
13
  ## Package Boundaries
4
14
 
5
15
  Extended database packages expose reusable clients and helpers for specific data systems. They should not contain consumer app schemas or business-specific query policy.
@@ -9,3 +19,17 @@ Extended database packages expose reusable clients and helpers for specific data
9
19
  - Elastic may depend on `@joktec/http` for HTTP-backed behavior.
10
20
  - Arango and BigQuery are separate client packages; verify the README/source before assuming repository-like CRUD support.
11
21
  - Use local package tests or consumer harnesses only when the target service stack is available.
22
+
23
+ ## Best Practices
24
+
25
+ - Treat these packages as client wrappers unless source explicitly exposes a repository abstraction.
26
+ - Keep index names, dataset names, query templates, and domain-specific projections in the consumer app.
27
+ - Validate credentials and endpoints through config; never commit service account data.
28
+ - Keep retries, timeouts, and debug logging visible in config.
29
+ - Use provider-specific tests/mocks for package logic and live stack tests only when credentials/services are intentionally available.
30
+
31
+ ## Anti-Patterns
32
+
33
+ - Do not apply MongoRepo/MysqlRepo assumptions to Elastic/Arango/BigQuery.
34
+ - Do not introduce app schemas or business query policy into reusable database clients.
35
+ - Do not claim support for a provider feature unless the package source or README shows it.
@@ -25,6 +25,7 @@ Start here when a task mentions JokTec generally, multiple `@joktec/*` packages,
25
25
  - Prefer config-driven module setup and `conId` when a package supports multiple clients.
26
26
  - Preserve NestJS module boundaries, dependency injection, lifecycle hooks, and exported package APIs.
27
27
  - Do not invent behavior for unfinished or missing packages.
28
+ - If a focused skill is loaded without this entrypoint, still apply source-first lookup before assuming APIs.
28
29
 
29
30
  ## Reference
30
31
 
@@ -1,5 +1,24 @@
1
1
  # JokTec Framework Map
2
2
 
3
+ ## Source-First Operating Protocol
4
+
5
+ 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:
6
+
7
+ 1. Inspect the consumer project first to understand the package versions and local usage pattern.
8
+ 2. Prefer local framework source at `../joktec-framework` when available.
9
+ 3. Read package `README.md`, nearest `AGENTS.md`, and `src/index.ts` before changing code.
10
+ 4. If local source is unavailable, use `https://github.com/joktec/joktec-framework` as fallback.
11
+ 5. Do not invent behavior that is not visible in framework source or package docs.
12
+ 6. If package docs and source conflict, source code wins and the mismatch should be treated as documentation drift.
13
+
14
+ High-value source files:
15
+
16
+ - `AGENTS.md` and `docs/agents/*` for framework-level architecture and runtime policy.
17
+ - `packages/<family>/AGENTS.md` for family boundaries.
18
+ - `packages/<family>/<package>/README.md` for developer-facing usage.
19
+ - `packages/<family>/<package>/src/index.ts` for public API.
20
+ - Package config/module/service/repository files for real runtime behavior.
21
+
3
22
  ## Package Families
4
23
 
5
24
  - `@joktec/core`: bootstrap, config, logger, metrics, guards, base abstractions, transports, pagination, Bull.
@@ -17,9 +36,24 @@
17
36
 
18
37
  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.
19
38
 
39
+ Do not reverse the dependency direction:
40
+
41
+ - reusable packages must not import from `apps/`
42
+ - `common` packages must not depend on concrete adapters/brokers/databases
43
+ - consumer apps own business workflows, DTO composition, schemas/entities, queue names, topics, and provider credentials
44
+
20
45
  ## Common Consumer App Pattern
21
46
 
22
47
  1. Register package modules in the app module or repository module.
23
48
  2. Keep app schemas/entities and app repositories in the consumer app.
24
49
  3. Extend the package repository base class when the package provides one.
25
50
  4. Use `BaseService`, `BaseController`, or transport helpers from `@joktec/core` when the app follows standard CRUD or message patterns.
51
+
52
+ ## Skill Selection
53
+
54
+ - Use `joktec-common-skill` for BaseController/BaseService/config/pagination/client lifecycle/utils/cron.
55
+ - Use `joktec-mongo-skill` when the resource uses Mongo schemas, MongoRepo, Typegoose decorators, plugins, or ObjectId-safe queries.
56
+ - Use `joktec-mysql-skill` when the resource uses TypeORM entities, MysqlRepo, SQL dialect behavior, transactions, or schema-first column decorators.
57
+ - Use broker/adapter/integration/tool skills for provider wiring; keep business semantics in the consumer app.
58
+
59
+ 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.
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: joktec-integration-skill
3
3
  description: Use when wiring or using JokTec integration packages @joktec/firebase or @joktec/gpt, including validated config, SDK client lifecycle, app-neutral integration services, credentials handling, and consumer app composition.
4
+ metadata:
5
+ dependencies:
6
+ - joktec-framework-skill
7
+ - joktec-common-skill
4
8
  ---
5
9
 
6
10
  # JokTec Integration Skill
@@ -18,6 +22,7 @@ Use this skill for third-party integration packages.
18
22
  - Use package services instead of direct SDK initialization in app code.
19
23
  - Preserve app-neutral service behavior; consumer apps own domain workflows.
20
24
  - Verify current package README/source before relying on advanced provider features.
25
+ - If guidance is insufficient, read this skill's references and inspect `../joktec-framework` package source or GitHub fallback before assuming APIs.
21
26
 
22
27
  ## Reference
23
28
 
@@ -1,9 +1,38 @@
1
1
  # Integration Usage
2
2
 
3
+ ## Source Lookup
4
+
5
+ When blocked, inspect:
6
+
7
+ - `packages/integrations/README.md`
8
+ - `packages/integrations/AGENTS.md`
9
+ - `packages/integrations/<package>/README.md`
10
+ - `packages/integrations/<package>/src/index.ts`
11
+ - package config/module/service files under `src/`
12
+
3
13
  ## Firebase
4
14
 
5
15
  Use the integration module and service to initialize Firebase Admin clients from validated config. Keep credential files local or environment-provided.
6
16
 
17
+ Best practice:
18
+
19
+ - Keep service account JSON, private keys, and project credentials out of git.
20
+ - Prefer environment-specific config or ignored local credential files.
21
+ - Keep notification/user/storage/product semantics in the consumer app.
22
+ - Mock Firebase Admin SDK in package tests; use live credentials only in explicit integration environments.
23
+
7
24
  ## GPT
8
25
 
9
26
  Use the integration package for reusable GPT client setup. Keep prompt/business policy in the consumer app, not in the generic package.
27
+
28
+ Best practice:
29
+
30
+ - Keep prompts, model choice policy, tool schemas, and product safety rules in the consumer app.
31
+ - Keep API keys in secret management or environment config.
32
+ - Verify current package completeness before relying on advanced APIs; `@joktec/gpt` may lag behind provider SDK changes.
33
+
34
+ ## Anti-Patterns
35
+
36
+ - Do not commit real credential files.
37
+ - Do not encode product-specific prompts or notification logic into the reusable integration package.
38
+ - Do not assume provider SDK behavior without checking package source and provider docs when APIs are unstable.
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: joktec-mongo-skill
3
3
  description: Use when working with @joktec/mongo in a consumer app, including MongoModule setup, Typegoose schema decorators, MongoRepo, MongoService, MongoHelper, plugins, ObjectId/query safety, soft delete, strict references, and cursor pagination.
4
+ metadata:
5
+ dependencies:
6
+ - joktec-framework-skill
7
+ - joktec-common-skill
4
8
  ---
5
9
 
6
10
  # JokTec Mongo Skill
@@ -15,6 +19,7 @@ Use this skill for MongoDB-backed resources that rely on JokTec's Mongoose/Typeg
15
19
  - Preserve `conId` when the app has multiple Mongo connections.
16
20
  - Use schema-first decorators when a schema class should be reused as a DTO source.
17
21
  - Treat ObjectId casting and regex behavior as safety-sensitive.
22
+ - If guidance is insufficient, read this skill's references and inspect `../joktec-framework` package source or GitHub fallback before assuming APIs.
18
23
 
19
24
  ## References
20
25