pattern-toggling-package-extension-tools
БесплатноБез исполняемых скриптовНе проверенUse when a Pi extension must enable or disable tools that come from another installed extension or package, especially when the tool definitions should…
от l-lin★ 17 звёзд на GitHubОб этом скилле
Toggling Package Extension Tools
Overview
Use Pi's active tool list as the switch. It removes the target tool definitions from later prompts, but leaves the package loaded.
Pattern
- Persist your own enabled flag. Do not try to mutate the upstream package.
- Call
pi.getAllTools()and collect names whosesourceInfo.sourcematches the package, for examplenpm:pi-mcp-adapter. - On
session_start, apply the saved state withpi.setActiveTools(...). The prompt is built from the active tool list, so waiting until later is too late. - When disabling, remove only the matching tool names.
- When re-enabling, merge the matching tool names back in without dropping other active tools or adding duplicates.
- If footer or widget state depends on the toggle, emit a companion event such as
mcp-adapter:state-changed.
What This Does Not Do
This does not unload the package. Its commands, runtime initialization, or status handlers may still run. It only removes tools from the active prompt surface.
Minimal Example
const source = "npm:pi-mcp-adapter";
function getPackageToolNames(pi: Pick<ExtensionAPI, "getAllTools">): string[] {
return pi
.getAllTools()
.filter((tool) => tool.sourceInfo.source === source)
.map((tool) => tool.name);
}
function applyEnabledState(
pi: Pick<
ExtensionAPI,
"getAllTools" | "getActiveTools" | "setActiveTools" | "events"
>,
enabled: boolean,
) {
const packageToolNames = getPackageToolNames(pi);
const current = pi.getActiveTools();
const packageTools = new Set(packageToolNames);
const next = enabled
? [...current, ...packageToolNames.filter((name) => !current.includes(name))]
: current.filter((name) => !packageTools.has(name));
pi.setActiveTools(next);
pi.events.emit("package-tools:state-changed", enabled);
}
Verify
- Saved disabled state removes the package tools on
session_start - Toggle off removes every matching tool
- Toggle on restores them
- Slash commands still work because
setActiveTools(...)only affects tools - Footer or widget state updates on the companion event
Установить pattern-toggling-package-extension-tools в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл pattern-toggling-package-extension-tools?
Use when a Pi extension must enable or disable tools that come from another installed extension or package, especially when the tool definitions should disappear from prompts without disabling slash commands or forking the upstream package.
Как установить скилл pattern-toggling-package-extension-tools?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pattern-toggling-package-extension-tools запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic