@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
@@ -0,0 +1,420 @@
1
+ ---
2
+ name: frontmcp-guides
3
+ description: 'Tutorials, walkthroughs, and end-to-end examples for building FrontMCP servers. Use when you want a getting started guide, how to build a complete project, learn best practices, or follow a step-by-step example. Triggers: tutorial, walkthrough, how to build, getting started, learn FrontMCP.'
4
+ tags: [guides, examples, best-practices, architecture, walkthrough, end-to-end]
5
+ category: guides
6
+ targets: [all]
7
+ bundle: [recommended, full]
8
+ priority: 10
9
+ visibility: both
10
+ license: Apache-2.0
11
+ metadata:
12
+ docs: https://docs.agentfront.dev/frontmcp/guides/overview
13
+ examples:
14
+ - scenario: Build a simple weather API MCP server from scratch
15
+ expected-outcome: Working server with tools, resources, and tests deployed to Node
16
+ - scenario: Build a task manager with auth, Redis, and multi-tool patterns
17
+ expected-outcome: Authenticated server with CRUD tools, session storage, and E2E tests
18
+ - scenario: Build a multi-app knowledge base with agents and plugins
19
+ expected-outcome: Composed server with multiple apps, AI agents, caching, and Vercel deployment
20
+ ---
21
+
22
+ # FrontMCP End-to-End Guides
23
+
24
+ Complete build walkthroughs and best practices for FrontMCP servers. Each example starts from an empty directory and ends with a deployed, tested server. Every pattern references the specific skill that teaches it.
25
+
26
+ ## When to Use This Skill
27
+
28
+ ### Must Use
29
+
30
+ - Starting a new FrontMCP project from scratch and want a complete walkthrough to follow
31
+ - Learning FrontMCP architecture by building progressively complex real examples
32
+ - Need to see how multiple skills work together in a complete application
33
+
34
+ ### Recommended
35
+
36
+ - Planning a new project and want to see how similar architectures are structured
37
+ - Onboarding a team member who learns best from complete working examples
38
+ - Reviewing best practices for file organization, naming, and code patterns
39
+
40
+ ### Skip When
41
+
42
+ - You need to learn one specific component type (use the specific skill, e.g., `create-tool`)
43
+ - Looking for the right skill for a task (use domain routers: `frontmcp-development`, `frontmcp-deployment`, etc.)
44
+ - You need CLI/install instructions for the skills system (see `frontmcp-skills-usage`)
45
+
46
+ > **Decision:** Use this skill when you want to see how everything fits together. Use individual skills when you need focused instruction.
47
+
48
+ ## Prerequisites
49
+
50
+ - Node.js 24+ and npm/yarn installed
51
+ - Familiarity with TypeScript and decorators
52
+ - `frontmcp` CLI available globally (`npm install -g frontmcp`)
53
+
54
+ ## Steps
55
+
56
+ 1. Choose an example that matches your project's complexity level (Beginner, Intermediate, Advanced)
57
+ 2. Work through the Planning Checklist to define your project's scope
58
+ 3. Follow the example code and architecture, referencing individual skills for deeper guidance
59
+ 4. Verify your implementation using the Verification Checklist at the end of this skill
60
+
61
+ ## Planning Checklist
62
+
63
+ Before writing any code, answer these questions:
64
+
65
+ ### 1. What does the server do?
66
+
67
+ - What tools does it expose? (actions AI clients can call)
68
+ - What resources does it expose? (data AI clients can read)
69
+ - What prompts does it expose? (conversation templates)
70
+
71
+ ### 2. How is it organized?
72
+
73
+ - Single app or multiple apps? (see `multi-app-composition`)
74
+ - Standalone project or Nx monorepo? (see `project-structure-standalone`, `project-structure-nx`)
75
+
76
+ ### 3. How is it secured?
77
+
78
+ - Public (no auth), transparent (passthrough), local (self-contained), or remote (OAuth)? (see `configure-auth`)
79
+ - What session storage? Memory (dev), Redis (prod), Vercel KV (serverless)? (see `configure-session`)
80
+
81
+ ### 4. Where does it deploy?
82
+
83
+ - Node, Vercel, Lambda, Cloudflare, CLI, browser, or SDK? (see `frontmcp-deployment`)
84
+ - What transport? stdio (local), SSE (streaming), Streamable HTTP (stateless)? (see `configure-transport`)
85
+
86
+ ### 5. How is it tested?
87
+
88
+ - Unit tests for each component (see `setup-testing`)
89
+ - E2E tests for protocol-level flows
90
+ - Coverage target: 95%+
91
+
92
+ ---
93
+
94
+ ## Example 1: Weather API (Beginner)
95
+
96
+ **Skills used:** `setup-project`, `create-tool`, `create-resource`, `setup-testing`, `deploy-to-node`
97
+
98
+ A simple MCP server that exposes a weather lookup tool and a resource for supported cities.
99
+
100
+ ### Architecture
101
+
102
+ ```text
103
+ weather-api/
104
+ ├── src/
105
+ │ ├── main.ts # @FrontMcp server (deploy-to-node)
106
+ │ ├── weather.app.ts # @App with tools and resources
107
+ │ ├── tools/
108
+ │ │ └── get-weather.tool.ts # @Tool: fetch weather by city (create-tool)
109
+ │ └── resources/
110
+ │ └── cities.resource.ts # @Resource: list supported cities (create-resource)
111
+ ├── test/
112
+ │ ├── get-weather.tool.spec.ts # Unit tests (setup-testing)
113
+ │ └── weather.e2e.spec.ts # E2E protocol test (setup-testing)
114
+ └── package.json
115
+ ```
116
+
117
+ ### Key Code
118
+
119
+ **Server entry point** (`setup-project`):
120
+
121
+ ```typescript
122
+ import { FrontMcp } from '@frontmcp/sdk';
123
+ import { WeatherApp } from './weather.app';
124
+
125
+ @FrontMcp({
126
+ info: { name: 'weather-api', version: '1.0.0' },
127
+ apps: [WeatherApp],
128
+ })
129
+ export default class WeatherServer {}
130
+ ```
131
+
132
+ **Tool** (`create-tool`):
133
+
134
+ ```typescript
135
+ import { Tool, ToolContext } from '@frontmcp/sdk';
136
+ import { z } from 'zod';
137
+
138
+ @Tool({
139
+ name: 'get_weather',
140
+ description: 'Get current weather for a city',
141
+ inputSchema: {
142
+ city: z.string().min(1).describe('City name'),
143
+ },
144
+ outputSchema: {
145
+ temperature: z.number(),
146
+ condition: z.string(),
147
+ humidity: z.number(),
148
+ },
149
+ })
150
+ export class GetWeatherTool extends ToolContext {
151
+ async execute(input: { city: string }) {
152
+ const city = encodeURIComponent(input.city);
153
+ const data = await this.fetch(`https://api.weather.example.com/v1?city=${city}`);
154
+ const json = await data.json();
155
+ return { temperature: json.temp, condition: json.condition, humidity: json.humidity };
156
+ }
157
+ }
158
+ ```
159
+
160
+ **Resource** (`create-resource`):
161
+
162
+ ```typescript
163
+ import { Resource, ResourceContext } from '@frontmcp/sdk';
164
+
165
+ @Resource({
166
+ uri: 'weather://cities',
167
+ name: 'Supported Cities',
168
+ description: 'List of cities with weather data',
169
+ mimeType: 'application/json',
170
+ })
171
+ export class CitiesResource extends ResourceContext {
172
+ async read() {
173
+ return JSON.stringify(['London', 'Tokyo', 'New York', 'Paris', 'Sydney']);
174
+ }
175
+ }
176
+ ```
177
+
178
+ > **Full working code:** See `references/example-weather-api.md`
179
+
180
+ ---
181
+
182
+ ## Example 2: Task Manager (Intermediate)
183
+
184
+ **Skills used:** `setup-project`, `create-tool`, `create-provider`, `configure-auth`, `configure-session`, `setup-redis`, `setup-testing`, `deploy-to-vercel`
185
+
186
+ An authenticated task management server with CRUD tools, Redis storage, and OAuth.
187
+
188
+ ### Architecture
189
+
190
+ ```text
191
+ task-manager/
192
+ ├── src/
193
+ │ ├── main.ts # @FrontMcp with auth: { mode: 'remote' }
194
+ │ ├── tasks.app.ts # @App with CRUD tools + provider
195
+ │ ├── providers/
196
+ │ │ └── task-store.provider.ts # @Provider: Redis-backed task storage (create-provider)
197
+ │ ├── tools/
198
+ │ │ ├── create-task.tool.ts # @Tool: create a task (create-tool)
199
+ │ │ ├── list-tasks.tool.ts # @Tool: list tasks (create-tool)
200
+ │ │ ├── update-task.tool.ts # @Tool: update task status (create-tool)
201
+ │ │ └── delete-task.tool.ts # @Tool: delete a task (create-tool)
202
+ │ └── types/
203
+ │ └── task.ts # Shared task interface
204
+ ├── test/
205
+ │ ├── *.spec.ts # Unit tests per tool
206
+ │ └── tasks.e2e.spec.ts # E2E with auth flow
207
+ ├── vercel.json # Vercel config (deploy-to-vercel)
208
+ └── package.json
209
+ ```
210
+
211
+ ### Key Code
212
+
213
+ **Server with auth** (`configure-auth`, `configure-session`, `setup-redis`):
214
+
215
+ ```typescript
216
+ @FrontMcp({
217
+ info: { name: 'task-manager', version: '1.0.0' },
218
+ apps: [TasksApp],
219
+ auth: { mode: 'remote', provider: 'https://auth.example.com', clientId: 'my-client-id' },
220
+ redis: { provider: 'redis', host: process.env.REDIS_URL ?? 'localhost' },
221
+ })
222
+ export default class TaskManagerServer {}
223
+ ```
224
+
225
+ **Provider for shared storage** (`create-provider`):
226
+
227
+ ```typescript
228
+ import { Provider } from '@frontmcp/sdk';
229
+ import type { Token } from '@frontmcp/di';
230
+
231
+ export interface TaskStore {
232
+ create(task: Task): Promise<Task>;
233
+ list(userId: string): Promise<Task[]>;
234
+ update(id: string, data: Partial<Task>): Promise<Task>;
235
+ delete(id: string): Promise<void>;
236
+ }
237
+
238
+ export const TASK_STORE: Token<TaskStore> = Symbol('TaskStore');
239
+
240
+ @Provider({ token: TASK_STORE })
241
+ export class RedisTaskStoreProvider implements TaskStore {
242
+ // Redis-backed implementation
243
+ }
244
+ ```
245
+
246
+ **Tool with DI** (`create-tool` + `create-provider`):
247
+
248
+ ```typescript
249
+ @Tool({
250
+ name: 'create_task',
251
+ description: 'Create a new task',
252
+ inputSchema: {
253
+ title: z.string().min(1).describe('Task title'),
254
+ priority: z.enum(['low', 'medium', 'high']).default('medium'),
255
+ },
256
+ outputSchema: { id: z.string(), title: z.string(), priority: z.string(), status: z.string() },
257
+ })
258
+ export class CreateTaskTool extends ToolContext {
259
+ async execute(input: { title: string; priority: string }) {
260
+ const store = this.get(TASK_STORE);
261
+ return store.create({ title: input.title, priority: input.priority, status: 'pending' });
262
+ }
263
+ }
264
+ ```
265
+
266
+ > **Full working code:** See `references/example-task-manager.md`
267
+
268
+ ---
269
+
270
+ ## Example 3: Knowledge Base (Advanced)
271
+
272
+ **Skills used:** `setup-project`, `multi-app-composition`, `create-tool`, `create-resource`, `create-agent`, `create-skill-with-tools`, `create-plugin`, `official-plugins`, `configure-auth`, `deploy-to-vercel`
273
+
274
+ A multi-app knowledge base with AI-powered search, document ingestion, and an autonomous research agent.
275
+
276
+ ### Architecture
277
+
278
+ ```text
279
+ knowledge-base/
280
+ ├── src/
281
+ │ ├── main.ts # @FrontMcp composing 3 apps
282
+ │ ├── ingestion/
283
+ │ │ ├── ingestion.app.ts # @App: document ingestion
284
+ │ │ ├── tools/ingest-document.tool.ts
285
+ │ │ └── providers/vector-store.provider.ts
286
+ │ ├── search/
287
+ │ │ ├── search.app.ts # @App: search and retrieval
288
+ │ │ ├── tools/search-docs.tool.ts
289
+ │ │ └── resources/doc.resource.ts
290
+ │ ├── research/
291
+ │ │ ├── research.app.ts # @App: AI research agent
292
+ │ │ └── agents/researcher.agent.ts # @Agent: autonomous research loop
293
+ │ └── plugins/
294
+ │ └── audit-log.plugin.ts # @Plugin: audit logging
295
+ ├── test/
296
+ │ └── *.spec.ts
297
+ ├── vercel.json
298
+ └── package.json
299
+ ```
300
+
301
+ ### Key Code
302
+
303
+ **Multi-app composition** (`multi-app-composition`):
304
+
305
+ ```typescript
306
+ @FrontMcp({
307
+ info: { name: 'knowledge-base', version: '1.0.0' },
308
+ apps: [IngestionApp, SearchApp, ResearchApp],
309
+ plugins: [AuditLogPlugin],
310
+ auth: { mode: 'remote', provider: 'https://auth.example.com', clientId: 'my-client-id' },
311
+ redis: { provider: 'redis', host: process.env.REDIS_URL ?? 'localhost' },
312
+ })
313
+ export default class KnowledgeBaseServer {}
314
+ ```
315
+
316
+ **AI Research Agent** (`create-agent`):
317
+
318
+ ```typescript
319
+ @Agent({
320
+ name: 'research_topic',
321
+ description: 'Research a topic across the knowledge base and synthesize findings',
322
+ inputSchema: {
323
+ topic: z.string().describe('Research topic'),
324
+ depth: z.enum(['shallow', 'deep']).default('shallow'),
325
+ },
326
+ llm: {
327
+ provider: 'anthropic',
328
+ model: 'claude-sonnet-4-5',
329
+ apiKey: { env: 'ANTHROPIC_API_KEY' },
330
+ maxTokens: 4096,
331
+ }, // provider and model are client-configurable
332
+ tools: [SearchDocsTool, IngestDocumentTool],
333
+ })
334
+ export class ResearcherAgent extends AgentContext {
335
+ async execute(input: { topic: string; depth: string }) {
336
+ return this.run(
337
+ `Research "${input.topic}" at ${input.depth} depth. Search for relevant documents, synthesize findings, and provide a structured summary.`,
338
+ );
339
+ }
340
+ }
341
+ ```
342
+
343
+ > **Full working code:** See `references/example-knowledge-base.md`
344
+
345
+ ---
346
+
347
+ ## Best Practices
348
+
349
+ ### Planning
350
+
351
+ | Practice | Why | Skill Reference |
352
+ | ------------------------------------------------------ | ----------------------------------------------------------------- | ------------------------------------- |
353
+ | Start with the `@App` boundaries, not individual tools | Apps define module boundaries; tools are implementation details | `multi-app-composition` |
354
+ | Choose auth mode and storage before writing tools | Auth affects session handling, which affects storage requirements | `configure-auth`, `configure-session` |
355
+ | Pick your deployment target early | Target determines transport, storage, and build constraints | `frontmcp-deployment` |
356
+
357
+ ### Organizing Code
358
+
359
+ | Practice | Why | Skill Reference |
360
+ | ------------------------------------------------- | ----------------------------------------------------------- | ------------------------------ |
361
+ | One class per file with `<name>.<type>.ts` naming | Consistency, generator compatibility, clear imports | `project-structure-standalone` |
362
+ | Group by feature, not by type, for 10+ components | Feature folders scale better than flat `tools/` directories | `project-structure-standalone` |
363
+ | Extract shared logic into `@Provider` classes | Testable, lifecycle-managed, injected via DI | `create-provider` |
364
+
365
+ ### Writing Code
366
+
367
+ | Practice | Why | Skill Reference |
368
+ | ----------------------------------------------- | ------------------------------------------------------------- | ----------------- |
369
+ | Always define `outputSchema` on tools | Prevents data leaks, enables CodeCall chaining | `create-tool` |
370
+ | Use `this.fail()` with MCP error classes | Proper error codes in protocol responses | `create-tool` |
371
+ | Use `this.get(TOKEN)` not `this.tryGet(TOKEN)!` | Clear error on missing dependency vs silent null | `create-provider` |
372
+ | Use Zod raw shapes, not `z.object()` | Framework wraps internally; double-wrapping breaks validation | `create-tool` |
373
+
374
+ ## Common Patterns
375
+
376
+ | Pattern | Correct | Incorrect | Why |
377
+ | ----------------- | ------------------------------------------- | ----------------------------------------- | --------------------------------------------------------- |
378
+ | Project start | Plan apps and auth first, then build tools | Jump straight into writing tools | Architecture decisions are expensive to change later |
379
+ | Code organization | Feature folders with `<name>.<type>.ts` | Flat directory with generic names | Scales to large projects and matches generator output |
380
+ | Shared state | `@Provider` with DI token | Module-level singleton or global variable | DI is testable, lifecycle-managed, and scoped per request |
381
+ | Error handling | `this.fail(new ResourceNotFoundError(...))` | `throw new Error('not found')` | MCP error codes enable proper client error handling |
382
+ | Testing | Unit tests per component + E2E for protocol | Only E2E tests or only unit tests | Both layers catch different types of bugs |
383
+
384
+ ## Verification Checklist
385
+
386
+ ### Architecture
387
+
388
+ - [ ] Apps define clear module boundaries with no circular imports
389
+ - [ ] Shared logic extracted into providers, not duplicated across tools
390
+ - [ ] Auth mode and storage chosen before writing tools
391
+
392
+ ### Code Quality
393
+
394
+ - [ ] All tools have `outputSchema` defined
395
+ - [ ] All files follow `<name>.<type>.ts` naming convention
396
+ - [ ] All test files use `.spec.ts` extension
397
+ - [ ] Coverage at 95%+ across all metrics
398
+
399
+ ### Production Readiness
400
+
401
+ - [ ] Secrets stored in environment variables, not source code
402
+ - [ ] Session storage uses Redis/KV in production (not memory)
403
+ - [ ] Rate limiting configured for public-facing tools
404
+ - [ ] E2E tests exercise the full protocol flow
405
+
406
+ ## Troubleshooting
407
+
408
+ | Problem | Cause | Solution |
409
+ | ---------------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------ |
410
+ | Unsure where to start | No project plan | Run through the Planning Checklist above before writing code |
411
+ | Architecture feels wrong | Wrong app boundaries or component types | Review the Scenario Routing Table in `frontmcp-development` |
412
+ | Feature works locally but fails deployed | Environment-specific config (storage, auth, transport) | Check the Target Comparison in `frontmcp-deployment` |
413
+ | Tests pass but coverage below 95% | Missing error path or branch tests | Run `jest --coverage` and add tests for uncovered lines |
414
+ | Provider state leaking between requests | Using module-level state instead of DI | Move state into a `@Provider` scoped per request |
415
+
416
+ ## Reference
417
+
418
+ - [Guides Documentation](https://docs.agentfront.dev/frontmcp/guides/overview)
419
+ - Domain routers: `frontmcp-development`, `frontmcp-deployment`, `frontmcp-testing`, `frontmcp-config`
420
+ - Core skills: `setup-project`, `create-tool`, `create-resource`, `create-provider`, `create-agent`, `configure-auth`, `setup-testing`