@frontmcp/skills 0.0.1

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 (65) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +135 -0
  3. package/catalog/TEMPLATE.md +49 -0
  4. package/catalog/adapters/create-adapter/SKILL.md +127 -0
  5. package/catalog/adapters/official-adapters/SKILL.md +136 -0
  6. package/catalog/auth/configure-auth/SKILL.md +250 -0
  7. package/catalog/auth/configure-auth/references/auth-modes.md +77 -0
  8. package/catalog/auth/configure-session/SKILL.md +201 -0
  9. package/catalog/config/configure-elicitation/SKILL.md +136 -0
  10. package/catalog/config/configure-http/SKILL.md +167 -0
  11. package/catalog/config/configure-throttle/SKILL.md +189 -0
  12. package/catalog/config/configure-throttle/references/guard-config.md +68 -0
  13. package/catalog/config/configure-transport/SKILL.md +151 -0
  14. package/catalog/config/configure-transport/references/protocol-presets.md +57 -0
  15. package/catalog/deployment/build-for-browser/SKILL.md +95 -0
  16. package/catalog/deployment/build-for-cli/SKILL.md +100 -0
  17. package/catalog/deployment/build-for-sdk/SKILL.md +218 -0
  18. package/catalog/deployment/deploy-to-cloudflare/SKILL.md +192 -0
  19. package/catalog/deployment/deploy-to-lambda/SKILL.md +304 -0
  20. package/catalog/deployment/deploy-to-node/SKILL.md +229 -0
  21. package/catalog/deployment/deploy-to-node/references/Dockerfile.example +45 -0
  22. package/catalog/deployment/deploy-to-vercel/SKILL.md +196 -0
  23. package/catalog/deployment/deploy-to-vercel/references/vercel.json.example +60 -0
  24. package/catalog/development/create-agent/SKILL.md +563 -0
  25. package/catalog/development/create-agent/references/llm-config.md +46 -0
  26. package/catalog/development/create-job/SKILL.md +566 -0
  27. package/catalog/development/create-prompt/SKILL.md +400 -0
  28. package/catalog/development/create-provider/SKILL.md +233 -0
  29. package/catalog/development/create-resource/SKILL.md +437 -0
  30. package/catalog/development/create-skill/SKILL.md +526 -0
  31. package/catalog/development/create-skill-with-tools/SKILL.md +579 -0
  32. package/catalog/development/create-tool/SKILL.md +418 -0
  33. package/catalog/development/create-tool/references/output-schema-types.md +56 -0
  34. package/catalog/development/create-tool/references/tool-annotations.md +34 -0
  35. package/catalog/development/create-workflow/SKILL.md +709 -0
  36. package/catalog/development/decorators-guide/SKILL.md +598 -0
  37. package/catalog/plugins/create-plugin/SKILL.md +336 -0
  38. package/catalog/plugins/create-plugin-hooks/SKILL.md +282 -0
  39. package/catalog/plugins/official-plugins/SKILL.md +667 -0
  40. package/catalog/setup/frontmcp-skills-usage/SKILL.md +200 -0
  41. package/catalog/setup/multi-app-composition/SKILL.md +358 -0
  42. package/catalog/setup/nx-workflow/SKILL.md +357 -0
  43. package/catalog/setup/project-structure-nx/SKILL.md +186 -0
  44. package/catalog/setup/project-structure-standalone/SKILL.md +153 -0
  45. package/catalog/setup/setup-project/SKILL.md +493 -0
  46. package/catalog/setup/setup-redis/SKILL.md +385 -0
  47. package/catalog/setup/setup-sqlite/SKILL.md +359 -0
  48. package/catalog/skills-manifest.json +414 -0
  49. package/catalog/testing/setup-testing/SKILL.md +539 -0
  50. package/catalog/testing/setup-testing/references/test-auth.md +88 -0
  51. package/catalog/testing/setup-testing/references/test-browser-build.md +57 -0
  52. package/catalog/testing/setup-testing/references/test-cli-binary.md +48 -0
  53. package/catalog/testing/setup-testing/references/test-direct-client.md +62 -0
  54. package/catalog/testing/setup-testing/references/test-e2e-handler.md +51 -0
  55. package/catalog/testing/setup-testing/references/test-tool-unit.md +41 -0
  56. package/package.json +34 -0
  57. package/src/index.d.ts +3 -0
  58. package/src/index.js +16 -0
  59. package/src/index.js.map +1 -0
  60. package/src/loader.d.ts +46 -0
  61. package/src/loader.js +75 -0
  62. package/src/loader.js.map +1 -0
  63. package/src/manifest.d.ts +81 -0
  64. package/src/manifest.js +26 -0
  65. package/src/manifest.js.map +1 -0
@@ -0,0 +1,526 @@
1
+ ---
2
+ name: create-skill
3
+ description: Create instruction-only skills that guide AI through workflows without tool references. Use when building knowledge packages, coding guidelines, or workflow templates.
4
+ tags: [skill, instructions, knowledge, workflow, guide]
5
+ priority: 7
6
+ visibility: both
7
+ license: Apache-2.0
8
+ metadata:
9
+ docs: https://docs.agentfront.dev/frontmcp/servers/skills
10
+ ---
11
+
12
+ # Creating Instruction-Only Skills
13
+
14
+ Skills are knowledge and workflow packages that teach AI clients how to accomplish tasks. Unlike tools (which execute actions) or agents (which run autonomous LLM loops), a skill provides structured instructions that the AI follows on its own. An instruction-only skill contains no tool references -- it is purely a guide.
15
+
16
+ ## When to Use Instruction-Only Skills
17
+
18
+ Use instruction-only skills when the goal is to transfer knowledge, enforce conventions, or define a workflow that the AI should follow using its own reasoning. Examples include:
19
+
20
+ - Coding style guides and conventions
21
+ - Architecture decision records
22
+ - Onboarding checklists
23
+ - Deployment runbooks without automated steps
24
+ - Review criteria and quality gates
25
+
26
+ If the skill needs to reference specific MCP tools, see the `create-skill-with-tools` skill instead.
27
+
28
+ ## Class-Based Pattern
29
+
30
+ Create a class extending `SkillContext` and decorate it with `@Skill`. The decorator requires `name`, `description`, and `instructions`.
31
+
32
+ ### SkillMetadata Fields
33
+
34
+ | Field | Type | Required | Description |
35
+ | ------------------- | ----------------------------------------------- | -------- | ----------------------------------------------------------- |
36
+ | `name` | `string` | Yes | Unique skill name in kebab-case |
37
+ | `description` | `string` | Yes | Short description of what the skill teaches |
38
+ | `instructions` | `string \| { file: string } \| { url: string }` | Yes | The skill content -- see instruction sources below |
39
+ | `parameters` | `SkillParameter[]` | No | Customization parameters for the skill |
40
+ | `examples` | `SkillExample[]` | No | Usage scenarios and expected outcomes |
41
+ | `tags` | `string[]` | No | Categorization tags for discovery |
42
+ | `visibility` | `'mcp' \| 'http' \| 'both'` | No | Where the skill is discoverable (default: `'both'`) |
43
+ | `hideFromDiscovery` | `boolean` | No | Register but hide from listing endpoints (default: `false`) |
44
+
45
+ ### Basic Example
46
+
47
+ ```typescript
48
+ import { Skill, SkillContext } from '@frontmcp/sdk';
49
+
50
+ @Skill({
51
+ name: 'typescript-conventions',
52
+ description: 'TypeScript coding conventions and patterns for the project',
53
+ instructions: `# TypeScript Conventions
54
+
55
+ ## Naming
56
+ - Use PascalCase for classes and interfaces
57
+ - Use camelCase for variables, functions, and methods
58
+ - Use UPPER_SNAKE_CASE for constants
59
+ - Use kebab-case for file names
60
+
61
+ ## Types
62
+ - Always use explicit return types on public methods
63
+ - Prefer \`unknown\` over \`any\` for generic defaults
64
+ - Use strict mode (\`strict: true\` in tsconfig)
65
+ - Define shared types in a common directory
66
+
67
+ ## Error Handling
68
+ - Use specific error classes, not raw Error
69
+ - Never use non-null assertions (\`!\`) -- throw proper errors
70
+ - Use \`this.fail(err)\` in execution contexts
71
+
72
+ ## Imports
73
+ - Use barrel exports (index.ts) for public APIs
74
+ - No circular dependencies
75
+ - Group imports: external, internal, relative`,
76
+ })
77
+ class TypeScriptConventionsSkill extends SkillContext {}
78
+ ```
79
+
80
+ ### Available Context Methods
81
+
82
+ `SkillContext` provides:
83
+
84
+ - `loadInstructions(): Promise<string>` -- load and return the resolved instruction content (resolves file or URL references)
85
+ - `build(): Promise<SkillContent>` -- build the full skill content object (instructions + metadata)
86
+
87
+ ## Instruction Sources
88
+
89
+ Skills support three ways to provide instructions. All three are set via the `instructions` field in `@Skill` metadata.
90
+
91
+ ### Inline String
92
+
93
+ Provide instructions directly as a string. Best for short, self-contained guides.
94
+
95
+ ```typescript
96
+ @Skill({
97
+ name: 'git-commit-guide',
98
+ description: 'Guidelines for writing commit messages',
99
+ instructions: `# Commit Message Format
100
+
101
+ Use conventional commits: type(scope): description
102
+
103
+ Types: feat, fix, refactor, test, docs, chore
104
+ Scope: the module or area affected
105
+ Description: imperative mood, lowercase, no period
106
+
107
+ Example: feat(auth): add OAuth2 token refresh`,
108
+ })
109
+ class GitCommitGuideSkill extends SkillContext {}
110
+ ```
111
+
112
+ ### File Reference
113
+
114
+ Load instructions from a Markdown file. The path is relative to the skill file location.
115
+
116
+ ```typescript
117
+ @Skill({
118
+ name: 'architecture-guide',
119
+ description: 'System architecture overview and patterns',
120
+ instructions: { file: './docs/architecture.md' },
121
+ })
122
+ class ArchitectureGuideSkill extends SkillContext {}
123
+ ```
124
+
125
+ ### URL Reference
126
+
127
+ Load instructions from a remote URL. Fetched at build time when the skill is loaded.
128
+
129
+ ```typescript
130
+ @Skill({
131
+ name: 'api-standards',
132
+ description: 'REST API design standards',
133
+ instructions: { url: 'https://docs.example.com/standards/api-design.md' },
134
+ })
135
+ class ApiStandardsSkill extends SkillContext {}
136
+ ```
137
+
138
+ ## SkillContext: loadInstructions() and build()
139
+
140
+ The `SkillContext` class resolves instructions regardless of the source type. When the framework serves a skill, it calls `build()` which internally calls `loadInstructions()`.
141
+
142
+ ```typescript
143
+ @Skill({
144
+ name: 'onboarding',
145
+ description: 'Developer onboarding checklist',
146
+ instructions: { file: './onboarding-checklist.md' },
147
+ })
148
+ class OnboardingSkill extends SkillContext {
149
+ // You can override build() to add custom logic
150
+ async build(): Promise<SkillContent> {
151
+ const content = await super.build();
152
+ // Add dynamic content if needed
153
+ return content;
154
+ }
155
+ }
156
+ ```
157
+
158
+ The `build()` method returns a `SkillContent` object:
159
+
160
+ ```typescript
161
+ interface SkillContent {
162
+ id: string; // unique identifier (derived from name if not provided)
163
+ name: string;
164
+ description: string;
165
+ instructions: string; // resolved instruction text
166
+ tools: Array<{ name: string; purpose?: string; required?: boolean }>;
167
+ parameters?: SkillParameter[];
168
+ examples?: Array<{ scenario: string; parameters?: Record<string, unknown>; expectedOutcome?: string }>;
169
+ license?: string;
170
+ compatibility?: string;
171
+ specMetadata?: Record<string, string>;
172
+ allowedTools?: string; // space-delimited pre-approved tools
173
+ resources?: SkillResources; // bundled scripts/, references/, assets/
174
+ }
175
+ ```
176
+
177
+ ## Function Builder
178
+
179
+ For skills that do not need a class, use the `skill()` function builder. Instruction-only skills have no execute function -- they are purely declarative.
180
+
181
+ ```typescript
182
+ import { skill } from '@frontmcp/sdk';
183
+
184
+ const CodeReviewChecklist = skill({
185
+ name: 'code-review-checklist',
186
+ description: 'Checklist for reviewing pull requests',
187
+ instructions: `# Code Review Checklist
188
+
189
+ ## Correctness
190
+ - Does the code do what it claims?
191
+ - Are edge cases handled?
192
+ - Are error paths covered?
193
+
194
+ ## Style
195
+ - Does it follow project conventions?
196
+ - Are names descriptive and consistent?
197
+ - Is the code self-documenting?
198
+
199
+ ## Testing
200
+ - Are there tests for new functionality?
201
+ - Do tests cover edge cases?
202
+ - Is coverage above 95%?
203
+
204
+ ## Security
205
+ - No secrets in code or config?
206
+ - Input validation present?
207
+ - Proper error handling without leaking internals?`,
208
+ visibility: 'both',
209
+ });
210
+ ```
211
+
212
+ Register it the same way as a class skill: `skills: [CodeReviewChecklist]`.
213
+
214
+ ## Directory-Based Skills with skillDir()
215
+
216
+ Use `skillDir()` to load a skill from a directory containing a `SKILL.md` file with YAML frontmatter, plus optional subdirectories for scripts, references, and assets.
217
+
218
+ ### Directory Structure
219
+
220
+ ```
221
+ skills/
222
+ coding-standards/
223
+ SKILL.md # Instructions with YAML frontmatter
224
+ scripts/
225
+ lint-check.sh # Helper scripts referenced in instructions
226
+ references/
227
+ patterns.md # Reference documentation appended to context
228
+ assets/
229
+ diagram.png # Visual assets
230
+ ```
231
+
232
+ ### Loading a Skill Directory
233
+
234
+ ```typescript
235
+ import { skillDir } from '@frontmcp/sdk';
236
+
237
+ const CodingStandards = await skillDir('./skills/coding-standards');
238
+ ```
239
+
240
+ The `SKILL.md` file uses YAML frontmatter for metadata, followed by the instructions body:
241
+
242
+ ```markdown
243
+ ---
244
+ name: coding-standards
245
+ description: Project coding standards and patterns
246
+ tags: [standards, conventions, quality]
247
+ parameters:
248
+ - name: language
249
+ description: Target programming language
250
+ type: string
251
+ default: typescript
252
+ examples:
253
+ - scenario: Apply coding standards to a new module
254
+ expected-outcome: Code follows all project conventions
255
+ ---
256
+
257
+ # Coding Standards
258
+
259
+ Follow these standards when writing code for this project...
260
+ ```
261
+
262
+ Files in `scripts/`, `references/`, and `assets/` are automatically bundled with the skill and available in the skill content.
263
+
264
+ ## Parameters
265
+
266
+ Parameters let callers customize skill behavior. They appear in the skill metadata and can influence how the AI applies the instructions.
267
+
268
+ ```typescript
269
+ @Skill({
270
+ name: 'api-design-guide',
271
+ description: 'REST API design guidelines',
272
+ instructions: `# API Design Guide
273
+
274
+ Design APIs following these conventions.
275
+ Adapt the versioning strategy based on the api-style parameter.
276
+ Use the auth-required parameter to determine if authentication sections apply.`,
277
+ parameters: [
278
+ { name: 'api-style', description: 'API style to follow', type: 'string', default: 'rest' },
279
+ { name: 'auth-required', description: 'Whether to include auth guidelines', type: 'boolean', default: true },
280
+ { name: 'version-strategy', description: 'API versioning approach', type: 'string', default: 'url-path' },
281
+ ],
282
+ })
283
+ class ApiDesignGuideSkill extends SkillContext {}
284
+ ```
285
+
286
+ ## Examples for AI Guidance
287
+
288
+ Examples show the AI how the skill should be applied and what outcomes to expect:
289
+
290
+ ```typescript
291
+ @Skill({
292
+ name: 'error-handling-guide',
293
+ description: 'Error handling patterns and best practices',
294
+ instructions: '...',
295
+ examples: [
296
+ {
297
+ scenario: 'Adding error handling to a new API endpoint',
298
+ expectedOutcome:
299
+ 'Endpoint uses specific error classes with MCP error codes, validates input, and returns structured error responses',
300
+ },
301
+ {
302
+ scenario: 'Refactoring try-catch blocks in existing code',
303
+ expectedOutcome: 'Generic catches replaced with specific error types, proper error propagation chain established',
304
+ },
305
+ ],
306
+ })
307
+ class ErrorHandlingGuideSkill extends SkillContext {}
308
+ ```
309
+
310
+ ## Visibility
311
+
312
+ Control where the skill is discoverable using the `visibility` field.
313
+
314
+ | Value | Description |
315
+ | -------- | ------------------------------------------------------- |
316
+ | `'mcp'` | Visible only via MCP protocol (tool listing) |
317
+ | `'http'` | Visible only via HTTP endpoints (`/llm.txt`, `/skills`) |
318
+ | `'both'` | Visible via both MCP and HTTP (default) |
319
+
320
+ ```typescript
321
+ @Skill({
322
+ name: 'internal-runbook',
323
+ description: 'Internal operations runbook',
324
+ instructions: '...',
325
+ visibility: 'mcp', // Only visible to MCP clients, not HTTP discovery
326
+ })
327
+ class InternalRunbookSkill extends SkillContext {}
328
+ ```
329
+
330
+ ### Hiding from Discovery
331
+
332
+ Use `hideFromDiscovery: true` to register a skill that exists but is not listed in any discovery endpoint. It can still be invoked directly by name.
333
+
334
+ ```typescript
335
+ @Skill({
336
+ name: 'admin-procedures',
337
+ description: 'Administrative procedures for internal use',
338
+ instructions: '...',
339
+ hideFromDiscovery: true,
340
+ })
341
+ class AdminProceduresSkill extends SkillContext {}
342
+ ```
343
+
344
+ ## Registration
345
+
346
+ Add skill classes (or function-style skills) to the `skills` array in `@FrontMcp` or `@App`.
347
+
348
+ ```typescript
349
+ import { FrontMcp, App } from '@frontmcp/sdk';
350
+
351
+ @App({
352
+ name: 'standards-app',
353
+ skills: [TypeScriptConventionsSkill, CodeReviewChecklist, CodingStandards],
354
+ })
355
+ class StandardsApp {}
356
+
357
+ @FrontMcp({
358
+ info: { name: 'my-server', version: '1.0.0' },
359
+ apps: [StandardsApp],
360
+ skills: [ApiDesignGuideSkill], // can also register skills directly on the server
361
+ })
362
+ class MyServer {}
363
+ ```
364
+
365
+ ## HTTP Discovery
366
+
367
+ When skills have `visibility` set to `'http'` or `'both'`, they are discoverable via HTTP endpoints.
368
+
369
+ ### /llm.txt
370
+
371
+ Returns a plain-text document listing all HTTP-visible skills with their descriptions and instructions.
372
+
373
+ ```
374
+ GET /llm.txt
375
+
376
+ # Skills
377
+
378
+ ## typescript-conventions
379
+ TypeScript coding conventions and patterns for the project
380
+ ...
381
+ ```
382
+
383
+ ### /skills
384
+
385
+ Returns a JSON array of all HTTP-visible skills with full metadata.
386
+
387
+ ```
388
+ GET /skills
389
+
390
+ [
391
+ {
392
+ "name": "typescript-conventions",
393
+ "description": "TypeScript coding conventions and patterns for the project",
394
+ "instructions": "...",
395
+ "parameters": [],
396
+ "tags": [],
397
+ "visibility": "both"
398
+ }
399
+ ]
400
+ ```
401
+
402
+ ## Remote and ESM Loading
403
+
404
+ Load skills from external modules or remote URLs without importing them directly.
405
+
406
+ **ESM loading** -- load a skill from an ES module:
407
+
408
+ ```typescript
409
+ const ExternalGuide = Skill.esm('@my-org/skills@^1.0.0', 'ExternalGuide', {
410
+ description: 'A skill loaded from an ES module',
411
+ });
412
+ ```
413
+
414
+ **Remote loading** -- load a skill from a remote URL:
415
+
416
+ ```typescript
417
+ const CloudGuide = Skill.remote('https://example.com/skills/style-guide', 'CloudGuide', {
418
+ description: 'A skill loaded from a remote server',
419
+ });
420
+ ```
421
+
422
+ Both return values that can be registered in `skills: [ExternalGuide, CloudGuide]`.
423
+
424
+ ## Nx Generators
425
+
426
+ Scaffold a new skill using the Nx generators:
427
+
428
+ ```bash
429
+ # Create a skill class file
430
+ nx generate @frontmcp/nx:skill
431
+
432
+ # Create a directory-based skill with SKILL.md, scripts/, references/, assets/
433
+ nx generate @frontmcp/nx:skill-dir
434
+ ```
435
+
436
+ The class generator creates the skill file, spec file, and updates barrel exports. The directory generator creates the full directory structure ready for `skillDir()`.
437
+
438
+ ## Complete Example: Project Onboarding Skill
439
+
440
+ ```typescript
441
+ import { Skill, SkillContext, FrontMcp, App, skill, skillDir } from '@frontmcp/sdk';
442
+
443
+ // Class-based instruction-only skill
444
+ @Skill({
445
+ name: 'project-onboarding',
446
+ description: 'Step-by-step guide for onboarding new developers to the project',
447
+ instructions: `# Project Onboarding
448
+
449
+ ## Step 1: Environment Setup
450
+ 1. Clone the repository
451
+ 2. Install Node.js 22+ and Yarn
452
+ 3. Run \`yarn install\` to install dependencies
453
+ 4. Copy \`.env.example\` to \`.env\` and fill in values
454
+
455
+ ## Step 2: Understand the Architecture
456
+ - This is an Nx monorepo with libraries in \`/libs/*\`
457
+ - Each library is independently publishable under \`@frontmcp/*\`
458
+ - The SDK is the core package; other packages build on it
459
+
460
+ ## Step 3: Run Tests
461
+ - Run \`nx run-many -t test\` to verify everything works
462
+ - Coverage must be 95%+ across all metrics
463
+ - All test files use \`.spec.ts\` extension
464
+
465
+ ## Step 4: Development Workflow
466
+ - Create a feature branch from \`main\`
467
+ - Follow conventional commit format
468
+ - Run \`node scripts/fix-unused-imports.mjs\` before committing
469
+ - Ensure all tests pass and no TypeScript warnings exist
470
+
471
+ ## Step 5: Code Standards
472
+ - Use strict TypeScript with no \`any\` types
473
+ - Use \`unknown\` for generic defaults
474
+ - Use specific MCP error classes
475
+ - Follow the patterns in CLAUDE.md`,
476
+ parameters: [
477
+ { name: 'team', description: 'Team the developer is joining', type: 'string', required: false },
478
+ {
479
+ name: 'focus-area',
480
+ description: 'Primary area of focus (sdk, cli, adapters, plugins)',
481
+ type: 'string',
482
+ default: 'sdk',
483
+ },
484
+ ],
485
+ examples: [
486
+ {
487
+ scenario: 'Onboard a new developer to the SDK team',
488
+ expectedOutcome: 'Developer has environment set up, understands architecture, and can run tests',
489
+ },
490
+ ],
491
+ tags: ['onboarding', 'setup', 'guide'],
492
+ visibility: 'both',
493
+ })
494
+ class ProjectOnboardingSkill extends SkillContext {}
495
+
496
+ // Function-style instruction-only skill
497
+ const SecurityChecklist = skill({
498
+ name: 'security-checklist',
499
+ description: 'Security review checklist for code changes',
500
+ instructions: `# Security Checklist
501
+
502
+ - No secrets or credentials in source code
503
+ - Use @frontmcp/utils for all crypto operations
504
+ - Validate all external input with Zod schemas
505
+ - Use specific error classes that do not leak internals
506
+ - Check for SQL injection in any raw queries
507
+ - Verify CORS configuration for HTTP endpoints
508
+ - Ensure authentication is enforced on protected routes`,
509
+ visibility: 'mcp',
510
+ });
511
+
512
+ // Directory-based instruction-only skill
513
+ const ArchitectureGuide = await skillDir('./skills/architecture-guide');
514
+
515
+ @App({
516
+ name: 'onboarding-app',
517
+ skills: [ProjectOnboardingSkill, SecurityChecklist, ArchitectureGuide],
518
+ })
519
+ class OnboardingApp {}
520
+
521
+ @FrontMcp({
522
+ info: { name: 'dev-server', version: '1.0.0' },
523
+ apps: [OnboardingApp],
524
+ })
525
+ class DevServer {}
526
+ ```