Skip to content

Commit ca27e9a

Browse files
invalidclaude
andcommitted
refactor: add codemap- prefix to skill names for namespace isolation
Rename skill directories and frontmatter names: scan → codemap-scan, load → codemap-load, update → codemap-update, query → codemap-query, impact → codemap-impact Keeps auto-triggering capability while avoiding name collisions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 80d29f1 commit ca27e9a

7 files changed

Lines changed: 29 additions & 66 deletions

File tree

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,12 @@ CodeMap/
175175
├── ccplugin/ # 插件根目录 (CLAUDE_PLUGIN_ROOT)
176176
│ ├── .claude-plugin/
177177
│ │ └── plugin.json # 插件清单 / Plugin manifest
178-
│ ├── skills/ # Claude Code Skills (自动触发)
179-
│ │ ├── scan/SKILL.md # /scan - 全量扫描
180-
│ │ ├── load/SKILL.md # /load - 智能加载
181-
│ │ ├── update/SKILL.md # /update - 增量更新
182-
│ │ ├── query/SKILL.md # /query - 符号查询
183-
│ │ └── impact/SKILL.md # /impact - 影响分析
178+
│ ├── skills/ # Claude Code Skills (自动触发)
179+
│ │ ├── codemap-scan/SKILL.md # 全量扫描
180+
│ │ ├── codemap-load/SKILL.md # 智能加载
181+
│ │ ├── codemap-update/SKILL.md # 增量更新
182+
│ │ ├── codemap-query/SKILL.md # 符号查询
183+
│ │ └── codemap-impact/SKILL.md # 影响分析
184184
│ └── cli/ # CLI 工具
185185
│ ├── bin/codegraph.js # 入口 / Entry point
186186
│ ├── src/ # 源码 / Source
@@ -250,11 +250,11 @@ When installed as a Claude Code plugin, these skills auto-trigger based on conve
250250

251251
| Skill | 触发词 / Triggers On |
252252
|-------|------------|
253-
| `/scan` | "扫描", "索引", "scan", "index", "map codebase" |
254-
| `/load` | "加载图谱", "项目结构", "load", "code structure" |
255-
| `/update` | "更新图谱", "refresh", "代码改了" |
256-
| `/query` | "查找", "谁调用了", "where is", "find function" |
257-
| `/impact` | "影响范围", "refactor impact", "change impact" |
253+
| `codemap-scan` | "扫描", "索引", "scan", "index", "map codebase" |
254+
| `codemap-load` | "加载图谱", "项目结构", "load", "code structure" |
255+
| `codemap-update` | "更新图谱", "refresh", "代码改了" |
256+
| `codemap-query` | "查找", "谁调用了", "where is", "find function" |
257+
| `codemap-impact` | "影响范围", "refactor impact", "change impact" |
258258

259259
### 典型工作流 / Typical Workflow
260260

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: impact
2+
name: codemap-impact
33
description: >
44
Use when the user wants to know the impact of changing a file or module,
55
when planning refactoring, or when assessing risk of a code change.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: load
2+
name: codemap-load
33
description: >
44
Use when starting work on a project that has a .codemap/ directory, when the user
55
asks about project structure or architecture, when the user wants to understand
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: query
2+
name: codemap-query
33
description: >
44
Use when the user asks about a specific function, class, type, or module
55
in a project that has .codemap/.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: scan
2+
name: codemap-scan
33
description: >
44
Use when the user wants to scan or index a project codebase, when .codemap/ directory
55
does not exist, when starting work on a new project for the first time, or when
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: update
2+
name: codemap-update
33
description: >
44
Use after code has been modified, after git commits, when the code graph
55
might be outdated, or when the user says "更新图谱", "同步", "refresh",

docs/plan/2026-02-20-rust-cli-rewrite.md

Lines changed: 13 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -143,64 +143,27 @@ ignore = "0.4" # .gitignore 支持
143143
- 将预编译二进制放入 ccplugin/bin/
144144
- 最终验证插件安装流程
145145

146-
## 待办:Skills → Commands + Hook 迁移
146+
## 已完成:Skill 命名空间隔离
147147

148148
### 问题
149149

150-
当前 5 个功能(scan、load、update、query、impact)全部实现为 skills。存在以下问题:
151-
- 名称冲突风险:`scan``load``update``query` 过于通用,可能与其他插件冲突
152-
- 误触发:skill 根据 description 关键词自动激活,"扫描"、"查找"、"更新" 在日常对话中极其常见,可能在无关上下文中触发
153-
- 不可控:用户讨论非 CodeMap 相关的 scan/query 时也可能被激活
150+
原 skill 名称(scan、load、update、query、impact)过于通用,可能与其他插件冲突或在无关对话中误触发。
154151

155-
### 方案:Commands + Hook 混合模式
152+
### 方案(已实施)
156153

157-
**Commands(明确操作):**
154+
保留 skills 自动触发能力,通过 `codemap-` 前缀实现命名空间隔离:
158155

159-
将 5 个 skill 转为 commands,获得 `codemap:` 命名空间隔离:
156+
| 原名 | 新名 |
157+
|------|------|
158+
| `scan` | `codemap-scan` |
159+
| `load` | `codemap-load` |
160+
| `update` | `codemap-update` |
161+
| `query` | `codemap-query` |
162+
| `impact` | `codemap-impact` |
160163

161-
| 当前 (skill) | 迁移后 (command) | 说明 |
162-
|-------------|-----------------|------|
163-
| `/scan` | `/codemap:scan` | 全量扫描 |
164-
| `/load` | `/codemap:load` | 加载图谱 |
165-
| `/update` | `/codemap:update` | 增量更新 |
166-
| `/query` | `/codemap:query` | 符号查询 |
167-
| `/impact` | `/codemap:impact` | 影响分析 |
164+
### 待办:SessionStart Hook
168165

169-
文件变更:`ccplugin/skills/*/SKILL.md``ccplugin/commands/*.md`,调整 frontmatter 格式。
170-
171-
**Hook(自动触发):**
172-
173-
添加 `SessionStart` hook 实现自动上下文恢复:
174-
175-
```json
176-
{
177-
"hooks": {
178-
"SessionStart": [{
179-
"hooks": [{
180-
"type": "command",
181-
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/session-start.sh\"",
182-
"timeout": 10,
183-
"statusMessage": "CodeMap: 检测项目图谱..."
184-
}]
185-
}]
186-
}
187-
}
188-
```
189-
190-
`session-start.sh` 逻辑:
191-
1. 检测当前工作目录是否存在 `.codemap/graph.json`
192-
2. 如果存在 → 输出提示信息,建议用户使用 `/codemap:load` 加载图谱
193-
3. 如果不存在 → 静默退出,不干扰用户
194-
195-
这样既实现了自动触发(提示用户图谱可用),又避免了 skill 误触发的问题。
196-
197-
### 迁移状态
198-
199-
- [ ] 将 5 个 skills 转为 commands
200-
- [ ] 创建 SessionStart hook 脚本
201-
- [ ] 创建 hooks/hooks.json
202-
- [ ] 更新 README 中的 skill 相关文档
203-
- [ ] 测试安装验证
166+
后续可添加 `SessionStart` hook 实现会话启动时自动检测 `.codemap/` 并提示加载。
204167

205168
---
206169

0 commit comments

Comments
 (0)