skill-master 0.1.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 BenedictKing
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,214 @@
1
+ # skill-master
2
+
3
+ [中文文档](./README.zh-CN.md)
4
+
5
+ Cross-platform skill package manager for AI coding agents, fully compatible with `npx skills` CLI.
6
+
7
+ ## Features
8
+
9
+ - ✅ **Smart .env Management** — Auto backup/restore environment variables during updates
10
+ - ✅ **Multi-Platform Support** — Claude Code, Cursor, Cline, Windsurf, OpenCode
11
+ - ✅ **npx skills Compatible** — Drop-in replacement with same command interface
12
+ - ✅ **Unified Directory** — Centralized management in `~/.agents/`
13
+ - ✅ **Atomic Operations** — Auto rollback on failure
14
+ - ✅ **Diagnostic Tools** — Built-in `doctor` command
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install -g skill-master
20
+ ```
21
+
22
+ Or use directly:
23
+
24
+ ```bash
25
+ npx skill-master add <source>
26
+ ```
27
+
28
+ ## Quick Start
29
+
30
+ ### Install Skills
31
+
32
+ ```bash
33
+ # From GitHub
34
+ skill-master add owner/repo
35
+ skill-master add https://github.com/user/skill
36
+
37
+ # From local path
38
+ skill-master add ./local-skill
39
+
40
+ # Specify target agent
41
+ skill-master add owner/repo -a claude-code cursor
42
+
43
+ # Copy mode (recommended for Windows)
44
+ skill-master add owner/repo --copy
45
+ ```
46
+
47
+ ### Manage Environment Variables
48
+
49
+ ```bash
50
+ # List all skills with env status
51
+ skill-master env list
52
+
53
+ # Set environment variable
54
+ skill-master env set my-skill API_KEY=your_key
55
+
56
+ # Edit .env file
57
+ skill-master env edit my-skill
58
+ ```
59
+
60
+ ### Update and Remove
61
+
62
+ ```bash
63
+ # Update skill (auto preserves .env)
64
+ skill-master update my-skill
65
+
66
+ # Remove skill
67
+ skill-master remove my-skill
68
+
69
+ # Remove with config purge
70
+ skill-master remove my-skill --purge
71
+ ```
72
+
73
+ ### Other Commands
74
+
75
+ ```bash
76
+ # List installed skills
77
+ skill-master list
78
+
79
+ # Search for skills
80
+ skill-master find "code review"
81
+
82
+ # Check for updates
83
+ skill-master check
84
+
85
+ # Create new skill template
86
+ skill-master init my-new-skill
87
+
88
+ # Show skill details
89
+ skill-master info my-skill
90
+
91
+ # Run diagnostics
92
+ skill-master doctor
93
+ ```
94
+
95
+ ## Command Aliases
96
+
97
+ All `npx skills` commands work:
98
+
99
+ ```bash
100
+ skill-master add # or: a, install, i
101
+ skill-master remove # or: rm, r
102
+ skill-master list # or: ls
103
+ skill-master find # or: search, f, s
104
+ skill-master update # or: upgrade
105
+ ```
106
+
107
+ ## Directory Structure
108
+
109
+ ```
110
+ ~/.agents/
111
+ ├── config/ # Persistent configs (.env files)
112
+ │ ├── my-skill/.env
113
+ │ └── other-skill/.env
114
+ ├── skills/ # Skill code (canonical storage)
115
+ │ ├── my-skill/
116
+ │ └── other-skill/
117
+ └── registry.json # Installed skills index
118
+
119
+ <project>/
120
+ └── .claude/skills/ # Agent directory (symlinks)
121
+ ├── my-skill -> ~/.agents/skills/my-skill
122
+ └── other-skill -> ~/.agents/skills/other-skill
123
+ ```
124
+
125
+ ## .env Protection
126
+
127
+ ### Backup Priority
128
+
129
+ During install/update, searches for existing config in order:
130
+
131
+ 1. `~/.agents/config/<skill>/.env` (persistent, highest priority)
132
+ 2. `.claude/skills/<skill>/.env` (current project)
133
+ 3. `~/.agents/skills/<skill>/.env` (canonical location)
134
+
135
+ ### Restore Strategy
136
+
137
+ - Existing `KEY=VALUE` pairs are **never overwritten**
138
+ - New keys from `.env.example` are appended with empty values
139
+ - User comments are preserved
140
+
141
+ ## Supported Platforms
142
+
143
+ | Platform | Detection | Skills Directory |
144
+ |----------|-----------|------------------|
145
+ | Claude Code | `.claude/` | `.claude/skills/` |
146
+ | Cursor | `.cursor/` | `.cursor/skills/` |
147
+ | Cline | `.cline/` | `.cline/skills/` |
148
+ | Windsurf | `.windsurf/` | `.windsurf/skills/` |
149
+ | OpenCode | `~/.config/opencode/` | `.opencode/skills/` |
150
+
151
+ ## Development
152
+
153
+ ```bash
154
+ # Clone repository
155
+ git clone https://github.com/yourusername/skill-master.git
156
+ cd skill-master
157
+
158
+ # Install dependencies
159
+ npm install
160
+
161
+ # Development mode
162
+ npm run dev
163
+
164
+ # Build
165
+ npm run build
166
+
167
+ # Type check
168
+ npm run lint
169
+
170
+ # Test
171
+ npm test
172
+ ```
173
+
174
+ ## vs npx skills
175
+
176
+ | Feature | npx skills | skill-master |
177
+ |---------|-----------|---------------|
178
+ | .env Protection | ❌ Deleted on update | ✅ Auto backup/restore |
179
+ | Multi-Platform | ❌ Claude Code only | ✅ 5 platforms |
180
+ | Config Management | ❌ None | ✅ env commands |
181
+ | Diagnostics | ❌ None | ✅ doctor command |
182
+ | Symlinks | ✅ | ✅ + copy mode |
183
+ | Git Install | ✅ | ✅ |
184
+ | Local Install | ✅ | ✅ |
185
+
186
+ ## FAQ
187
+
188
+ ### Why skill-master?
189
+
190
+ `npx skills add` executes `rm -rf` during install/update, deleting `.env` files. Users must reconfigure API keys after every update. skill-master solves this with intelligent backup.
191
+
192
+ ### Can it coexist with npx skills?
193
+
194
+ Yes. skill-master uses separate `~/.agents/` directory and won't affect existing installations.
195
+
196
+ ### Symlink fails on Windows?
197
+
198
+ Use `--copy` flag: `skill-master add <source> --copy`
199
+
200
+ ### How to migrate existing skills?
201
+
202
+ Simply reinstall with skill-master. It will auto-detect and preserve existing `.env` configs.
203
+
204
+ ## License
205
+
206
+ MIT
207
+
208
+ ## Author
209
+
210
+ BenedictKing
211
+
212
+ ## Contributing
213
+
214
+ Issues and Pull Requests are welcome!
@@ -0,0 +1,199 @@
1
+ # skill-master
2
+
3
+ 跨平台 Skill 包管理器,解决 `npx skills` 的两大核心问题:
4
+
5
+ 1. **保护 .env 配置** — 安装/更新时自动备份和恢复环境变量,不再丢失 API Key
6
+ 2. **跨平台兼容** — 支持 Claude Code、Cursor、Cline、Windsurf、OpenCode 五大 AI 编程平台
7
+
8
+ ## 特性
9
+
10
+ - ✅ **智能 .env 管理** — 三级备份策略,更新时自动合并新配置
11
+ - ✅ **平台自动检测** — 根据项目目录自动识别目标平台
12
+ - ✅ **统一目录结构** — `~/.agents/` 集中管理所有 skill 和配置
13
+ - ✅ **原子化操作** — 安装失败自动回滚,保证数据完整性
14
+ - ✅ **诊断工具** — `doctor` 命令快速排查配置问题
15
+
16
+ ## 安装
17
+
18
+ ```bash
19
+ npm install -g skill-master
20
+ ```
21
+
22
+ 或直接使用:
23
+
24
+ ```bash
25
+ npx skill-master install <skill-source>
26
+ ```
27
+
28
+ ## 快速开始
29
+
30
+ ### 安装 Skill
31
+
32
+ ```bash
33
+ # 从 GitHub 安装
34
+ skill-master install https://github.com/user/skill-name
35
+
36
+ # 从本地路径安装
37
+ skill-master install ./local-skill
38
+
39
+ # 指定目标平台
40
+ skill-master install https://github.com/user/skill --agent=cursor
41
+
42
+ # 使用复制而非符号链接(Windows 推荐)
43
+ skill-master install https://github.com/user/skill --copy
44
+ ```
45
+
46
+ ### 管理环境变量
47
+
48
+ ```bash
49
+ # 查看所有 skill 的配置状态
50
+ skill-master env list
51
+
52
+ # 设置环境变量
53
+ skill-master env set tavily-web TAVILY_API_KEY=your_key_here
54
+
55
+ # 用编辑器打开 .env 文件
56
+ skill-master env edit tavily-web
57
+ ```
58
+
59
+ ### 更新和删除
60
+
61
+ ```bash
62
+ # 更新 skill(自动保护 .env)
63
+ skill-master update tavily-web
64
+
65
+ # 删除 skill
66
+ skill-master remove tavily-web
67
+
68
+ # 删除 skill 并清除配置
69
+ skill-master remove tavily-web --purge
70
+ ```
71
+
72
+ ### 查看信息
73
+
74
+ ```bash
75
+ # 列出所有已安装的 skill
76
+ skill-master list
77
+
78
+ # 查看 skill 详细信息
79
+ skill-master info tavily-web
80
+
81
+ # 运行诊断
82
+ skill-master doctor
83
+ ```
84
+
85
+ ## 目录结构
86
+
87
+ ```
88
+ ~/.agents/
89
+ ├── config/ # 持久化配置(.env 文件)
90
+ │ ├── tavily-web/.env
91
+ │ └── exa-search/.env
92
+ ├── skills/ # Skill 代码(canonical 存储)
93
+ │ ├── tavily-web/
94
+ │ └── exa-search/
95
+ └── registry.json # 已安装 skill 索引
96
+
97
+ <project>/
98
+ └── .claude/skills/ # Agent 目录(符号链接)
99
+ ├── tavily-web -> ~/.agents/skills/tavily-web
100
+ └── exa-search -> ~/.agents/skills/exa-search
101
+ ```
102
+
103
+ ## .env 保护机制
104
+
105
+ ### 备份优先级
106
+
107
+ 安装/更新时按以下顺序查找现有配置:
108
+
109
+ 1. `~/.agents/config/<skill>/.env` (持久化位置,最高优先级)
110
+ 2. `.claude/skills/<skill>/.env` (当前项目)
111
+ 3. `~/.agents/skills/<skill>/.env` (canonical 位置)
112
+
113
+ ### 恢复策略
114
+
115
+ - 用户已有的 `KEY=VALUE` **绝不覆盖**
116
+ - `.env.example` 中新增的 key 追加到末尾,值留空并加注释
117
+ - 保留用户的注释行
118
+
119
+ ### 双写机制
120
+
121
+ 为兼容现有 API 脚本(使用 `path.join(__dirname, '.env')` 加载),.env 同时写入:
122
+
123
+ - `~/.agents/config/<skill>/.env` (持久化)
124
+ - `<skill-dir>/.env` (兼容现有脚本)
125
+
126
+ ## 支持的平台
127
+
128
+ | 平台 | 检测标识 | Skills 目录 |
129
+ |------|---------|------------|
130
+ | Claude Code | `.claude/` | `.claude/skills/` |
131
+ | Cursor | `.cursor/` | `.cursor/skills/` |
132
+ | Cline | `.cline/` | `.cline/skills/` |
133
+ | Windsurf | `.windsurf/` | `.windsurf/skills/` |
134
+ | OpenCode | `~/.config/opencode/` | `.opencode/skills/` |
135
+
136
+ ## 开发
137
+
138
+ ```bash
139
+ # 克隆仓库
140
+ git clone https://github.com/user/skill-master.git
141
+ cd skill-master
142
+
143
+ # 安装依赖
144
+ npm install
145
+
146
+ # 开发模式
147
+ npm run dev
148
+
149
+ # 构建
150
+ npm run build
151
+
152
+ # 类型检查
153
+ npm run lint
154
+
155
+ # 测试
156
+ npm test
157
+ ```
158
+
159
+ ## 与 `npx skills` 的对比
160
+
161
+ | 特性 | npx skills | skill-master |
162
+ |------|-----------|---------------|
163
+ | .env 保护 | ❌ 每次更新被删除 | ✅ 自动备份恢复 |
164
+ | 跨平台支持 | ❌ 仅 Claude Code | ✅ 5 个平台 |
165
+ | 配置管理 | ❌ 无 | ✅ env 子命令 |
166
+ | 诊断工具 | ❌ 无 | ✅ doctor 命令 |
167
+ | 符号链接 | ✅ | ✅ + 复制模式 |
168
+ | Git 安装 | ✅ | ✅ |
169
+ | 本地安装 | ✅ | ✅ |
170
+
171
+ ## 常见问题
172
+
173
+ ### Q: 为什么需要 skill-master?
174
+
175
+ A: `npx skills add` 在安装/更新时会执行 `rm -rf`,导致 `.env` 文件被删除,用户每次更新后需要重新配置 API Key。skill-master 通过智能备份机制彻底解决这个问题。
176
+
177
+ ### Q: 可以和 `npx skills` 共存吗?
178
+
179
+ A: 可以。skill-master 使用独立的 `~/.agents/` 目录,不会影响现有的 skill 安装。
180
+
181
+ ### Q: Windows 上符号链接失败怎么办?
182
+
183
+ A: 使用 `--copy` 参数:`skill-master install <source> --copy`
184
+
185
+ ### Q: 如何迁移现有的 skill?
186
+
187
+ A: 直接用 skill-master 重新安装即可,它会自动检测并保留现有的 .env 配置。
188
+
189
+ ## 许可证
190
+
191
+ MIT
192
+
193
+ ## 作者
194
+
195
+ BenedictKing
196
+
197
+ ## 贡献
198
+
199
+ 欢迎提交 Issue 和 Pull Request!
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+
3
+ import('../dist/cli.js').catch((err) => {
4
+ console.error('Failed to load skill-master:', err.message);
5
+ process.exit(1);
6
+ });