Skip to content

Commit 425ecdd

Browse files
author
deepinfect
committed
feat: add skills panel component and related functionality
- Introduced SkillsPanel.vue to display and manage user skills. - Implemented useSkillsData composable for managing skills state and interactions. - Added useSlashMentionData composable to handle slash mention functionality for skills, prompts, and tools. - Updated MentionList.vue to support new categorization and display logic for skills and prompts. - Created SlashMention extension for TipTap editor to handle slash-triggered mentions. - Enhanced slashSuggestion.ts to manage slash mention data and filtering. - Updated i18n files for English and Chinese to include new skills-related translations. - Added new events for skill activation and deactivation. - Removed unused watchers and code related to tools and prompts from useMentionData.
1 parent bb7f2f1 commit 425ecdd

File tree

24 files changed

+2918
-209
lines changed

24 files changed

+2918
-209
lines changed
Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
# Skills 用户体验重设计 - 产品分析文档
2+
3+
> 文档版本: v1.0
4+
> 创建日期: 2025-01-11
5+
> 状态: 分析阶段
6+
7+
---
8+
9+
## 一、核心问题
10+
11+
**Skills 功能强大,但用户感知不到、不会用。**
12+
13+
| 问题 | 表现 | 影响程度 |
14+
|------|------|---------|
15+
| 对话界面零曝光 | 主界面无任何 Skills 入口,用户无法感知其存在 | ⚠️ 严重 |
16+
| 激活状态不可见 | 当前对话启用了哪些 Skills,用户无从得知 | ⚠️ 严重 |
17+
| 设置入口太深 | 设置窗口第 7 项,同步藏在下拉菜单里 | 中等 |
18+
| 与 MCP 关系模糊 | MCP 默认关闭,但 Skills 同步依赖 MCP 生态 | 中等 |
19+
20+
---
21+
22+
## 二、设计决策
23+
24+
### 决策 1: 触发符号分离
25+
26+
**`@` 用于引用,`/` 用于调用能力**
27+
28+
| 触发符 | 语义 | 包含内容 |
29+
|--------|------|---------|
30+
| `@` | 引用上下文 | context、files、resources、workspace files |
31+
| `/` | 调用能力 | **skills**、prompts、tools |
32+
33+
**理由**: `@` 在社交产品中用于"提及",`/` 在 CLI/Slack 中用于"命令",语义更清晰。
34+
35+
### 决策 2: 取消二级菜单
36+
37+
**无论 `@` 还是 `/`,直接匹配全量内容,不再需要先选类别**
38+
39+
- 减少点击次数,提高效率
40+
- 用户通常已知要找什么,直接输入更快
41+
- 通过图标区分类别,不影响识别
42+
43+
### 决策 3: 输入框增加 Skills 状态入口
44+
45+
**在工具栏增加 Skills 指示器,展示当前激活状态**
46+
47+
```
48+
┌──────────────────────────────────────────────────────────────────┐
49+
│ [Mode ▾] [📁] [📎] [🌐] [MCP ▾] [✨ 2] [Model ▾] [⚙️] [↑]│
50+
│ ↑ │
51+
│ Skills 指示器,点击展开面板 │
52+
└──────────────────────────────────────────────────────────────────┘
53+
```
54+
55+
### 决策 4: 优化同步流程与状态展示
56+
57+
- 检测到外部 AI 工具时,主动提示是否导入 skills
58+
- 设置页增加"同步状态"区域,展示各工具同步时间和 skill 数量
59+
- 同步入口从下拉菜单提升为独立区域
60+
61+
---
62+
63+
## 三、具体需求
64+
65+
### 3.1 输入框内
66+
67+
| 需求 | 描述 | 优先级 |
68+
|------|------|--------|
69+
| `/` 触发 Skills 选择 | 输入 `/` 显示 skills + prompts + tools 列表 | P0 |
70+
| 扁平化列表 | `@``/` 都直接显示匹配结果,无二级菜单 | P0 |
71+
| 模糊搜索 | 根据输入实时过滤匹配项 | P0 |
72+
| 类别图标 | 用图标区分(✨ skill / 💬 prompt / 🔧 tool) | P1 |
73+
74+
### 3.2 输入框外
75+
76+
| 需求 | 描述 | 优先级 |
77+
|------|------|--------|
78+
| Skills 指示器 | 工具栏显示当前激活 skills 数量 | P0 |
79+
| Skills 面板 | 点击指示器展开,显示激活/可用 skills | P0 |
80+
| 快速切换 | 面板内可直接激活/停用 skill | P1 |
81+
| 跳转管理 | 面板提供入口跳转到设置页 | P2 |
82+
83+
### 3.3 同步与引导
84+
85+
| 需求 | 描述 | 优先级 |
86+
|------|------|--------|
87+
| 首次导入引导 | 检测到外部工具时提示导入 | P1 |
88+
| 同步状态展示 | 设置页显示各工具同步时间和数量 | P1 |
89+
| MCP 依赖提示 | 激活依赖 MCP 的 skill 时提示启用 | P2 |
90+
91+
---
92+
93+
## 四、交互示意
94+
95+
### 4.1 `/` 触发交互
96+
97+
```
98+
用户输入: /
99+
┌─────────────────────────────────────────────┐
100+
│ ✨ commit 生成规范的 Git 提交信息 │
101+
│ ✨ review 代码审查助手 │
102+
│ 💬 summarize 总结内容 (prompt) │
103+
│ 🔧 web_search 搜索网页 (tool) │
104+
└─────────────────────────────────────────────┘
105+
106+
用户输入: /rev
107+
┌─────────────────────────────────────────────┐
108+
│ ✨ review 代码审查助手 │
109+
└─────────────────────────────────────────────┘
110+
```
111+
112+
### 4.2 Skills 面板
113+
114+
```
115+
点击 [✨ 2] 后:
116+
┌─────────────────────────────────────┐
117+
│ ✨ Active Skills [管理] │
118+
├─────────────────────────────────────┤
119+
│ ● commit 生成提交信息 [✕] │
120+
│ ● review 代码审查 [✕] │
121+
├─────────────────────────────────────┤
122+
│ ○ explain 解释代码 [+] │
123+
│ ○ refactor 重构建议 [+] │
124+
└─────────────────────────────────────┘
125+
```
126+
127+
### 4.3 设置页同步状态
128+
129+
```
130+
┌─────────────────────────────────────────────────────────────┐
131+
│ 同步状态 │
132+
├─────────────────────────────────────────────────────────────┤
133+
│ 🔵 Claude Code 12 skills 上次: 2小时前 [同步] │
134+
│ 🟢 Cursor 5 skills 上次: 1天前 [同步] │
135+
│ ⚪ Copilot 未连接 [设置连接] │
136+
└─────────────────────────────────────────────────────────────┘
137+
```
138+
139+
---
140+
141+
## 五、待确认事项
142+
143+
| 问题 | 选项 | 建议 |
144+
|------|------|------|
145+
| `/` 列表排序 | A) Skills 优先 B) 按使用频率 C) 按字母 | A |
146+
| 自动同步 | A) 支持后台自动 B) 仅手动 | 待讨论 |
147+
| 同名冲突 | A) 覆盖 B) 重命名 C) 让用户选择 | C |
148+
149+
---
150+
151+
## 附录 A: 现状调研
152+
153+
### A.1 界面结构
154+
155+
主界面仅有侧边栏(Chat/设置)和对话区域。输入框支持 @ 提及 (context/files/resources/tools/prompts),但没有 Skills 相关入口。
156+
157+
### A.2 设置窗口导航
158+
159+
Skills 位于第 7 位(共 12 项):通用 → 显示 → 模型 → MCP → MCP市场 → ACP → **Skills** → 提示词 → 知识库 → 数据 → 快捷键 → 关于
160+
161+
### A.3 当前 @ 提及系统
162+
163+
位置: `src/renderer/src/components/editor/mention/suggestion.ts`
164+
165+
采用二级菜单:先选类别 → 再选具体项。类别包括 context/files/resources/tools/prompts,**不包含 skills**
166+
167+
### A.4 Skills 同步入口
168+
169+
位置: `src/renderer/settings/components/skills/SkillsHeader.vue`
170+
171+
同步隐藏在右上角下拉菜单: `[同步 ▾] → 导入 / 导出`
172+
173+
### A.5 AI 工具调用
174+
175+
AI 可通过 `skill_list``skill_control` 工具管理 Skills,但用户不可见。
176+
177+
### A.6 支持同步的 12 个外部工具
178+
179+
**用户级**: Claude Code、Cursor、OpenCode、Goose、Kilo Code、GitHub Copilot
180+
181+
**项目级**: Cursor、Windsurf、GitHub Copilot、Kiro、Antigravity、Codex
182+
183+
---
184+
185+
## 附录 B: 代码改动范围
186+
187+
### B.1 输入框
188+
189+
| 文件 | 改动 |
190+
|------|------|
191+
| `src/renderer/src/components/editor/mention/suggestion.ts` | 拆分 @ 和 / 逻辑 |
192+
| `src/renderer/src/components/editor/mention/MentionList.vue` | 扁平化 UI |
193+
| `src/renderer/src/components/chat-input/ChatInput.vue` | 增加 Skills 指示器 |
194+
| 新增 `SkillsIndicator.vue` / `SkillsPanel.vue` | Skills 组件 |
195+
196+
### B.2 状态管理
197+
198+
| 文件 | 改动 |
199+
|------|------|
200+
| 新增 `src/renderer/src/stores/skillsActiveStore.ts` | 对话级 skills 状态 |
201+
202+
### B.3 设置页
203+
204+
| 文件 | 改动 |
205+
|------|------|
206+
| `src/renderer/settings/components/skills/SkillsSettings.vue` | 同步状态区 |
207+
| 新增 `SyncStatusCard.vue` | 同步状态卡片 |
208+
209+
---
210+
211+
## 附录 C: 关键文件索引
212+
213+
| 模块 | 路径 |
214+
|------|------|
215+
| Skills 核心 | `src/main/presenter/skillPresenter/index.ts` |
216+
| Skills 同步 | `src/main/presenter/skillSyncPresenter/index.ts` |
217+
| Skills 设置页 | `src/renderer/settings/components/skills/SkillsSettings.vue` |
218+
| 输入框 | `src/renderer/src/components/chat-input/ChatInput.vue` |
219+
| @ 提及 | `src/renderer/src/components/editor/mention/suggestion.ts` |
220+
| 类型定义 | `src/shared/types/skill.ts` |

0 commit comments

Comments
 (0)