@optima-chat/dev-skills 0.7.24 → 0.7.25

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.
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: "grant-credits"
3
+ description: "当用户请求赠送 credits、充值积分、grant credits、加 credits、奖励积分、补偿 credits、推荐奖励时,使用此技能。支持 Stage、Prod 两个环境。"
4
+ allowed-tools: ["Bash"]
5
+ ---
6
+
7
+ # 赠送 Credits
8
+
9
+ 当你需要为用户赠送额外 credits 时,使用这个场景。
10
+
11
+ ## 执行方式:使用 CLI 工具
12
+
13
+ **重要**:使用 `optima-grant-credits` CLI 工具:
14
+
15
+ ```bash
16
+ optima-grant-credits <email> --amount <n> [options]
17
+ ```
18
+
19
+ **为什么使用 CLI 工具**:
20
+ - 自动通过 email 查找 userId(跨 user-auth 数据库)
21
+ - 自动处理 SSH 隧道和数据库连接
22
+ - 不会影响现有订阅和 credits(纯追加)
23
+ - 一条命令完成操作
24
+
25
+ ## 适用情况
26
+
27
+ - 赠送额外 credits(奖励、补偿、推广等)
28
+ - 推荐奖励 credits
29
+ - 运营活动发放 credits
30
+ - 客户补偿
31
+
32
+ ## 快速操作
33
+
34
+ ```bash
35
+ # 赠送 100 bonus credits,Stage 环境(默认)
36
+ optima-grant-credits user@example.com --amount 100
37
+
38
+ # 赠送 500 bonus credits,Prod 环境
39
+ optima-grant-credits user@example.com --amount 500 --env prod
40
+
41
+ # 推荐奖励 credits
42
+ optima-grant-credits user@example.com --amount 200 --type referral --env prod
43
+
44
+ # 自定义描述
45
+ optima-grant-credits user@example.com --amount 300 --description "客户补偿 - 服务中断" --env prod
46
+ ```
47
+
48
+ ### 参数说明
49
+
50
+ | 参数 | 说明 | 默认值 |
51
+ |------|------|--------|
52
+ | `<email>` | 用户邮箱(必填) | - |
53
+ | `--amount <n>` | Credits 数量(必填,>=1) | - |
54
+ | `--type <type>` | 类型:bonus, referral | bonus |
55
+ | `--description <text>` | 描述(可选) | Auto-generated |
56
+ | `--env <env>` | 环境:stage, prod | stage |
57
+
58
+ ## 与 grant-subscription 的区别
59
+
60
+ | | grant-credits | grant-subscription |
61
+ |---|---|---|
62
+ | 作用 | 追加 credits | 开通/切换订阅计划 |
63
+ | 现有 credits | 不影响 | 清零后重新授予 |
64
+ | 现有订阅 | 不影响 | 取消旧的,创建新的 |
65
+ | Token quota | 不影响 | 按计划更新 |
66
+ | 适用场景 | 奖励、补偿、推广 | 开通会员、升级计划 |
67
+
68
+ ## 常见使用场景
69
+
70
+ ### 场景 1:奖励 credits
71
+
72
+ **用户请求**:"给 xxx@gmail.com 加 200 credits"
73
+
74
+ ```bash
75
+ optima-grant-credits xxx@gmail.com --amount 200 --env prod
76
+ ```
77
+
78
+ ### 场景 2:推荐奖励
79
+
80
+ **用户请求**:"xxx 推荐了新用户,给他 referral 奖励 300"
81
+
82
+ ```bash
83
+ optima-grant-credits xxx@gmail.com --amount 300 --type referral --env prod
84
+ ```
85
+
86
+ ### 场景 3:客户补偿
87
+
88
+ **用户请求**:"服务出了问题,补偿 xxx 500 credits"
89
+
90
+ ```bash
91
+ optima-grant-credits xxx@gmail.com --amount 500 --description "服务中断补偿" --env prod
92
+ ```
93
+
94
+ ## 安全提醒
95
+
96
+ 1. **Stage 优先**:默认操作 Stage 环境
97
+ 2. **Prod 谨慎**:操作 Prod 前确认邮箱和数量
98
+ 3. **纯追加**:不会影响现有 credits 和订阅
99
+ 4. **无过期**:bonus/referral credits 默认不设过期时间
100
+
101
+ ## 相关命令
102
+
103
+ - `optima-grant-credits` - 赠送 credits(主要方式)
104
+ - `optima-grant-subscription` - 开通订阅计划
105
+ - `optima-query-db` - 查询数据库验证结果
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: "grant-subscription"
3
+ description: "当用户请求开通会员、赠送订阅、grant subscription、开通 Pro/Starter/Enterprise、升级计划、给用户开会员时,使用此技能。支持 Stage、Prod 两个环境。"
4
+ allowed-tools: ["Bash"]
5
+ ---
6
+
7
+ # 开通/赠送订阅
8
+
9
+ 当你需要为用户开通会员计划时,使用这个场景。
10
+
11
+ ## 执行方式:使用 CLI 工具
12
+
13
+ **重要**:无论用户使用 `/grant-subscription` 命令还是直接请求开通会员,都应该使用 `optima-grant-subscription` CLI 工具:
14
+
15
+ ```bash
16
+ optima-grant-subscription <email> [options]
17
+ ```
18
+
19
+ **为什么使用 CLI 工具**:
20
+ - 自动通过 email 查找 userId(跨 user-auth 数据库)
21
+ - 自动处理 SSH 隧道和数据库连接
22
+ - 自动取消旧订阅、清零旧 credits
23
+ - 自动按 plan 配置授予 credits 和 token quota
24
+ - 一条命令完成所有操作
25
+
26
+ ## 适用情况
27
+
28
+ - 给用户开通/赠送 Pro、Starter、Enterprise 等会员
29
+ - 升级用户的计划
30
+ - 为企业客户定制订阅
31
+ - 处理用户会员相关请求
32
+
33
+ ## 快速操作
34
+
35
+ ### 基本使用
36
+
37
+ ```bash
38
+ # 开通 Pro(默认),Stage 环境(默认)
39
+ optima-grant-subscription user@example.com
40
+
41
+ # 开通 Pro,Prod 环境
42
+ optima-grant-subscription user@example.com --env prod
43
+
44
+ # 开通 Starter,3 个月
45
+ optima-grant-subscription user@example.com --plan starter --months 3
46
+
47
+ # 开通 Enterprise,Prod 环境
48
+ optima-grant-subscription user@example.com --plan enterprise --env prod
49
+ ```
50
+
51
+ ### 参数说明
52
+
53
+ | 参数 | 说明 | 默认值 |
54
+ |------|------|--------|
55
+ | `<email>` | 用户邮箱(必填) | - |
56
+ | `--plan <id>` | 计划:trial, starter, pro, enterprise | pro |
57
+ | `--months <n>` | 时长(月) | 1 |
58
+ | `--env <env>` | 环境:stage, prod | stage |
59
+
60
+ ### 计划配置
61
+
62
+ | Plan | Credits/月 | Session Token | Weekly Token |
63
+ |------|-----------|---------------|--------------|
64
+ | trial | 20 | 400K | 1M |
65
+ | starter | 500 | 2M | 10M |
66
+ | pro | 2,000 | 8M | 40M |
67
+ | enterprise | 10,000 | 16M | 80M |
68
+
69
+ ## 常见使用场景
70
+
71
+ ### 场景 1:给用户开通 Pro 会员
72
+
73
+ **用户请求**:"帮 xxx@gmail.com 开通 Pro"
74
+
75
+ ```bash
76
+ optima-grant-subscription xxx@gmail.com --plan pro --env prod
77
+ ```
78
+
79
+ ### 场景 2:企业客户定制
80
+
81
+ **用户请求**:"给企业客户开 Enterprise,6 个月"
82
+
83
+ ```bash
84
+ optima-grant-subscription client@company.com --plan enterprise --months 6 --env prod
85
+ ```
86
+
87
+ ### 场景 3:升级到 Starter
88
+
89
+ **用户请求**:"把这个用户升级到 Starter"
90
+
91
+ ```bash
92
+ optima-grant-subscription user@example.com --plan starter --env prod
93
+ ```
94
+
95
+ ## 执行流程
96
+
97
+ 工具会自动完成以下步骤:
98
+
99
+ 1. 通过 email 在 user-auth 数据库查找 userId
100
+ 2. 加载对应 plan 的配置(credits、token 限额等)
101
+ 3. 取消该用户的所有活跃订阅
102
+ 4. 清零旧的 credits
103
+ 5. 创建新订阅(设置到期时间)
104
+ 6. 授予对应 credits
105
+ 7. 更新 token quota 限额
106
+
107
+ ## 安全提醒
108
+
109
+ 1. **Stage 优先**:默认操作 Stage 环境
110
+ 2. **Prod 谨慎**:操作 Prod 前确认用户邮箱正确
111
+ 3. **不可逆**:旧订阅和 credits 会被清除
112
+ 4. **确认 email**:执行前务必确认邮箱地址无误
113
+
114
+ ## 相关命令
115
+
116
+ - `optima-grant-subscription` - 开通订阅(主要方式)
117
+ - `optima-grant-credits` - 单独赠送 credits
118
+ - `optima-query-db` - 查询数据库验证结果
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optima-chat/dev-skills",
3
- "version": "0.7.24",
3
+ "version": "0.7.25",
4
4
  "description": "Claude Code Skills for Optima development team - cross-environment collaboration tools",
5
5
  "main": "index.js",
6
6
  "bin": {