帮助开发者在重命名工具标识时保留兼容性,避免旧引用失效。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "tool-rename-deprecation" 技能: 1. 下载 https://raw.githubusercontent.com/microsoft/vscode/main/.github/skills/tool-rename-deprecation/SKILL.md 2. 保存为 ~/.claude/skills/tool-rename-deprecation/SKILL.md 3. 装好后重载技能,告诉我可以用了
我把一个内置工具的 toolReferenceName 从 old.fetch 改成了 new.fetch。请检查注册代码,确保补充 legacyToolReferenceFullNames,并说明还需要同步更新哪些兼容性配置。
返回兼容性检查结果,指出是否已保留旧名称映射,并列出需要修改的注册项。
我们准备把工具集 referenceName 从 core-tools 改为 platform-tools。请审查相关代码,确认 legacyFullNames 是否正确配置,并列出所有可能受影响的旧引用。
输出工具集重命名审查建议,包括兼容字段配置和潜在破坏性变更风险。
请对这次工具注册代码改动做一次审计,只要涉及工具名称、工具集名称或其他标识符变更,就检查是否保留了向后兼容,并给出修复建议。
给出一份审计结论,标明发现的重命名点、兼容性缺失项和建议修复方案。
When a tool or tool set reference name is changed, the old name must always be added to the deprecated/legacy array so that existing prompt files, tool configurations, and saved references continue to resolve correctly.
Run this skill on any change to built-in tool or tool set registration code to catch regressions:
toolReferenceNamereferenceNametoolSet/toolName path becomes a legacy name)Determine whether you are renaming a tool or a tool set, and where it is registered:
| Entity | Registration | Name field to rename | Legacy array | Stable ID (NEVER change) |
|---|---|---|---|---|
Tool (IToolData) |
| TypeScript |
toolReferenceName |
legacyToolReferenceFullNames |
id |
| Tool (extension) | package.json languageModelTools | toolReferenceName | legacyToolReferenceFullNames | name (becomes id) |
Tool set (IToolSet) | TypeScript | referenceName | legacyFullNames | id |
| Tool set (extension) | package.json languageModelToolSets | name or referenceName | legacyFullNames | — |
Critical: For extension-contributed tools, the name field in package.json is mapped to id on IToolData (see languageModelToolsContribution.ts line id: rawTool.name). It is also used for activation events (onLanguageModelTool:<name>). Never rename the name field — only rename toolReferenceName.
Verify the old toolReferenceName value appears in legacyToolReferenceFullNames. Don't assume it's already there — check the actual array contents. If the old name is already listed (e.g., from a previous rename), confirm it wasn't removed. If it's not there, add it.
For internal/built-in tools (TypeScript IToolData):
// Before rename
export const MyToolData: IToolData = {
id: 'myExtension.myTool',
toolReferenceName: 'oldName',
// ...
};
// After rename — old name preserved
export const MyToolData: IToolData = {
id: 'myExtension.myTool',
toolReferenceName: 'newName',
legacyToolReferenceFullNames: ['oldName'],
// ...
};
If the tool previously lived inside a tool set, use the full toolSet/toolName form:
legacyToolReferenceFullNames: ['oldToolSet/oldToolName'],
If renaming multiple times, accumulate all prior names — never remove existing entries:
legacyToolReferenceFullNames: ['firstOldName', 'secondOldName'],
For tool sets, add the old name to the legacyFullNames option when calling createToolSet:
toolsService.createToolSet(source, id, 'newSetName', {
legacyFullNames: ['oldSetName'],
});
For extension-contributed tools (package.json), rename only toolReferenceName and add the old value to legacyToolReferenceFullNames. Do NOT rename the name field:
// CORRECT — only toolReferenceName changes, name stays stable
{
"name": "copilot_myTool", // ← KEEP this unchanged
"toolReferenceName": "newName", // ← renamed
"legacyToolReferenceFullNames": [
"oldName" // ← old toolReferenceName preserved
]
}
Legacy names must be respected everywhere a tool is looked up by reference name, not just in prompt resolution. Key consumers:
getDeprecatedFullReferenceNames() maps old → current names for .prompt.md validation and code actionsgetToolAliases() / getToolSetAliases() yield legacy names so tool picker and enablement maps resolve them…