@frontmcp/skills 0.0.1 → 1.0.0-beta.10

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 +2 -2
  2. package/catalog/TEMPLATE.md +58 -13
  3. package/catalog/frontmcp-config/SKILL.md +143 -0
  4. package/catalog/frontmcp-config/references/configure-auth.md +238 -0
  5. package/catalog/frontmcp-config/references/configure-elicitation.md +178 -0
  6. package/catalog/frontmcp-config/references/configure-http.md +205 -0
  7. package/catalog/frontmcp-config/references/configure-session.md +205 -0
  8. package/catalog/frontmcp-config/references/configure-throttle.md +229 -0
  9. package/catalog/frontmcp-config/references/configure-transport.md +195 -0
  10. package/catalog/frontmcp-config/references/setup-redis.md +4 -0
  11. package/catalog/frontmcp-config/references/setup-sqlite.md +4 -0
  12. package/catalog/frontmcp-deployment/SKILL.md +127 -0
  13. package/catalog/frontmcp-deployment/references/build-for-browser.md +138 -0
  14. package/catalog/frontmcp-deployment/references/build-for-cli.md +138 -0
  15. package/catalog/{deployment/build-for-sdk/SKILL.md → frontmcp-deployment/references/build-for-sdk.md} +65 -24
  16. package/catalog/frontmcp-deployment/references/deploy-to-cloudflare.md +213 -0
  17. package/catalog/{deployment/deploy-to-lambda/SKILL.md → frontmcp-deployment/references/deploy-to-lambda.md} +76 -63
  18. package/catalog/{deployment/deploy-to-node/references/Dockerfile.example → frontmcp-deployment/references/deploy-to-node-dockerfile.md} +13 -4
  19. package/catalog/{deployment/deploy-to-node/SKILL.md → frontmcp-deployment/references/deploy-to-node.md} +68 -40
  20. package/catalog/frontmcp-deployment/references/deploy-to-vercel-config.md +60 -0
  21. package/catalog/frontmcp-deployment/references/deploy-to-vercel.md +224 -0
  22. package/catalog/frontmcp-development/SKILL.md +121 -0
  23. package/catalog/frontmcp-development/references/create-adapter.md +165 -0
  24. package/catalog/{development/create-agent/references/llm-config.md → frontmcp-development/references/create-agent-llm-config.md} +5 -5
  25. package/catalog/{development/create-agent/SKILL.md → frontmcp-development/references/create-agent.md} +82 -44
  26. package/catalog/{development/create-job/SKILL.md → frontmcp-development/references/create-job.md} +61 -19
  27. package/catalog/{plugins/create-plugin-hooks/SKILL.md → frontmcp-development/references/create-plugin-hooks.md} +63 -11
  28. package/catalog/{plugins/create-plugin/SKILL.md → frontmcp-development/references/create-plugin.md} +65 -60
  29. package/catalog/{development/create-prompt/SKILL.md → frontmcp-development/references/create-prompt.md} +62 -26
  30. package/catalog/{development/create-provider/SKILL.md → frontmcp-development/references/create-provider.md} +62 -27
  31. package/catalog/{development/create-resource/SKILL.md → frontmcp-development/references/create-resource.md} +62 -30
  32. package/catalog/{development/create-skill-with-tools/SKILL.md → frontmcp-development/references/create-skill-with-tools.md} +69 -24
  33. package/catalog/{development/create-skill/SKILL.md → frontmcp-development/references/create-skill.md} +96 -22
  34. package/catalog/{development/create-tool/SKILL.md → frontmcp-development/references/create-tool.md} +62 -26
  35. package/catalog/{development/create-workflow/SKILL.md → frontmcp-development/references/create-workflow.md} +60 -18
  36. package/catalog/{development/decorators-guide/SKILL.md → frontmcp-development/references/decorators-guide.md} +123 -34
  37. package/catalog/frontmcp-development/references/official-adapters.md +194 -0
  38. package/catalog/{plugins/official-plugins/SKILL.md → frontmcp-development/references/official-plugins.md} +96 -31
  39. package/catalog/frontmcp-guides/SKILL.md +420 -0
  40. package/catalog/frontmcp-guides/references/example-knowledge-base.md +636 -0
  41. package/catalog/frontmcp-guides/references/example-task-manager.md +512 -0
  42. package/catalog/frontmcp-guides/references/example-weather-api.md +292 -0
  43. package/catalog/frontmcp-production-readiness/SKILL.md +253 -0
  44. package/catalog/frontmcp-setup/SKILL.md +130 -0
  45. package/catalog/frontmcp-setup/references/frontmcp-skills-usage.md +265 -0
  46. package/catalog/{setup/multi-app-composition/SKILL.md → frontmcp-setup/references/multi-app-composition.md} +65 -23
  47. package/catalog/{setup/nx-workflow/SKILL.md → frontmcp-setup/references/nx-workflow.md} +78 -21
  48. package/catalog/frontmcp-setup/references/project-structure-nx.md +246 -0
  49. package/catalog/frontmcp-setup/references/project-structure-standalone.md +212 -0
  50. package/catalog/{setup/setup-project/SKILL.md → frontmcp-setup/references/setup-project.md} +62 -62
  51. package/catalog/{setup/setup-redis/SKILL.md → frontmcp-setup/references/setup-redis.md} +59 -86
  52. package/catalog/{setup/setup-sqlite/SKILL.md → frontmcp-setup/references/setup-sqlite.md} +64 -76
  53. package/catalog/frontmcp-testing/SKILL.md +127 -0
  54. package/catalog/{testing/setup-testing/SKILL.md → frontmcp-testing/references/setup-testing.md} +78 -67
  55. package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-tool-unit.md +1 -0
  56. package/catalog/skills-manifest.json +39 -378
  57. package/package.json +2 -2
  58. package/src/loader.js +0 -1
  59. package/src/loader.js.map +1 -1
  60. package/src/manifest.d.ts +3 -3
  61. package/src/manifest.js +2 -3
  62. package/src/manifest.js.map +1 -1
  63. package/catalog/adapters/create-adapter/SKILL.md +0 -127
  64. package/catalog/adapters/official-adapters/SKILL.md +0 -136
  65. package/catalog/auth/configure-auth/SKILL.md +0 -250
  66. package/catalog/auth/configure-session/SKILL.md +0 -201
  67. package/catalog/config/configure-elicitation/SKILL.md +0 -136
  68. package/catalog/config/configure-http/SKILL.md +0 -167
  69. package/catalog/config/configure-throttle/SKILL.md +0 -189
  70. package/catalog/config/configure-transport/SKILL.md +0 -151
  71. package/catalog/deployment/build-for-browser/SKILL.md +0 -95
  72. package/catalog/deployment/build-for-cli/SKILL.md +0 -100
  73. package/catalog/deployment/deploy-to-cloudflare/SKILL.md +0 -192
  74. package/catalog/deployment/deploy-to-vercel/SKILL.md +0 -196
  75. package/catalog/deployment/deploy-to-vercel/references/vercel.json.example +0 -60
  76. package/catalog/setup/frontmcp-skills-usage/SKILL.md +0 -200
  77. package/catalog/setup/project-structure-nx/SKILL.md +0 -186
  78. package/catalog/setup/project-structure-standalone/SKILL.md +0 -153
  79. /package/catalog/{auth/configure-auth/references/auth-modes.md → frontmcp-config/references/configure-auth-modes.md} +0 -0
  80. /package/catalog/{config/configure-throttle/references/guard-config.md → frontmcp-config/references/configure-throttle-guard-config.md} +0 -0
  81. /package/catalog/{config/configure-transport/references/protocol-presets.md → frontmcp-config/references/configure-transport-protocol-presets.md} +0 -0
  82. /package/catalog/{development/create-tool/references/tool-annotations.md → frontmcp-development/references/create-tool-annotations.md} +0 -0
  83. /package/catalog/{development/create-tool/references/output-schema-types.md → frontmcp-development/references/create-tool-output-schema-types.md} +0 -0
  84. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-auth.md +0 -0
  85. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-browser-build.md +0 -0
  86. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-cli-binary.md +0 -0
  87. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-direct-client.md +0 -0
  88. /package/catalog/{testing/setup-testing → frontmcp-testing}/references/test-e2e-handler.md +0 -0
@@ -1,54 +1,29 @@
1
- ---
2
- name: create-plugin
3
- description: Build a FrontMCP plugin with lifecycle hooks and context extensions. Use when creating custom plugins, extending tool context, or adding cross-cutting concerns.
4
- tags:
5
- - plugins
6
- - extensibility
7
- - hooks
8
- - context
9
- bundle:
10
- - full
11
- visibility: both
12
- priority: 5
13
- parameters:
14
- - name: plugin-name
15
- description: Name for the new plugin (kebab-case)
16
- type: string
17
- required: true
18
- - name: with-context-extension
19
- description: Whether the plugin adds properties to ExecutionContextBase
20
- type: boolean
21
- required: false
22
- default: false
23
- - name: with-dynamic-options
24
- description: Whether the plugin accepts runtime configuration options
25
- type: boolean
26
- required: false
27
- default: false
28
- examples:
29
- - scenario: Create a simple logging plugin with no context extensions
30
- parameters:
31
- plugin-name: audit-log
32
- with-context-extension: false
33
- expected-outcome: A plugin that hooks into tool execution to log audit events
34
- - scenario: Create an advanced plugin that extends ToolContext with a new property
35
- parameters:
36
- plugin-name: feature-flags
37
- with-context-extension: true
38
- with-dynamic-options: true
39
- expected-outcome: A configurable plugin that adds this.featureFlags to all tool contexts
40
- license: MIT
41
- compatibility: Requires Node.js 18+ and @frontmcp/sdk
42
- metadata:
43
- category: plugins
44
- difficulty: advanced
45
- docs: https://docs.agentfront.dev/frontmcp/plugins/creating-plugins
46
- ---
47
-
48
1
  # Create a FrontMCP Plugin
49
2
 
50
3
  This skill covers building custom plugins for FrontMCP and using all 6 official plugins. Plugins are modular units that extend server behavior through providers, context extensions, lifecycle hooks, and contributed tools/resources/prompts.
51
4
 
5
+ ## When to Use This Skill
6
+
7
+ ### Must Use
8
+
9
+ - Adding cross-cutting behavior (logging, caching, auth) that applies across multiple tools
10
+ - Extending `ExecutionContextBase` with new properties accessible via `this.propertyName` in tools
11
+ - Contributing injectable providers that tools or other plugins depend on
12
+
13
+ ### Recommended
14
+
15
+ - Building a configurable module with runtime options using the `DynamicPlugin` pattern
16
+ - Extending the `@Tool` decorator metadata with custom fields (e.g., audit, approval)
17
+ - Composing multiple related providers, hooks, and tools into a single installable unit
18
+
19
+ ### Skip When
20
+
21
+ - You only need lifecycle hooks without providers or context extensions (see `create-plugin-hooks`)
22
+ - You want to use an existing official plugin (see `official-plugins`)
23
+ - You need to generate tools from an external API spec (see `create-adapter`)
24
+
25
+ > **Decision:** Use this skill when you need a reusable module that bundles providers, context extensions, or contributed entries and registers them via `@Plugin`.
26
+
52
27
  ## Plugin Decorator Signature
53
28
 
54
29
  ```typescript
@@ -118,7 +93,7 @@ Register it in your server:
118
93
  import { FrontMcp, App } from '@frontmcp/sdk';
119
94
  import AuditLogPlugin from './plugins/audit-log.plugin';
120
95
 
121
- @App()
96
+ @App({ name: 'MyApp' })
122
97
  class MyApp {}
123
98
 
124
99
  @FrontMcp({
@@ -318,19 +293,49 @@ class DeleteUserTool extends ToolContext {
318
293
 
319
294
  For official plugin installation, configuration, and examples, see the **official-plugins** skill. FrontMCP provides 6 official plugins: CodeCall, Remember, Approval, Cache, Feature Flags, and Dashboard. Install individually or via `@frontmcp/plugins` (meta-package).
320
295
 
321
- ## Common Mistakes
296
+ ## Common Patterns
297
+
298
+ | Pattern | Correct | Incorrect | Why |
299
+ | ------------------------------ | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
300
+ | Context extension registration | `contextExtensions: [{ property: 'auditLog', token: AuditLoggerToken }]` in metadata | `Object.defineProperty(ExecutionContextBase.prototype, ...)` manually | SDK handles runtime installation; manual modification causes ordering issues |
301
+ | Type augmentation | `declare module '@frontmcp/sdk' { interface ExecutionContextBase { ... } }` in a separate file | Skipping the augmentation and casting `this` in tools | Without augmentation, TypeScript cannot type-check `this.auditLog` |
302
+ | Provider types | `Token<AuditLogger> = Symbol('AuditLogger')` with typed token | `provide: Symbol('AuditLogger')` without type annotation | Typed tokens enable compile-time DI resolution checking |
303
+ | Plugin scope | `scope: 'app'` (default) for app-scoped behavior | `scope: 'server'` when hooks should only apply to one app | Server scope fires hooks for all apps in a gateway; default to app |
304
+ | Dynamic options | Extend `DynamicPlugin<TOptions, TInput>` with `static dynamicProviders()` | Constructing providers in the constructor body | `dynamicProviders` runs before instantiation, enabling proper DI wiring |
305
+
306
+ ## Verification Checklist
307
+
308
+ ### Configuration
309
+
310
+ - [ ] `@Plugin` decorator has `name` and `description`
311
+ - [ ] Providers are listed in `providers` array with typed tokens
312
+ - [ ] Exported providers are listed in `exports` array
313
+ - [ ] Context extensions have `property`, `token`, and `errorMessage` fields
314
+
315
+ ### Type Safety
316
+
317
+ - [ ] Module augmentation file exists with `declare module '@frontmcp/sdk'` block
318
+ - [ ] Augmented properties are `readonly` on `ExecutionContextBase`
319
+ - [ ] Augmentation file is imported (side-effect import) in the plugin module
320
+
321
+ ### Runtime
322
+
323
+ - [ ] Plugin is registered in `plugins` array of `@FrontMcp` or `@App`
324
+ - [ ] `this.propertyName` resolves correctly in tool contexts
325
+ - [ ] Missing plugin produces a clear error message (from `errorMessage`)
326
+ - [ ] Dynamic plugin options are validated in `dynamicProviders()`
327
+
328
+ ## Troubleshooting
322
329
 
323
- - **Module-level side effects for context extension** -- do not call `installExtension()` at the top level of a module. This causes circular dependencies. The SDK handles installation via `contextExtensions` metadata.
324
- - **Forgetting the type augmentation** -- without `declare module '@frontmcp/sdk'`, TypeScript will not recognize `this.auditLog` in tools.
325
- - **Using `any` types in providers** -- use `unknown` for generic defaults.
326
- - **Scope confusion** -- `scope: 'server'` makes hooks fire for all apps in a gateway. Default to `scope: 'app'`.
327
- - **Direct prototype modification** -- use the `contextExtensions` metadata array instead of directly modifying `ExecutionContextBase.prototype`.
330
+ | Problem | Cause | Solution |
331
+ | ------------------------------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------- |
332
+ | `this.auditLog` has type `any` or is unrecognized | Module augmentation file not imported | Add side-effect import: `import './audit-log.context-extension'` in plugin file |
333
+ | Circular dependency error at startup | Calling `installExtension()` at module top level | Remove manual installation; use `contextExtensions` metadata array instead |
334
+ | Provider not found in tool context | Provider not listed in plugin `exports` | Add the provider to both `providers` and `exports` arrays |
335
+ | Hooks fire for unrelated apps in gateway | Plugin `scope` set to `'server'` | Change to `scope: 'app'` (default) unless server-wide behavior is intended |
336
+ | `DynamicPlugin.init()` options ignored | Overriding constructor without calling `super()` | Ensure constructor calls `super()` and merges defaults properly |
328
337
 
329
338
  ## Reference
330
339
 
331
- - Plugin system docs: [docs.agentfront.dev/frontmcp/plugins/creating-plugins](https://docs.agentfront.dev/frontmcp/plugins/creating-plugins)
332
- - `@Plugin` decorator: import from `@frontmcp/sdk` — [source](https://github.com/agentfront/frontmcp/tree/main/libs/sdk/src/common/decorators/plugin.decorator.ts)
333
- - `DynamicPlugin` base class: import from `@frontmcp/sdk` — [source](https://github.com/agentfront/frontmcp/tree/main/libs/sdk/src/common/dynamic/dynamic.plugin.ts)
334
- - `PluginMetadata` interface (contextExtensions): import from `@frontmcp/sdk` — [source](https://github.com/agentfront/frontmcp/tree/main/libs/sdk/src/common/metadata/plugin.metadata.ts)
335
- - Official plugins: `@frontmcp/plugin-cache`, `@frontmcp/plugin-codecall`, `@frontmcp/plugin-remember`, `@frontmcp/plugin-approval`, `@frontmcp/plugin-feature-flags`, `@frontmcp/plugin-dashboard`
336
- - Meta-package: `@frontmcp/plugins` (re-exports cache, codecall, dashboard, remember)
340
+ - [Plugin System Documentation](https://docs.agentfront.dev/frontmcp/plugins/creating-plugins)
341
+ - Related skills: `create-plugin-hooks`, `official-plugins`, `create-adapter`, `create-provider`
@@ -1,34 +1,28 @@
1
- ---
2
- name: create-prompt
3
- description: Create MCP prompts for reusable AI interaction patterns. Use when building prompts, defining prompt arguments, or creating conversation templates.
4
- tags: [prompts, mcp, templates, messages, decorator]
5
- tools:
6
- - name: create_prompt
7
- purpose: Scaffold a new prompt class
8
- parameters:
9
- - name: name
10
- description: Prompt name in kebab-case
11
- type: string
12
- required: true
13
- examples:
14
- - scenario: Create a code review prompt with language argument
15
- expected-outcome: Prompt registered and callable via MCP
16
- - scenario: Create a multi-turn debugging prompt with assistant priming
17
- expected-outcome: Prompt producing structured message sequences
18
- priority: 10
19
- visibility: both
20
- license: Apache-2.0
21
- metadata:
22
- docs: https://docs.agentfront.dev/frontmcp/servers/prompts
23
- ---
24
-
25
1
  # Creating MCP Prompts
26
2
 
27
3
  Prompts define reusable AI interaction patterns in the MCP protocol. They produce structured message sequences that clients use to guide LLM conversations. In FrontMCP, prompts are classes extending `PromptContext`, decorated with `@Prompt`, that return `GetPromptResult` objects.
28
4
 
29
- ## When to Use @Prompt
5
+ ## When to Use This Skill
6
+
7
+ ### Must Use
8
+
9
+ - Building a reusable conversation template that AI clients invoke with arguments
10
+ - Defining structured multi-turn message sequences (user/assistant patterns)
11
+ - Creating domain-specific prompt patterns (code review, debugging, RAG queries)
12
+
13
+ ### Recommended
14
+
15
+ - Standardizing message formats across multiple tools or agents
16
+ - Embedding MCP resource content into prompt messages for context
17
+ - Generating dynamic prompts that perform async lookups (knowledge base, APIs)
30
18
 
31
- Use `@Prompt` when you need to expose a reusable conversation template that an AI client can invoke with arguments. Prompts are ideal for code review patterns, debugging sessions, RAG queries, report generation, translation workflows, and any scenario where you want a standardized message structure.
19
+ ### Skip When
20
+
21
+ - You need an executable action that performs work and returns results (see `create-tool`)
22
+ - You need to expose read-only data at a URI (see `create-resource`)
23
+ - The task requires autonomous multi-step reasoning with inner tools (see `create-agent`)
24
+
25
+ > **Decision:** Use this skill when you need a reusable, parameterized conversation template that produces structured `GetPromptResult` messages.
32
26
 
33
27
  ## Class-Based Pattern
34
28
 
@@ -398,3 +392,45 @@ nx generate @frontmcp/nx:prompt
398
392
  ```
399
393
 
400
394
  This creates the prompt file, spec file, and updates barrel exports.
395
+
396
+ ## Common Patterns
397
+
398
+ | Pattern | Correct | Incorrect | Why |
399
+ | ------------------- | ----------------------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------------------------- |
400
+ | Return type | `execute()` returns `Promise<GetPromptResult>` | Returning a plain string or array of strings | MCP protocol requires `{ messages: [...] }` structure |
401
+ | Argument validation | Mark arguments as `required: true` in `arguments` array | Manually checking `args.field` inside `execute()` | Framework validates required arguments before `execute()` runs |
402
+ | Multi-turn priming | Use `assistant` role messages to prime expected response patterns | Putting all instructions in a single `user` message | Alternating roles guides the LLM toward structured output |
403
+ | Resource embedding | Use `type: 'resource'` content with a resource URI | Inlining resource data as raw text in the prompt | Resource references let clients resolve content dynamically |
404
+ | Error handling | Use `this.fail(err)` for validation failures in execute | `throw new Error(...)` directly | `this.fail` triggers the error flow with proper MCP error propagation |
405
+
406
+ ## Verification Checklist
407
+
408
+ ### Configuration
409
+
410
+ - [ ] Prompt class extends `PromptContext` and implements `execute(args)`
411
+ - [ ] `@Prompt` decorator has `name` and `arguments` array with correct `required` flags
412
+ - [ ] Prompt is registered in `prompts` array of `@App` or `@FrontMcp`
413
+ - [ ] All required arguments have `required: true`
414
+
415
+ ### Runtime
416
+
417
+ - [ ] Prompt appears in `prompts/list` MCP response
418
+ - [ ] Calling prompt with valid arguments returns well-formed `GetPromptResult`
419
+ - [ ] Missing required arguments trigger `MissingPromptArgumentError`
420
+ - [ ] Multi-turn messages have correct `user`/`assistant` role alternation
421
+ - [ ] DI dependencies resolve correctly via `this.get()`
422
+
423
+ ## Troubleshooting
424
+
425
+ | Problem | Cause | Solution |
426
+ | ------------------------------------------------- | --------------------------------------------------- | ----------------------------------------------------------------------------------------- |
427
+ | Prompt not appearing in `prompts/list` | Not registered in `prompts` array | Add prompt class to `@App` or `@FrontMcp` `prompts` array |
428
+ | `MissingPromptArgumentError` on optional argument | Argument marked `required: true` incorrectly | Set `required: false` for optional arguments in the `arguments` array |
429
+ | LLM ignores priming messages | Only using `user` role messages | Add `assistant` role messages to prime the conversation pattern |
430
+ | Type error on `execute()` return | Returning plain string instead of `GetPromptResult` | Wrap return in `{ messages: [{ role: 'user', content: { type: 'text', text: '...' } }] }` |
431
+ | `this.get(TOKEN)` throws DependencyNotFoundError | Provider not registered in scope | Register provider in `providers` array of `@App` or `@FrontMcp` |
432
+
433
+ ## Reference
434
+
435
+ - [Prompts Documentation](https://docs.agentfront.dev/frontmcp/servers/prompts)
436
+ - Related skills: `create-tool`, `create-resource`, `create-agent`, `create-provider`
@@ -1,36 +1,28 @@
1
- ---
2
- name: create-provider
3
- description: Create dependency injection providers for database connections, API clients, and singleton services. Use when tools and resources need shared services, DB pools, or configuration objects.
4
- tags: [provider, di, dependency-injection, singleton, database, service]
5
- parameters:
6
- - name: name
7
- description: Provider name
8
- type: string
9
- required: true
10
- examples:
11
- - scenario: Create a database connection pool provider
12
- expected-outcome: Singleton DB pool injectable into all tools via this.get()
13
- - scenario: Create a config provider from environment variables
14
- expected-outcome: Type-safe config object available in any context
15
- priority: 8
16
- visibility: both
17
- license: Apache-2.0
18
- metadata:
19
- docs: https://docs.agentfront.dev/frontmcp/extensibility/providers
20
- ---
21
-
22
1
  # Creating Providers (Dependency Injection)
23
2
 
24
3
  Providers are singleton services — database pools, API clients, config objects — that tools, resources, prompts, and agents can access via `this.get(token)`.
25
4
 
26
- ## When to Use
5
+ ## When to Use This Skill
6
+
7
+ ### Must Use
8
+
9
+ - Multiple tools, resources, or agents need a shared database connection pool
10
+ - API clients or external service connections must be singleton (not recreated per request)
11
+ - You need lifecycle management with `onInit()` at startup and `onDestroy()` at shutdown
12
+
13
+ ### Recommended
14
+
15
+ - Centralizing configuration values as a type-safe injectable object
16
+ - Sharing a cache layer (Map, Redis) across all execution contexts
17
+ - Providing environment-specific settings (API URLs, feature flags) via DI
27
18
 
28
- Create a provider when:
19
+ ### Skip When
29
20
 
30
- - Multiple tools need the same database connection pool
31
- - You have API clients that should be shared (not recreated per request)
32
- - Configuration values should be centralized and type-safe
33
- - You need lifecycle management (initialize on startup, cleanup on shutdown)
21
+ - The service is only used by a single tool and has no lifecycle (inline it in the tool)
22
+ - You need to build an executable action for AI clients (see `create-tool`)
23
+ - You need autonomous LLM-driven orchestration (see `create-agent`)
24
+
25
+ > **Decision:** Use this skill when you need a shared, singleton service with lifecycle management that tools, resources, and agents access via `this.get(token)`.
34
26
 
35
27
  ## Step 1: Define a Token
36
28
 
@@ -231,3 +223,46 @@ frontmcp dev
231
223
  # Call a tool that uses the provider
232
224
  # If provider fails to init, you'll see an error at startup
233
225
  ```
226
+
227
+ ## Common Patterns
228
+
229
+ | Pattern | Correct | Incorrect | Why |
230
+ | ------------------ | ---------------------------------------------------------------------- | --------------------------------------------- | --------------------------------------------------------------------------------- |
231
+ | Token definition | `const DB: Token<DbService> = Symbol('DbService')` (typed Symbol) | `const DB = 'database'` (string literal) | Typed `Token<T>` enables compile-time type checking on `this.get()` |
232
+ | DI resolution | `this.get(TOKEN)` with error handling | `this.tryGet(TOKEN)!` with non-null assertion | `get` throws a clear `DependencyNotFoundError`; non-null assertions hide failures |
233
+ | Lifecycle | Use `onInit()` for async setup, `onDestroy()` for cleanup | Initializing connections in the constructor | Constructor runs synchronously; `onInit()` supports async operations |
234
+ | Registration scope | Register at `@App` level for app-scoped, `@FrontMcp` for server-scoped | Registering same provider in multiple apps | Server-scoped providers are shared; duplicating causes multiple instances |
235
+ | Config provider | `readonly` properties from `process.env` | Mutable properties that change at runtime | Providers are singletons; mutable state can cause race conditions |
236
+
237
+ ## Verification Checklist
238
+
239
+ ### Configuration
240
+
241
+ - [ ] Provider class has `@Provider` decorator with `name`
242
+ - [ ] Token is defined with `Token<T>` using a `Symbol` and typed interface
243
+ - [ ] Provider is registered in `providers` array of `@App` or `@FrontMcp`
244
+ - [ ] `onInit()` handles async setup (DB connections, API clients)
245
+ - [ ] `onDestroy()` cleans up resources (close connections, flush buffers)
246
+
247
+ ### Runtime
248
+
249
+ - [ ] Server starts without provider initialization errors
250
+ - [ ] `this.get(TOKEN)` resolves the provider in tools, resources, and agents
251
+ - [ ] Provider is a singleton (same instance across all contexts)
252
+ - [ ] Server shutdown calls `onDestroy()` and cleans up resources
253
+ - [ ] Missing provider throws `DependencyNotFoundError` with a clear message
254
+
255
+ ## Troubleshooting
256
+
257
+ | Problem | Cause | Solution |
258
+ | ------------------------------------ | --------------------------------------------------- | ---------------------------------------------------------------------- |
259
+ | `DependencyNotFoundError` at runtime | Provider not registered in scope | Add provider to `providers` array in `@App` or `@FrontMcp` |
260
+ | Provider `onInit()` fails at startup | Missing environment variable or unreachable service | Check environment variables and service connectivity before starting |
261
+ | Multiple instances of same provider | Registered in multiple apps instead of server level | Move to `@FrontMcp` `providers` for shared, server-scoped access |
262
+ | Type mismatch on `this.get(TOKEN)` | Token typed with wrong interface | Ensure `Token<T>` generic matches the provider's implemented interface |
263
+ | Provider not destroyed on shutdown | Missing `onDestroy()` method | Implement `onDestroy()` to close connections and release resources |
264
+
265
+ ## Reference
266
+
267
+ - [Providers Documentation](https://docs.agentfront.dev/frontmcp/extensibility/providers)
268
+ - Related skills: `create-tool`, `create-resource`, `create-agent`, `create-prompt`
@@ -1,38 +1,28 @@
1
- ---
2
- name: create-resource
3
- description: Create MCP resources and resource templates with URI-based access. Use when exposing data via URIs, creating resource templates, or serving dynamic content.
4
- tags: [resources, mcp, uri, templates, decorator]
5
- tools:
6
- - name: create_resource
7
- purpose: Scaffold a new resource or resource template class
8
- parameters:
9
- - name: name
10
- description: Resource name in kebab-case
11
- type: string
12
- required: true
13
- - name: type
14
- description: Whether to create a static resource or resource template
15
- type: string
16
- required: false
17
- examples:
18
- - scenario: Create a static configuration resource
19
- expected-outcome: Resource registered and readable via MCP at a fixed URI
20
- - scenario: Create a resource template for user profiles
21
- expected-outcome: Resource template with parameterized URI pattern
22
- priority: 10
23
- visibility: both
24
- license: Apache-2.0
25
- metadata:
26
- docs: https://docs.agentfront.dev/frontmcp/servers/resources
27
- ---
28
-
29
1
  # Creating MCP Resources
30
2
 
31
3
  Resources expose data to AI clients through URI-based access following the MCP protocol. FrontMCP supports two kinds: **static resources** with fixed URIs (`@Resource`) and **resource templates** with parameterized URI patterns (`@ResourceTemplate`).
32
4
 
33
- ## When to Use @Resource vs @ResourceTemplate
5
+ ## When to Use This Skill
6
+
7
+ ### Must Use
8
+
9
+ - Exposing data to AI clients through URI-based access following the MCP protocol
10
+ - Serving dynamic or static content that clients read on demand (config, status, files)
11
+ - Creating parameterized URI patterns for families of related data (user profiles, repo files)
12
+
13
+ ### Recommended
14
+
15
+ - Providing binary assets (images, PDFs) to AI clients via base64 blob encoding
16
+ - Centralizing read-only data sources that multiple tools or prompts reference
17
+ - Replacing ad-hoc tool responses with structured, cacheable resource URIs
34
18
 
35
- Use `@Resource` when the data lives at a single, known URI (e.g., `config://app/settings`, `status://server`). Use `@ResourceTemplate` when you need a family of related resources identified by parameters in the URI (e.g., `users://{userId}/profile`, `repo://{owner}/{repo}/files/{path}`).
19
+ ### Skip When
20
+
21
+ - The client needs to perform an action, not read data (see `create-tool`)
22
+ - You are building a reusable conversation template (see `create-prompt`)
23
+ - The data requires autonomous multi-step reasoning to produce (see `create-agent`)
24
+
25
+ > **Decision:** Use this skill when you need to expose readable data at a URI -- choose `@Resource` for a fixed URI or `@ResourceTemplate` for parameterized URI patterns.
36
26
 
37
27
  ## Static Resources with @Resource
38
28
 
@@ -435,3 +425,45 @@ nx generate @frontmcp/nx:resource
435
425
  ```
436
426
 
437
427
  This creates the resource file, spec file, and updates barrel exports.
428
+
429
+ ## Common Patterns
430
+
431
+ | Pattern | Correct | Incorrect | Why |
432
+ | ---------------------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
433
+ | URI scheme | `uri: 'config://app/settings'` (valid scheme) | `uri: 'app-settings'` (no scheme) | URIs are validated per RFC 3986; scheme-less URIs are rejected at registration |
434
+ | Resource vs template | `@Resource` for fixed URIs, `@ResourceTemplate` for `{param}` URIs | Using `@Resource` with `{param}` placeholders | Framework selects matching strategy based on decorator type |
435
+ | Return shape | Return full `ReadResourceResult` or let FrontMCP normalize plain objects | Manually wrapping every return in `{ contents: [...] }` when not needed | FrontMCP auto-wraps strings, objects, and arrays into valid `ReadResourceResult` |
436
+ | Template params typing | `ResourceContext<{ userId: string }>` with typed `params` | `ResourceContext` with untyped `params: Record<string, string>` | Generic parameter enables compile-time checking of URI parameters |
437
+ | Binary content | Use `blob` field with base64 encoding for binary data | Returning raw `Buffer` in `text` field | MCP protocol expects base64 in `blob`; `text` is for string content only |
438
+
439
+ ## Verification Checklist
440
+
441
+ ### Configuration
442
+
443
+ - [ ] Resource class extends `ResourceContext` and implements `execute(uri, params)`
444
+ - [ ] `@Resource` has `name` and `uri` with a valid scheme, or `@ResourceTemplate` has `name` and `uriTemplate`
445
+ - [ ] Resource is registered in `resources` array of `@App` or `@FrontMcp`
446
+ - [ ] `mimeType` is set when the content type is not plain text
447
+
448
+ ### Runtime
449
+
450
+ - [ ] Resource appears in `resources/list` MCP response
451
+ - [ ] Reading the resource URI returns the expected `ReadResourceResult`
452
+ - [ ] Template parameters are extracted correctly from the URI
453
+ - [ ] Binary resources return valid base64 in the `blob` field
454
+ - [ ] DI dependencies resolve correctly via `this.get()`
455
+
456
+ ## Troubleshooting
457
+
458
+ | Problem | Cause | Solution |
459
+ | ------------------------------------------------ | ------------------------------------------------ | ---------------------------------------------------------------------------------- |
460
+ | Resource not appearing in `resources/list` | Not registered in `resources` array | Add resource class to `@App` or `@FrontMcp` `resources` array |
461
+ | URI validation error at startup | Missing or invalid URI scheme | Ensure URI has a scheme like `config://`, `https://`, or `custom://` |
462
+ | Template parameters are empty | Using `@Resource` instead of `@ResourceTemplate` | Switch to `@ResourceTemplate` with `uriTemplate` containing `{param}` placeholders |
463
+ | Binary content is garbled | Returning raw buffer in `text` field | Use `blob: buffer.toString('base64')` instead of `text` for binary data |
464
+ | `this.get(TOKEN)` throws DependencyNotFoundError | Provider not registered in scope | Register provider in `providers` array of `@App` or `@FrontMcp` |
465
+
466
+ ## Reference
467
+
468
+ - [Resources Documentation](https://docs.agentfront.dev/frontmcp/servers/resources)
469
+ - Related skills: `create-tool`, `create-prompt`, `create-provider`, `create-agent`
@@ -1,31 +1,28 @@
1
- ---
2
- name: create-skill-with-tools
3
- description: Create skills that reference and orchestrate MCP tools for multi-step workflows. Use when building skills with tool references, SKILL.md directories, or workflow instructions.
4
- tags: [skill, tools, workflow, instructions]
5
- parameters:
6
- - name: name
7
- description: Skill name in kebab-case
8
- type: string
9
- required: true
10
- examples:
11
- - scenario: Create a deploy skill that uses build and test tools
12
- expected-outcome: Skill guides AI through build, test, deploy workflow
13
- - scenario: Create a skill from a SKILL.md file directory
14
- expected-outcome: Skill loaded with instructions, scripts, references, assets
15
- priority: 8
16
- visibility: both
17
- license: Apache-2.0
18
- metadata:
19
- docs: https://docs.agentfront.dev/frontmcp/servers/skills
20
- ---
21
-
22
1
  # Creating a Skill with Tools
23
2
 
24
3
  Skills are knowledge and workflow guides that help LLMs accomplish multi-step tasks using available MCP tools. Unlike tools (which execute actions directly) or agents (which run autonomous LLM loops), skills provide structured instructions, tool references, and context that the AI client uses to orchestrate tool calls on its own.
25
4
 
26
- ## When to Use @Skill
5
+ ## When to Use This Skill
27
6
 
28
- Use `@Skill` when you want to teach an AI client HOW to accomplish a complex task by combining multiple tools in sequence. A skill does not execute anything itself -- it provides the instructions, tool references, and examples that guide the AI through a workflow.
7
+ ### Must Use
8
+
9
+ - Teaching an AI client how to accomplish a complex task by combining multiple tools in a defined sequence
10
+ - Building directory-based skills with `SKILL.md`, scripts, references, and assets loaded via `skillDir()`
11
+ - Defining tool-orchestration instructions with explicit tool references, parameters, and examples
12
+
13
+ ### Recommended
14
+
15
+ - Creating reusable workflow guides that can be discovered via HTTP (`/llm.txt`, `/skills`) or MCP protocol
16
+ - Wrapping existing tools into a higher-level procedure with step-by-step instructions and validation modes
17
+ - Providing AI clients with structured playbooks for incident response, deployment, or data-processing flows
18
+
19
+ ### Skip When
20
+
21
+ - You need a single executable action with direct input/output (see `create-tool`)
22
+ - You need an autonomous LLM loop that reasons across multiple steps on its own (see `create-agent`)
23
+ - You are building a conversational template or system prompt without tool references (see `create-prompt`)
24
+
25
+ > **Decision:** Use this skill when you need to guide an AI client through a multi-tool workflow using structured instructions and tool references, without executing anything directly.
29
26
 
30
27
  | Aspect | @Skill | @Tool | @Agent |
31
28
  | ---------- | ------------------------ | -------------------- | -------------------- |
@@ -215,7 +212,7 @@ class RemoteWorkflowSkill extends SkillContext {}
215
212
 
216
213
  Use `skillDir()` to load a skill from a directory structure. The directory is expected to contain a `SKILL.md` file with frontmatter and instructions, plus optional subdirectories for scripts, references, and assets.
217
214
 
218
- ```
215
+ ```text
219
216
  skills/
220
217
  deploy-service/
221
218
  SKILL.md # Instructions with YAML frontmatter
@@ -577,3 +574,51 @@ class AuditApp {}
577
574
  })
578
575
  class AuditServer {}
579
576
  ```
577
+
578
+ ## Common Patterns
579
+
580
+ | Pattern | Correct | Incorrect | Why |
581
+ | ------------------ | ------------------------------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
582
+ | Tool references | `tools: [BuildTool, 'run_tests', { name: 'deploy', purpose: '...', required: true }]` | `tools: [{ class: BuildTool }]` (object with `class` key) | The `tools` array accepts class refs, strings, or `{ name, purpose, required }` objects only |
583
+ | Tool validation | `toolValidation: 'strict'` for production skills | Omitting `toolValidation` for critical workflows | Default is `'warn'`; production skills should fail fast on missing tools with `'strict'` |
584
+ | Instruction source | `instructions: { file: './skills/deploy.md' }` for long content | Inlining hundreds of lines in the decorator string | File-based instructions keep decorator metadata readable and instructions maintainable |
585
+ | Skill visibility | `visibility: 'both'` (default) for public skills | Setting `visibility: 'mcp'` when HTTP discovery is also needed | Skills with `'mcp'` visibility are hidden from `/llm.txt` and `/skills` HTTP endpoints |
586
+ | Parameter types | `parameters: [{ name: 'env', type: 'string', required: true }]` | `parameters: { env: 'string' }` (plain object shape) | Parameters must be an array of `{ name, description, type, required?, default? }` objects |
587
+
588
+ ## Verification Checklist
589
+
590
+ ### Configuration
591
+
592
+ - [ ] `@Skill` decorator has `name` and `description`
593
+ - [ ] `instructions` are provided via inline string, `{ file }`, or `{ url }`
594
+ - [ ] All tool references in `tools` array resolve to registered tools (when `toolValidation: 'strict'`)
595
+ - [ ] Skill is registered in `skills` array of `@App` or `@FrontMcp`
596
+
597
+ ### Runtime
598
+
599
+ - [ ] Skill appears in MCP skill listing (`skills/list`) when `visibility` includes `'mcp'`
600
+ - [ ] Skill appears at `/llm.txt` and `/skills` HTTP endpoints when `visibility` includes `'http'`
601
+ - [ ] `build()` returns complete `SkillContent` with instructions and tool references
602
+ - [ ] `getToolRefs()` returns the correct list of resolved tool references
603
+ - [ ] Hidden skills (`hideFromDiscovery: true`) are invocable but not listed in discovery
604
+
605
+ ### Directory-Based Skills
606
+
607
+ - [ ] `SKILL.md` file exists at the root of the skill directory with valid YAML frontmatter
608
+ - [ ] `skillDir()` correctly loads instructions, scripts, references, and assets
609
+ - [ ] Frontmatter `tools` entries match registered tool names
610
+
611
+ ## Troubleshooting
612
+
613
+ | Problem | Cause | Solution |
614
+ | -------------------------------------------- | ----------------------------------------------------------- | -------------------------------------------------------------------------------------- |
615
+ | Skill not appearing in `/llm.txt` | `visibility` is set to `'mcp'` | Change to `'both'` or `'http'` to include HTTP discovery |
616
+ | `toolValidation: 'strict'` throws at startup | A referenced tool is not registered in the scope | Register all referenced tools in the `tools` array of `@App` or `@FrontMcp` |
617
+ | `skillDir()` fails to load | `SKILL.md` file missing or frontmatter is invalid YAML | Ensure the directory contains a `SKILL.md` with valid `---` delimited YAML frontmatter |
618
+ | Instructions are empty at runtime | `{ file: './path.md' }` path is relative to wrong directory | Use a path relative to the skill file's location, not the project root |
619
+ | Parameters not visible to AI client | `parameters` defined as a plain object instead of an array | Use array format: `[{ name, description, type, required }]` |
620
+
621
+ ## Reference
622
+
623
+ - [Skills Documentation](https://docs.agentfront.dev/frontmcp/servers/skills)
624
+ - Related skills: `create-skill`, `create-tool`, `create-agent`, `create-prompt`