setup-tool 是做什么的?
End-to-end installation of a ready-made tool, up to generating a Word manual.
Workflow (7 Steps)
1. Confirm Tool Identity (Confirm Before Installing to Avoid Wrong Installation)
The tool name/URL provided by the user might be incorrect or inaccurate. First, search using gh and display all candidates for the user to choose from (fall back to web search if gh is not available):
gh search repos "<name>" --json fullName,description,stargazersCount,pushedAt --limit 20
You must present the complete search results to the user (as a table sorted by stars), even if there are 10+ candidates. Wait for the user to choose before deciding whether to read the README or perform secondary filtering.
After confirming the user's chosen target, first read the key files in the repository to infer the author-recommended installation type, then present a suggestion to the user:
Read Priority:
README.md— Check the Installation / Getting Started / Usage sectionsSKILL.md(if present) — Check frontmattername/descriptionand file locationpackage.json/pyproject.toml/Cargo.toml— Checkbin/scripts/entry_pointsmarketplace.json/claude.json/plugin.json(if present)- GitHub Releases resource names —
.exe/.dmg/.AppImage/ suffix-less binary
Type Inference Rules:
| Author Intent Signal | Recommended Type |
|---|---|
Root directory has SKILL.md, repository name/organization contains skill / claude-skills | skill |
Has marketplace.json / plugin.json, or repository contains claude-plugin / plugin | plugin |
README mentions "MCP server" / mcp- prefix / src/server.ts / stdio transport | MCP |
package.json has bin field / pipx install / uv tool install / npm install -g | CLI |
| GitHub Releases provide executable files, README says "download binary" | binary |
Provides .dmg / .exe / .AppImage / desktop GUI screenshots | desktop app |
Output Format:
Author-Recommended Type: <type>
Reason: <based on which README sentence / which file structure>
Alternatives: <if there are 1-2 other reasonable installation methods, briefly list them>
Then ask the user: Do you want to use the recommended type? (one of 5 + 1 types: skill / plugin / MCP / CLI / binary / desktop app) + Global or not?
The manual is generated by default; do not ask. Unless the user explicitly says "no manual," step 6 will proceed as usual.
Principle: Author recommendation takes priority; if the author has provided multiple usage methods (e.g., both CLI and MCP), follow the table order and take the first one, explaining the reasoning.
Pre-Installation Confirmation Guardrails: The following file-system modifying actions must explicitly ask the user for confirmation before proceeding. Do not act on "reasonable" assumptions:
| Action Type | Example | Decision Point |
|---|---|---|
Write/copy to ~/.claude/skills/ or ~/.claude/plugins/ | Copy repo, construct marketplace.json | Proceed only after user approval |
| Delete user files | rm installed, mv to trash as fallback | Requires explicit user "delete" command |
| Modify content of installed skills | Trim plugin, add disable-model-invocation | Same as above |
| Construct auxiliary configs | marketplace.json, hook, enabledPlugins | Must inform user of location and contents |
Non-disk actions (searching/reading files/checking help/drafting plans) can be done freely, but if the plan involves any of the above actions, use AskUserQuestion or text to ask clearly; do not execute until the user explicitly agrees.
2. System Comparison and Installation Recommendation (Mandatory After Confirming Download Target)
⚠ Trigger Condition: This step is mandatory after the user has confirmed a specific repository/URL in Step 1, and is not limited to skills/plugins. All types (skill / plugin / MCP / CLI / binary / desktop app) must be compared against the existing system before recommending installation.
Note: This step is not executed during the candidate search phase. In the first half of Step 1, only display the
gh searchcandidate list for the user to choose from; once the user has chosen a specific target, then proceed to this step for system comparison.
STOP: Before the following "System Comparison Results" are presented to the user and their explicit response is received, it is forbidden to execute any installation commands (including but not limited to git clone, npx skills add, claude plugin install, claude plugin marketplace add, claude mcp add, npm i -g, uv tool install, pipx install, gh release download, running .exe/.dmg/.AppImage, etc.). If the user attempts to skip, you must reiterate this step.
Purpose: To avoid "discovering after installation that the tool overlaps/conflicts/is redundant with existing tools." Compare first, then give a clear recommendation, and proceed to Step 3 only after the user agrees.
Scan Scope:
- Global skills:
~/.claude/skills/*SKILL.mdname / description / trigger words - Project-level skills: Current project
.claude/skills/* - Plugins:
claude plugin listoutput - MCP:
claude mcp listregistered servers - CLI / binary: Common installation locations +
which <cmd>/where <cmd>(Windows) + historical records ininstalled-tools.jsonunder this skill's directory (skip if not used before) - Workflows: Project
.claude/workflows/,~/.claude/workflows/, and global workflow scripts - Memory (optional): If you have installed a memory-related MCP or note-taking system, search for historical installation/evaluation records of this tool; skip this item if not available
Automation Assistance:
For overlap scanning of sub-skills under skill/plugin types, first run (requires bash environment; Windows use Git Bash):
bash ~/.claude/skills/setup-tool/references/scan-existing-skills.sh --query "<tool-name>"
Perform keyword overlap analysis between the output and the target tool's description / trigger words. Then merge results from other sources (MCP / CLI / workflow / memory) into the table below.
Comparison Dimensions:
| Dimension | What to Check | Judgment Criteria |
|---|---|---|
| Name Level | Whether the target tool name / sub-skill name duplicates an existing installed name | Duplicate = High Conflict (CC routing unpredictable) |
| Trigger Word Level | Whether the target description / triggers overlap with existing skill keywords | Sharing "brainstorm" / "writing" / "review" / "complete" etc. = Medium Conflict |
| Functional Level | Which category the target's core capability belongs to | Same category + high overlap = True Conflict; same category + low overlap = Complementary; different category = Irrelevant |
| Dependency Level | Whether it depends on the same backend (same MCP server / same CLI / same API key) | Already installed = Shareable; not installed = New maintenance cost |
| History Level | Whether memory indicates it was installed and uninstalled before, or evaluated as "don't introduce" | Negative record = Suggest waiting |
Output Format:
System Comparison Results:
- Already installed similar/overlapping: List names + overlap points
- Already installed complementary: List existing tools that can be used in combination
- Conflict Rating: High / Medium / Low / None
- Recommendation: Install / Don't Install / Wait / Use existing X instead / Install but disable some sub-components
- Reason: One sentence
The recommendation must be explicit, not vague. For example:
- "Recommend not installing: Functionality completely overlaps with X, and X is verified stable."
- "Recommend installing but only expose the entry skill: Plugin sub-skills conflict with Y trigger words."
- "Recommend installing: Complementary to existing A/B, no conflicts."
- "Recommend waiting: Memory shows the same type was evaluated in 2026-06 and decided not to introduce."
Record the Decision:
Write the comparison result into installed-tools.json under this skill's directory (the script will create it automatically; this file is a personal decision record, do not upload or commit). You can write it manually or run the helper script:
python ~/.claude/skills/setup-tool/scripts/log_decision.py \
--tool "<tool-name>" \
--source "<owner/repo or installation source>" \
--rating "<High/Medium/Low/None>" \
--recommendation "<Install/Don't Install/Wait/Use existing X instead/Install but disable some sub-components>" \
--conflicts "<overlap-item1, overlap-item2>" \
--complements "<complementary-item1>" \
--user-confirmed
Each entry structure (installed-tools.json is an array):
{
"tool": "Tool Name",
"source": "owner/repo or installation source",
"decided_at": "2026-07-16T16:34:00",
"comparison": {
"conflicts": ["overlap-item1", "overlap-item2"],
"complements": ["complementary-item1"],
"rating": "High/Medium/Low/None",
"recommendation": "Install/Don't Install/Wait/Use existing X instead/Install but disable some sub-components"
},
"user_confirmed": true
}
User Decision: After listing the comparison results and recommendations, ask the user to confirm using text or AskUserQuestion. Do not proceed to Step 3 until the user explicitly agrees.
Pitfall: It is better to have a long list than to miss a comparison — hasty assessments of "basically no conflict" and misjudgments of "name collision" will damage user trust.
3. Type-Routed Installation
Check references/install-routes.md for the installation commands, proxy requirements, verification methods, and related pitfalls for that type (consolidated in docs/gotchas.md). If your network has restricted access to GitHub, set the proxy environment variables first (replace the port with your own proxy port; the example uses Clash's default 7890):
export HTTPS_PROXY=http://127.0.0.1:7890
export HTTP_PROXY=http://127.0.0.1:7890
4. Verification (Don't Just Trust "It's Installed")
Perform practical verification according to the method for the type:
- skill:
test -s ~/.claude/skills/<name>/SKILL.md - MCP:
claude mcp list+ Restart CC (MCP must be restarted after installation/modification to load; seedocs/gotchas.md) - CLI:
<cmd> --version - binary:
<binary> --version
For skill type, also detect multi-skill packages: ls ~/.claude/skills/ | grep <name> to see how many sub-skills were installed.
Additional Verification for Plugin Type (successful plugin install ≠ usable):
claude plugin list 2>&1 | grep -B1 -A6 "<plugin-name>"
# Check:
# (1) Status: ✔ enabled
# (2) If there is red text "Error: Hook load failed" / "✘" warning below
# (3) Scope is correct (user / project / local)
ls <installPath>/ # Typically ~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/
ls <installPath>/skills/ 2>/dev/null | wc -l # Number of nested sub-skills
Nested SKILL.md Pitfall: In plugin form, the root SKILL.md is the entry point, but nested SKILL.md files under the repo's skills/ directory might also be loaded by CC as top-level. Count the skills first and confirm they match expectations (plugin list component inventory).
5. Description Localization (Skill / Plugin Only, Triggered for English)
Trigger Condition: Type is
skillorplugin, and the installedSKILL.mdfrontmatterdescriptionfield is primarily in English.
Purpose: Tools using / slash commands will appear in CC's command menu/auto-routing. A Chinese description is more user-friendly for Chinese-speaking users.
Execution:
- Read the frontmatter
descriptionof the installed rootSKILL.md. - Determine if it is English (simple heuristic: Chinese character ratio < 20% is considered English).
- If it is English, ask the user: "The tool description is in English: ''. Would you like it translated to Chinese?"
- If the user agrees, translate the
descriptioninto accurate, concise Chinese. Only change the description; do not modify other frontmatter fields or the body. - For multi-skill packages, check each sub-SKILL.md similarly; when asking, state "The main skill + N sub-skills have English descriptions."
- Save the changes and re-verify that the skill is still loaded correctly by CC (
claude plugin list/ test/<name>trigger).
Guardrail: This step modifies already installed skill content. It may only be executed if the user explicitly says "agree/change." If the user refuses or times out, skip it and proceed directly to Step 6.
6. Generate Word Manual
Call scripts/gen_tool_manual.py, passing tool metadata (JSON file or command-line arguments). Read the metadata from SKILL.md frontmatter / README; do not fabricate it.
Multi-Skill Package Handling: If the tool contains multiple sub-skills (e.g., a plugin's skills/ directory contains multiple SKILL.md files, or a skill package expands into multiple sub-directories), you must read each sub-SKILL.md individually, extracting its name, description, trigger words, and functional description. The manual must provide a separate functional description for each sub-skill; do not only write the root entry skill.
Required Fields (the script will enforce or auto-derive them):
name— Tool name (determines the output filename)triggers.slash— Slash command list, must include the main command/<name>; if missing, the script will auto-derive it fromname(e.g.,name="video-downloader"→ auto-add"/video-downloader")triggers.spoken— Spoken trigger words (for auto-routing)function_desc— Overall tool function description; for multi-skill packages, also summarize each sub-skill's capabilitiessub_skills— Required for multi-skill packages: A list of{name, description, triggers}for each sub-skillinstall_location/upgrade/uninstall— Where installed / upgrade command / uninstall command
Optional Fields (categorized by priority to give the manual focus):
must_know— List, rendered as a red ❗ box (must-see warnings/pitfalls)ref_quick— List, rendered as a yellow 📋 box (quick reference/common commands)info— List, rendered as a blue 💡 box (background info / why designed this way)
{
"name": "video-downloader",
"function_desc": "Downloads content from mainstream video sites; multiple sub-skills handle search, download, and transcoding respectively",
"sub_skills": [
{"name": "video-downloader-search", "description": "Search for video sources by keyword", "triggers": ["/video-downloader-search", "search video"]},
{"name": "video-downloader-download", "description": "Execute download and select quality", "triggers": ["/video-downloader-download", "download video"]},
{"name": "video-downloader-convert", "description": "Transcode to mp3/mp4 after download", "triggers": ["/video-downloader-convert", "convert video"]}
],
"must_know": ["Some platforms do not support direct download; use the official client to cache first"],
"ref_quick": ["env VIDEO_DOWNLOADER_OUTPUT_DIR=~/downloads"],
"info": ["Can be used with note-taking tools for content archiving"]
}
Default output: ~/Tool Manuals/<tool-name>.docx (for multiple tools: <tool1>-<tool2>.docx; can be overridden with environment variable SETUP_TOOL_MANUAL_DIR or --out-dir). Verification: PYTHONIOENCODING=utf-8 python -c "from docx import Document; ..." read back to confirm the number of sections and CJK text is correct (CJK font settings and other pitfalls are documented in docs/gotchas.md).
7. Report
Output: Tool installation location + manual path + verification results. If experience needs to be captured, remind the user to manually trigger their own experience capture process.
Key Constraints
- Confirm before installing: If the tool name/URL is unclear, search first; do not guess (a wrong name can lead to repeated failed installations and hours of troubleshooting).
- Use proxy for GitHub operations when network is restricted:
git clone/gh release download/npx skills addmight fail without a proxy. - Always verify: Don't rely on "no errors during installation"; test practically according to the type.
- Read trigger information for manual from SKILL.md/README; do not fabricate it.
- Do not commit: Neither skill files nor manuals should be committed.