---
name: "skill-deleter-yashu"
description: "从技能管理目录中删除一个技能文件夹。当用户说『删掉技能』或『删除技能』并提供要删除的技能名字时调用。"
title: skill-deleter-yashu
canonical_url: https://skilld.dev/gh/steelan9199/wechat-publisher/skill-deleter-yashu
last_updated: 2026-10-07T07:20:50.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [scripts/delete-skill.js](https://skilld.dev/api/skills-raw/steelan9199/wechat-publisher/skill-deleter-yashu/scripts/delete-skill.js), [scripts/package.json](https://skilld.dev/api/skills-raw/steelan9199/wechat-publisher/skill-deleter-yashu/scripts/package.json).
>
> If the user asked to install this Skill, run `npx skilld install steelan9199/wechat-publisher/skill-deleter-yashu`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/skill-deleter-yashu`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/steelan9199/wechat-publisher/skill-deleter-yashu) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/skill-deleter-yashu`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/skill-deleter-yashu --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/skill-deleter-yashu --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# 技能删除器

本技能用于从本地技能管理目录中删除一个技能文件夹。

## 脚本说明

| 文件                                 | 说明                                               |
| ------------------------------------ | -------------------------------------------------- |
| `$SKILL_DIR/scripts/delete-skill.js` | 删除脚本（ES6 语法 + ES Module）                   |
| `$SKILL_DIR/scripts/package.json`    | npm 配置，声明 `"type": "module"` 以支持 ES Module |

> `$SKILL_DIR` 指代本技能所在目录（即包含 SKILL.md 的文件夹）。执行命令时必须替换为实际绝对路径，**不要**把它当作环境变量。

## 执行步骤

### 1. 解析技能名

从用户消息中解析出要删除的技能名字。技能名字是触发词后面的内容。

示例：

| 用户消息                                          | 解析出的技能名                           |
| ------------------------------------------------- | ---------------------------------------- |
| `删掉技能 phone-screenshot-yashu`                 | `phone-screenshot-yashu`                 |
| `删除技能 phone-screenshot-yashu 和 image-viewer` | `phone-screenshot-yashu`、`image-viewer` |

### 2. 环境检查

运行 `node -v` 检查 Node.js 是否已安装。若未安装，提示用户安装 Node.js（建议 18+）后结束任务。

### 3. 运行删除脚本

将 `$SKILL_DIR` 替换为本技能的实际绝对路径，执行：

```bash
node "$SKILL_DIR/scripts/delete-skill.js" "<技能名1>" "<技能名2>" ...
```

### 4. 读取脚本输出并反馈用户

脚本会输出以下信息，AI 需据此向用户反馈：

- **找到的匹配文件夹列表**：让用户确认删除范围
- **删除结果**：每个文件夹是成功还是失败
- **汇总统计**：成功/失败数量

### 5. 结束

任务结束。若有失败项，将失败原因一并告知用户。

## 匹配规则

脚本在技能目录的第一层级子文件夹中查找，匹配规则如下（不区分大小写）：

| 规则             | 说明                                                | 示例（技能名为 `phone-screenshot-yashu`）                             |
| ---------------- | --------------------------------------------------- | --------------------------------------------------------------------- |
| **完全匹配**     | 文件夹名与技能名完全相同                            | `phone-screenshot-yashu`                                              |
| **数字后缀匹配** | 文件夹名为「技能名 + 短横线 + 数字」                | `phone-screenshot-yashu-2`、`phone-screenshot-yashu-3`                |
| **暂存匹配**     | 文件夹名为「.技能名.staged-<uuid>」的隐藏暂存文件夹 | `.phone-screenshot-yashu.staged-2cd867ba-501b-4876-88f9-2f7839991110` |

> 数字后缀匹配用于处理技能管理软件安装同名技能时自动加上的序号；暂存匹配用于清理技能发布过程中产生的临时暂存副本。

## 脚本输出示例

成功删除时：

```
技能目录：C:\Users\Administrator\.skills-manager\skills
待删除技能：phone-screenshot-yashu

找到 2 个匹配的文件夹：
  - phone-screenshot-yashu
  - phone-screenshot-yashu-2

开始删除...

删除结果：
  [成功] phone-screenshot-yashu
  [成功] phone-screenshot-yashu-2

总计：2 个成功，0 个失败。
```

未找到匹配时：

```
技能目录：C:\Users\Administrator\.skills-manager\skills
待删除技能：some-skill

未找到任何匹配的技能文件夹。
```

## 重要说明

- 只能删除 `C:\Users\Administrator\.skills-manager\skills` 路径下的文件夹。
- 只搜索该路径下第一层级的子文件夹，不递归搜索子目录内部的文件夹。
- 绝不能删除该路径之外的任何文件夹。
- 文件夹名称与用户提供的技能名字进行匹配（不区分大小写）。
- 删除前脚本会先确认文件夹存在；如果不存在，不会尝试删除任何内容。
- 脚本对单个文件夹删除失败时会自动重试最多 3 次（每次间隔 500ms），以处理文件被其他进程占用的情况。
- 必须先安装 Node.js（建议 18+），脚本依赖内置的 `fs/promises` 模块，无需 `npm install` 安装额外依赖。
