New mcp prompt
Skill stevekinney/lesson-plan-adapter/.claude/skills/new-mcp-prompt
npx -y skills add stevekinney/lesson-plan-adapter --skill new-mcp-promptAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.8 KB, as published. Nobody here has run it
Skill: New MCP Prompt
Scaffold a new MCP prompt in the template.
Steps
- Create
packages/mcp/src/prompts/<prompt-name>.ts(kebab-case filename) - Define the prompt object with:
name: snake_case (e.g.,my_prompt_name)description: Clear, concise description of what the prompt doesarguments: Raw Zod shape (not wrapped inz.object()) defining the prompt argumentshandler: Async function with(arguments_: { ... }, context: { userId: string })signature
- Follow the error handling pattern:
- Create a child logger:
logger.child({ prompt: 'prompt_name', userId: context.userId }) - Wrap handler body in try/catch
- On success: return
{ messages: [{ role: 'user', content: { type: 'text', text: '...' } }] } - On failure: log
requestLogger.error({ err }, 'Prompt failed')and return a fallback message - Prompts must never throw — always return a structured MCP response
- Create a child logger:
- Register in
packages/mcp/src/server.ts:server.registerPrompt( myPrompt.name, { description: myPrompt.description, argsSchema: myPrompt.arguments }, async (arguments_) => myPrompt.handler(arguments_, context), ); - Re-export from
packages/mcp/src/index.ts
Template
import { z } from 'zod';
import { logger } from '../logger.js';
export const myPromptNamePrompt = {
name: 'my_prompt_name' as const,
description: 'Description of what this prompt does.',
arguments: {
myArgument: z.string().describe('Description of the argument'),
},
handler: async (arguments_: { myArgument: string }, context: { userId: string }) => {
const requestLogger = logger.child({ prompt: 'my_prompt_name', userId: context.userId });
try {
requestLogger.info('Prompt requested');
return {
messages: [
{
role: 'user' as const,
content: {
type: 'text' as const,
text: `Prompt text using ${arguments_.myArgument} for user ${context.userId}`,
},
},
],
};
} catch (error) {
requestLogger.error({ err: error }, 'Prompt failed');
return {
messages: [
{
role: 'user' as const,
content: {
type: 'text' as const,
text: 'An error occurred while generating the prompt.',
},
},
],
};
}
},
};
Using Markdown Templates
Prompt handlers can import .md files as strings for template content:
import templateContent from './templates/my-template.md' with { type: 'text' };
// In the handler:
const rendered = templateContent.replace('{variable}', actualValue);
Create template files in packages/mcp/src/prompts/templates/. The text-imports.d.ts declaration in packages/mcp/src/ provides TypeScript support.