# 安装安全分析

安装（`loom install`）将 skills 和 commands 写入用户目录。本文分析其安全模型。

## 安装位置

| 工具        | 目标用户目录                       | 写入内容                  |
| ----------- | ---------------------------------- | ------------------------- |
| Claude Code | Claude Code plugin marketplace     | plugin 注册               |
| OpenCode    | `~/.config/opencode/commands/`     | command `.md` 文件        |
| OpenCode    | `~/.config/opencode/opencode.json` | npm plugin 配置           |
| Cursor      | `~/.cursor/rules/`                 | `.mdc` 规则文件           |
| Copilot     | `~/.copilot/skills/`               | skills 子目录             |
| Copilot     | `~/.copilot/instructions/`         | command `.md` 文件        |
| Copilot     | `~/.copilot/`                      | `copilot-instructions.md` |
| Copilot     | 当前仓库 `.github/`                | `copilot-instructions.md` |
| Copilot     | 当前仓库 `.github/workflows/`      | `copilot-setup-steps.yml` |
| Copilot     | 当前仓库 `.github/workflows/`      | `loom-verify.yml`         |
| Codex       | `~/.codex/skills/`                 | skills 子目录             |

## 写入规则

1. **只写 loom 管理的文件**：skills 目录只复制包含 `SKILL.md` 的子目录，commands 目录只复制 `.md` 文件
2. **不覆盖用户文件**：用户目录中已有但不属于 loom 的文件不受影响
3. **可审计**：`--dry-run` 预览完整写入列表

## 卸载安全模型

卸载时按需清理：

- skills：删除 loom 复制进去的每个子目录（通过查找 `SKILL.md` 标识）
- commands：删除 loom 复制进去的每个 `.md` 文件
- plugin 配置：恢复修改的 JSON 配置
- 不删除用户原有文件
- 用户级和仓库级 `copilot-instructions.md`、仓库级 `copilot-setup-steps.yml` 和 `loom-verify.yml` 仅在包含 `Generated by loom` 标记时才删除
