@catcuts-skills/handover 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Agent Skill NPM Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # Handover Skill
2
+
3
+ 跨会话工作交接工具,支持 AI Agent 工作状态的保存与恢复。
4
+
5
+ ## 功能
6
+
7
+ - **导出模式**:保存当前会话的工作状态到本地存档
8
+ - **恢复模式**:从历史存档中恢复工作状态
9
+
10
+ ## 安装
11
+
12
+ ### 自动安装(推荐)
13
+
14
+ 安装本 npm 包时会自动将 skill 注册到 Claude Code:
15
+
16
+ ```bash
17
+ # 全局安装(默认)
18
+ npm install -g @catcheers/handover
19
+
20
+ # 项目级安装
21
+ SKILL_SCOPE=LOCAL npm install @catcheers/handover
22
+ ```
23
+
24
+ **环境变量 `SKILL_SCOPE`**:
25
+
26
+ - `GLOBAL`(默认): 安装到用户目录 `~/.claude/skills/handover`
27
+ - `LOCAL`: 安装到项目目录 `.claude/skills/handover`
28
+
29
+ ### 手动安装
30
+
31
+ 如果自动安装失败,可以手动运行:
32
+
33
+ ```bash
34
+ # 全局安装
35
+ npx add-skill . -a claude-code -g -y
36
+
37
+ # 项目级安装
38
+ npx add-skill . -a claude-code -y
39
+ ```
40
+
41
+ **支持平台**: 基于 [Vercel 开源的 add-skill](https://github.com/vercel-labs/add-skill),本技能支持 Opencode、Claude Code、Codex、Cursor 及其他 [19 个工具](https://github.com/vercel-labs/add-skill?tab=readme-ov-file#available-agents)。
42
+
43
+ ### 测试安装
44
+
45
+ 运行测试以验证安装配置(不会实际安装):
46
+
47
+ ```bash
48
+ npm test
49
+ ```
50
+
51
+ ### 卸载
52
+
53
+ ```bash
54
+ # 全局卸载
55
+ npm uninstall -g @catcheers/handover
56
+
57
+ # 项目级卸载
58
+ npm uninstall @catcheers/handover
59
+ ```
60
+
61
+ 卸载时会自动清理 skill 文件。
62
+
63
+ ## 使用
64
+
65
+ **导出工作状态:**
66
+
67
+ ```
68
+ 请帮我交接当前工作
69
+ ```
70
+
71
+ **恢复工作状态:**
72
+
73
+ ```
74
+ 请接手之前的 xx 工作
75
+ ```
76
+
77
+ ## 技术细节
78
+
79
+ - 存档保存在项目根目录的 `.handover/` 中
80
+ - 使用 Vercel 的 `add-skill` 工具进行安装管理
81
+
82
+ ### 安装路径
83
+
84
+ **全局安装 (SKILL_SCOPE=GLOBAL)**:
85
+
86
+ - 实际存储: `~/.agents/skills/handover/`
87
+ - Claude Code 链接: `~/.claude/skills/handover/` (符号链接)
88
+
89
+ **项目级安装 (SKILL_SCOPE=LOCAL)**:
90
+
91
+ - 实际存储: `.agents/skills/handover/`
92
+ - Claude Code 链接: `.claude/skills/handover/` (符号链接)
93
+
94
+ ### 系统要求
95
+
96
+ - Node.js >= 18.0.0
97
+
98
+ ## 开发
99
+
100
+ 本技能基于 [agent-skill-npm-boilerplate](https://github.com/catcuts/agent-skill-npm-boilerplate) 开发。
package/SKILL.md ADDED
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: handover
3
+ description: 跨会话工作交接工具。支持"归档当前进度"和"恢复历史进度"两个模式。使用场景:需要在新会话中恢复之前的工作、需要在多个设备间同步工作上下文、需要保存当前工作状态以便稍后继续。
4
+ allowed-tools: Read, Write, Bash
5
+ ---
6
+
7
+ # Handover Skill
8
+
9
+ ## 任务指令
10
+
11
+ 当你被调用时,请判断用户的意图:是"交接出去"还是"接手回来"。
12
+
13
+ ## 模式 1:导出 (Export)
14
+
15
+ 如果用户说"交接"或类似含义(例如"交接。要求如下:..."):
16
+
17
+ 1. **深度汇总**:分析当前会话,提取任务目标、已改代码、待办事项和核心逻辑,并形成一行简短的工作简述。
18
+
19
+ 2. **创建目录**:在 `.handover/` 下创建一个以第1步形成的"工作简述"命名的文件夹。
20
+
21
+ 3. **写入存档**:使用 `Write` 工具在第2步中创建的文件夹中生成 `HANDOVER.md`。
22
+
23
+ 4. **结束引导**:**必须**用在醒目的位置用醒目的样式在末尾输出以下文字:
24
+
25
+ ```
26
+ ✨ 存档已就绪 ✅
27
+
28
+ 现在你可以(二选一):
29
+ 1) 直接手动执行 `/clear` 释放内存,在新会话中对我说明 `接手当前工作` 或类似的提示即可恢复。
30
+ 2) 直接手动修改存档,或者通过与我对话的方式修改存档,直到满意为止,然后再执行 1) 操作。
31
+ ```
32
+
33
+ ## 模式 2:恢复 (Resume)
34
+
35
+ 如果用户输入"交接:接手"或类似含义(例如"交接:接手 xx 工作"):
36
+
37
+ 1. **列出存档**:使用 `Bash` 工具执行 `ls -d .handover/*/` 列出所有已归档的工作目录。
38
+
39
+ 2. **交互选择**:
40
+ - 如果有多个存档,以数字列表形式展示(例如:`1. 优化登录逻辑`, `2. 修复样式Bug`)。
41
+ - 如果用户有明确指出要接手的工作,在列表中用"🚩"标注最有可能要接手的存档。
42
+ - 询问用户:"请选择要接手的序号:已用 🚩 标记您最有可能要接手的存档。"
43
+ - 暂停等待用户选择后再继续。
44
+
45
+ 3. **读取并初始化**:
46
+ - 得到序号后,使用 `Read` 工具读取对应目录下的 `HANDOVER.md`。
47
+ - 告诉用户:"✨ 读取成功。我已定位到存档的状态,现在我们可以在该存档的基础上继续工作。"
48
+
49
+ ## 附加信息
50
+
51
+ 存档文件保存在项目根目录的 `.handover/` 中,该目录已在 .gitignore 中排除。
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@catcuts-skills/handover",
3
+ "version": "1.0.0",
4
+ "description": "跨会话工作交接工具。支持归档当前进度和恢复历史进度两个模式。",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "postinstall": "node scripts/install-skill.js",
8
+ "preuninstall": "node scripts/uninstall-skill.js",
9
+ "test": "node scripts/install-skill.js --dry-run",
10
+ "install:global": "node scripts/install-skill.js --global",
11
+ "install:local": "node scripts/install-skill.js --local",
12
+ "lint": "echo 'Add your linting commands here'"
13
+ },
14
+ "files": [
15
+ "SKILL.md",
16
+ "scripts/"
17
+ ],
18
+ "optionalDependencies": {
19
+ "add-skill": "^1.0.29"
20
+ },
21
+ "keywords": [
22
+ "claude-code",
23
+ "skill",
24
+ "handover",
25
+ "session-management",
26
+ "context-transfer"
27
+ ],
28
+ "author": "catcuts",
29
+ "license": "MIT",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/catcuts/agent-skills.git",
33
+ "directory": "skills/handover"
34
+ },
35
+ "bugs": {
36
+ "url": "https://github.com/catcuts/agent-skills/issues"
37
+ },
38
+ "homepage": "https://github.com/catcuts/agent-skills#readme",
39
+ "engines": {
40
+ "node": ">=18.0.0"
41
+ }
42
+ }
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Handover Skill 安装脚本
5
+ * 使用 add-skill 将 skill 安装到 Claude Code
6
+ *
7
+ * 命令行参数 (推荐):
8
+ * --dry-run: 测试模式,只显示将要执行的命令,不实际安装
9
+ * --global: 强制全局安装
10
+ * --local: 强制项目级安装
11
+ *
12
+ * 环境变量 (备用):
13
+ * - SKILL_SCOPE: 安装范围,可选值: GLOBAL(全局) 或 LOCAL(项目级),默认: GLOBAL
14
+ */
15
+
16
+ const { execSync } = require('child_process');
17
+ const path = require('path');
18
+ const fs = require('fs');
19
+
20
+ // 获取包根目录
21
+ const packageRoot = path.resolve(__dirname, '..');
22
+
23
+ // 解析命令行参数
24
+ const args = process.argv.slice(2);
25
+ const dryRun = args.includes('--dry-run');
26
+ const forceGlobal = args.includes('--global');
27
+ const forceLocal = args.includes('--local');
28
+
29
+ // 确定安装范围
30
+ let scope;
31
+ if (forceGlobal) {
32
+ scope = 'GLOBAL';
33
+ } else if (forceLocal) {
34
+ scope = 'LOCAL';
35
+ } else {
36
+ scope = (process.env.SKILL_SCOPE || 'GLOBAL').toUpperCase();
37
+ }
38
+
39
+ const isGlobal = scope === 'GLOBAL';
40
+
41
+ // 日志函数
42
+ function log(message, type = 'info') {
43
+ const prefix =
44
+ {
45
+ info: '✓',
46
+ success: '✓',
47
+ warning: '⚠',
48
+ error: '✗',
49
+ }[type] || '✓';
50
+
51
+ console.log(`${prefix} ${message}`);
52
+ }
53
+
54
+ // 错误处理
55
+ function handleError(error) {
56
+ log(`安装失败: ${error.message}`, 'error');
57
+ log('\n您可以尝试手动安装:', 'warning');
58
+ log(` npx add-skill "${packageRoot}" -a claude-code ${isGlobal ? '-g' : ''} -y`);
59
+ process.exit(1);
60
+ }
61
+
62
+ try {
63
+ log(`开始安装 Handover Skill...`, 'info');
64
+ log(`安装范围: ${isGlobal ? '全局(GLOBAL)' : '项目级(LOCAL)'}`, 'info');
65
+
66
+ // 构建 add-skill 命令
67
+ const commandParts = [
68
+ 'npx',
69
+ 'add-skill',
70
+ `"${packageRoot}"`,
71
+ // '-a', 'claude-code' // 由 add-skill 自动检测,如果检测失败那么会自动弹出菜单让用户手动选择
72
+ ];
73
+
74
+ if (isGlobal) {
75
+ commandParts.push('-g');
76
+ }
77
+
78
+ commandParts.push('-y'); // 非交互模式
79
+
80
+ const command = commandParts.join(' ');
81
+
82
+ if (dryRun) {
83
+ log('\n[DRY-RUN] 将要执行的命令:', 'warning');
84
+ console.log(` ${command}`);
85
+ log(
86
+ '\n测试通过 - 实际安装请运行: npm run install:global 或 npm run install:local',
87
+ 'success'
88
+ );
89
+ process.exit(0);
90
+ }
91
+
92
+ // 执行安装
93
+ log('\n正在执行 add-skill...', 'info');
94
+ execSync(command, {
95
+ stdio: 'inherit',
96
+ cwd: packageRoot,
97
+ });
98
+
99
+ log('\n安装成功!', 'success');
100
+ log(
101
+ `Skill 已安装到: ${isGlobal ? '~/.claude/skills/handover' : '.claude/skills/handover'}`,
102
+ 'info'
103
+ );
104
+ } catch (error) {
105
+ handleError(error);
106
+ }
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Handover Skill 卸载脚本
5
+ * 从 Claude Code 中移除 skill
6
+ *
7
+ * 命令行参数 (推荐):
8
+ * --global: 强制全局卸载
9
+ * --local: 强制项目级卸载
10
+ *
11
+ * 环境变量 (备用):
12
+ * - SKILL_SCOPE: 安装范围,可选值: GLOBAL(全局) 或 LOCAL(项目级),默认: GLOBAL
13
+ */
14
+
15
+ const path = require('path');
16
+ const fs = require('fs');
17
+ const os = require('os');
18
+
19
+ // 解析命令行参数
20
+ const args = process.argv.slice(2);
21
+ const forceGlobal = args.includes('--global');
22
+ const forceLocal = args.includes('--local');
23
+
24
+ // 确定安装范围
25
+ let scope;
26
+ if (forceGlobal) {
27
+ scope = 'GLOBAL';
28
+ } else if (forceLocal) {
29
+ scope = 'LOCAL';
30
+ } else {
31
+ scope = (process.env.SKILL_SCOPE || 'GLOBAL').toUpperCase();
32
+ }
33
+
34
+ const isGlobal = scope === 'GLOBAL';
35
+
36
+ // 日志函数
37
+ function log(message, type = 'info') {
38
+ const prefix =
39
+ {
40
+ info: '✓',
41
+ success: '✓',
42
+ warning: '⚠',
43
+ error: '✗',
44
+ }[type] || '✓';
45
+
46
+ console.log(`${prefix} ${message}`);
47
+ }
48
+
49
+ // 递归删除目录
50
+ function removeDirectory(dirPath) {
51
+ if (!fs.existsSync(dirPath)) {
52
+ return false;
53
+ }
54
+
55
+ try {
56
+ fs.rmSync(dirPath, { recursive: true, force: true });
57
+ return true;
58
+ } catch (error) {
59
+ log(`删除 ${dirPath} 失败: ${error.message}`, 'error');
60
+ return false;
61
+ }
62
+ }
63
+
64
+ try {
65
+ log(`开始卸载 Handover Skill...`, 'info');
66
+ log(`卸载范围: ${isGlobal ? '全局(GLOBAL)' : '项目级(LOCAL)'}`, 'info');
67
+
68
+ let removedCount = 0;
69
+
70
+ if (isGlobal) {
71
+ // 全局卸载
72
+ const homeDir = os.homedir();
73
+ const paths = [
74
+ path.join(homeDir, '.claude', 'skills', 'handover'),
75
+ path.join(homeDir, '.agents', 'skills', 'handover'),
76
+ ];
77
+
78
+ paths.forEach((dirPath) => {
79
+ if (removeDirectory(dirPath)) {
80
+ log(`已删除: ${dirPath}`, 'success');
81
+ removedCount++;
82
+ }
83
+ });
84
+ } else {
85
+ // 项目级卸载
86
+ const cwd = process.cwd();
87
+ const paths = [
88
+ path.join(cwd, '.claude', 'skills', 'handover'),
89
+ path.join(cwd, '.agents', 'skills', 'handover'),
90
+ ];
91
+
92
+ paths.forEach((dirPath) => {
93
+ if (removeDirectory(dirPath)) {
94
+ log(`已删除: ${dirPath}`, 'success');
95
+ removedCount++;
96
+ }
97
+ });
98
+ }
99
+
100
+ if (removedCount > 0) {
101
+ log(`\n卸载成功! 已删除 ${removedCount} 个目录`, 'success');
102
+ } else {
103
+ log('\n未找到已安装的 skill 文件', 'warning');
104
+ }
105
+ } catch (error) {
106
+ log(`卸载失败: ${error.message}`, 'error');
107
+ process.exit(1);
108
+ }