用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/gb2b/gdevelop-mcp --skill add-mcp-tool命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | add-mcp-tool |
| description | Use when adding a new tool to the gdevelop-mcp server. Walks through the file/test/registration changes required. |
Use this checklist whenever you want to expose new functionality as a tool.
src/core/. Prefer extending an
existing file when the concern is the same; otherwise create
src/core/<topic>.ts..claude/rules/safety.md:
baseline validate → operate in memory → validate result → backup →
atomic write.src/index.ts:
- Choose a snake_case name that's discoverable (verb_object).
- Write a description that says when to use this and how it
relates to other tools (mention inspect_project,
validate_project, dryRun, etc. when relevant).
- Define inputs with Zod — every field gets a .describe().
- The handler is a thin try/catch wrapper returning textResult(...)
or errorResult(...).test/<topic>.test.ts (or extend an existing one):
at minimum a happy path and one error path.npm run typecheck && npm test. Both must pass.CHANGELOG.md under a new (or current) version section.README.md's tool table.src/prompts.ts to mention it.In src/core/<topic>.ts:
import { z } from "zod";
export type DoSomethingOptions = {
// strongly-typed fields here
};
export type DoSomethingResult = {
// serializable result
};
export async function doSomething(
opts: DoSomethingOptions,
): Promise<DoSomethingResult> {
// ... implementation
}
In src/index.ts (next to other tools of the same family):
server.tool(
"do_something",
"One-paragraph description: what it does, when to use it, how it relates to other tools.",
{
foo: z.string().describe("..."),
bar: z.number().int().optional().describe("..."),
},
async ({ foo, bar }) => {
try {
const result = await doSomething({ foo, bar });
return textResult(result);
} catch (err) {
return errorResult((err as Error).message);
}
},
);
In test/<topic>.test.ts:
import { describe, it, expect } from "vitest";
import { doSomething } from "../src/core/<topic>.js";
describe("doSomething", () => {
it("does the happy path", async () => {
const r = await doSomething({ /* ... */ });
expect(r).toMatchObject({ /* ... */ });
});
it("rejects bad input", async () => {
await expect(doSomething({ /* ... */ })).rejects.toThrow(/expected/);
});
});
Once registered, you can test end-to-end without restarting Claude Code:
printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"t","version":"1.0"}}}' \
'{"jsonrpc":"2.0","method":"notifications/initialized","params":{}}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"do_something","arguments":{"foo":"bar"}}}' \
| node dist/index.js
基于 SOC 职业分类