harmonyos-skills-pack 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.
Files changed (3) hide show
  1. package/README.md +230 -0
  2. package/bin/cli.js +211 -0
  3. package/package.json +33 -0
package/README.md ADDED
@@ -0,0 +1,230 @@
1
+ # HarmonyOS Skills Pack
2
+
3
+ Current Version: 0.1.0
4
+
5
+ 这是一个面向 Claude、GitHub Copilot、Codex 等 Coding Agent 的可安装 Skills 项目。
6
+
7
+ 它的目标不是提供某个具体业务应用,而是沉淀一套可复用的鸿蒙 Ark 开发知识、提审避坑经验和通用产品质量检查能力,让 Agent 在做 HarmonyOS 项目时能直接调用这些结构化资产。
8
+
9
+ ## 项目定位
10
+
11
+ 这个仓库解决的是两个问题:
12
+
13
+ 1. HarmonyOS Ark 项目从 0 到 1 落地时,如何快速得到可执行的目录结构、模块模板、执行顺序和提审清单。
14
+ 2. 在正式发布前,如何统一检查功能丰富度、深色模式、多端适配、风险等级和审核材料完整性。
15
+
16
+ 换句话说,这个仓库是一个“可发布的 Skills 发行包”,不是单一 Demo,也不是某个 App 的源码仓库。
17
+
18
+ ## 包含内容
19
+
20
+ 当前版本包含两个核心技能:
21
+
22
+ ### 1. harmonyos-ark
23
+
24
+ 面向纯血鸿蒙 Ark 应用开发,覆盖:
25
+
26
+ - ArkTS、ArkUI、Stage/Ability、路由生命周期
27
+ - 网络请求、本地存储、媒体与设备能力
28
+ - 测试、签名、打包、上架发布
29
+ - 2025 创作激励与审核避坑
30
+ - Starter Kit 极速实现包
31
+
32
+ 其中 starter-kit 已包含:
33
+
34
+ - 登录模块模板
35
+ - 单机离线 / 免登录模块
36
+ - 游客升级登录同步模块
37
+ - 列表页、详情页、表单页、TabBar 模板
38
+ - 深色模式与多端适配模板
39
+ - Day-by-Day 执行顺序与提审前清单
40
+
41
+ ### 2. universal-product-quality
42
+
43
+ 面向项目无关的通用产品质量校验,覆盖:
44
+
45
+ - 功能丰富度基线
46
+ - 深色模式可用性
47
+ - 多端适配一致性
48
+ - 风险分级与发布前验证
49
+ - 一键可勾选的通用发布前检查表
50
+
51
+ ## 适用对象
52
+
53
+ 适合以下场景:
54
+
55
+ - 你想让 Agent 辅助开发 HarmonyOS Ark 项目
56
+ - 你需要一套可复用的鸿蒙开发知识路由
57
+ - 你要做 2025 鸿蒙激励相关项目,想降低卡审风险
58
+ - 你希望把“功能开发”和“发布前质量检查”一起标准化
59
+
60
+ ## 项目特点
61
+
62
+ - 可安装:支持安装到 Claude 标准技能目录或 Copilot 工作区目录
63
+ - 可同步:维护目录与标准入口目录可一键同步
64
+ - 可发布:已提供 release 打包与校验脚本
65
+ - 可审查:带有提审前检查表、ArkTS 工程规范、静态检查清单和风险专项
66
+ - 可扩展:可以继续追加新的 skill、module、checklist 和模板
67
+
68
+ ## 快速开始
69
+
70
+ ### 1. 克隆仓库
71
+
72
+ ```bash
73
+ git clone <your-repo-url> harmonyos-skills-pack
74
+ cd harmonyos-skills-pack
75
+ ```
76
+
77
+ ### 2. 安装到 Claude
78
+
79
+ ```bash
80
+ ./scripts/install-skills.sh --claude
81
+ ```
82
+
83
+ 安装目标目录:
84
+
85
+ - ~/.claude/skills/harmonyos-ark
86
+ - ~/.claude/skills/universal-product-quality
87
+
88
+ ### 3. 安装到 Copilot 工作区
89
+
90
+ ```bash
91
+ ./scripts/install-skills.sh --copilot-workspace /path/to/your/workspace
92
+ ```
93
+
94
+ 安装目标目录:
95
+
96
+ - /path/to/your/workspace/.github/skills/harmonyos-ark
97
+ - /path/to/your/workspace/.github/skills/universal-product-quality
98
+
99
+ ### 4. 强制覆盖安装
100
+
101
+ ```bash
102
+ ./scripts/install-skills.sh --claude --force
103
+ ./scripts/install-skills.sh --copilot-workspace /path/to/your/workspace --force
104
+ ```
105
+
106
+ ### 5. 维护者同步标准目录
107
+
108
+ ```bash
109
+ ./scripts/sync-skills.sh
110
+ ```
111
+
112
+ ## 卸载
113
+
114
+ ```bash
115
+ ./scripts/uninstall-skills.sh --claude
116
+ ./scripts/uninstall-skills.sh --copilot-workspace /path/to/your/workspace
117
+ ```
118
+
119
+ ## 项目结构说明
120
+
121
+ - .claude/skills/
122
+ - Claude 标准技能入口目录
123
+ - .github/skills/
124
+ - Copilot 标准技能入口目录
125
+ - skills/
126
+ - 内容维护目录,作为 canonical source
127
+ - scripts/
128
+ - 安装、卸载、同步、校验、发布脚本
129
+ - releases/
130
+ - 生成的 zip 发布包与校验文件
131
+
132
+ ## 发布与维护
133
+
134
+ 常用命令:
135
+
136
+ ```bash
137
+ ./scripts/validate-skills.sh
138
+ ./scripts/make-release.sh --force
139
+ ./scripts/sync-skills.sh
140
+ ```
141
+
142
+ 机器可读索引:
143
+
144
+ - llms.txt
145
+ - SKILLS_MANIFEST.json
146
+
147
+ ## 使用示例 Prompt
148
+
149
+ 下面这些提问方式可以直接帮助 Agent 路由到合适的 skills:
150
+
151
+ ### HarmonyOS Ark 开发
152
+
153
+ ```text
154
+ 帮我梳理一个纯血鸿蒙 Ark 项目的目录结构和分层架构
155
+ ```
156
+
157
+ ```text
158
+ 给我一个带列表页、详情页、表单页的鸿蒙 starter-kit 落地方案
159
+ ```
160
+
161
+ ```text
162
+ 我这个鸿蒙应用是单机离线工具类,不需要登录,帮我设计启动页和主页结构
163
+ ```
164
+
165
+ ```text
166
+ 我现在先免登录,后面再加账号同步,帮我设计游客升级登录的数据迁移方案
167
+ ```
168
+
169
+ ### ArkTS / ArkUI 学习与路由
170
+
171
+ ```text
172
+ 帮我定位 ArkTS 入门、类型系统和装饰器的官方学习路径
173
+ ```
174
+
175
+ ```text
176
+ ArkUI 状态管理、页面路由和生命周期要分别看哪些主题文档
177
+ ```
178
+
179
+ ```text
180
+ 帮我按 ArkTS 规范检查命名、类型使用、装饰器边界、异步错误处理和依赖方向
181
+ ```
182
+
183
+ ### 激励与提审
184
+
185
+ ```text
186
+ 我准备参加 2025 鸿蒙激励,帮我按工具类 App 做一份提审前检查表
187
+ ```
188
+
189
+ ```text
190
+ 我的应用有账号登录和媒体上传,按审核风险应该怎么准备材料
191
+ ```
192
+
193
+ ```text
194
+ 帮我检查这个项目是否满足华为鸿蒙激励 2025 的提审要求
195
+ ```
196
+
197
+ ### 通用产品质量检查
198
+
199
+ ```text
200
+ 帮我做一次发布前质量体检,重点看功能丰富度、深色模式和多端适配
201
+ ```
202
+
203
+ ```text
204
+ 给我一份通用的一键发布前检查表,适用于 App 和 Web 项目
205
+ ```
206
+
207
+ ### 维护与发布 Skills 包
208
+
209
+ ```text
210
+ 帮我同步 skills 到 .claude 和 .github 标准目录
211
+ ```
212
+
213
+ ```text
214
+ 帮我验证这个 skills 包是否还能正常发布
215
+ ```
216
+
217
+ ```text
218
+ 帮我重新打一个最新 release 包并生成校验文件
219
+ ```
220
+
221
+ ## 说明
222
+
223
+ - 这是一个通用 Skills 包,不绑定某一个具体业务项目。
224
+ - 安装脚本复制的是完整技能目录,不是只有介绍文件。
225
+ - 若你只需要鸿蒙相关能力,可以单独使用 harmonyos-ark。
226
+ - 涉及 2025 激励规则和提审策略时,最终仍以华为官方当期页面和 AGC 审核要求为准。
227
+
228
+ ## 交流
229
+
230
+ QQ 群: 1029748283
package/bin/cli.js ADDED
@@ -0,0 +1,211 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * harmonyos-skills-pack CLI
5
+ *
6
+ * 从 GitHub 下载最新 skills 并安装到当前项目的
7
+ * .claude/skills、.github/skills、.codex/skills 目录。
8
+ *
9
+ * 用法:
10
+ * npx harmonyos-skills-pack # 安装到当前目录
11
+ * npx harmonyos-skills-pack --help # 查看帮助
12
+ * npx harmonyos-skills-pack --target . # 指定目标目录
13
+ * npx harmonyos-skills-pack --claude-only # 仅安装 .claude/skills
14
+ */
15
+
16
+ const { execSync } = require('child_process');
17
+ const fs = require('fs');
18
+ const path = require('path');
19
+ const os = require('os');
20
+
21
+ // ── 配置 ──────────────────────────────────────────────
22
+ const REPO = 'yibaiba/harmonyos-skills-pack';
23
+ const BRANCH = 'main';
24
+ const SKILLS = ['harmonyos-ark', 'universal-product-quality'];
25
+ const ARCHIVE_URL = `https://github.com/${REPO}/archive/refs/heads/${BRANCH}.tar.gz`;
26
+
27
+ // ── 颜色输出 ──────────────────────────────────────────
28
+ const color = {
29
+ green: (s) => `\x1b[32m${s}\x1b[0m`,
30
+ yellow: (s) => `\x1b[33m${s}\x1b[0m`,
31
+ red: (s) => `\x1b[31m${s}\x1b[0m`,
32
+ cyan: (s) => `\x1b[36m${s}\x1b[0m`,
33
+ bold: (s) => `\x1b[1m${s}\x1b[0m`,
34
+ };
35
+
36
+ // ── 参数解析 ──────────────────────────────────────────
37
+ const args = process.argv.slice(2);
38
+
39
+ if (args.includes('--help') || args.includes('-h')) {
40
+ console.log(`
41
+ ${color.bold('harmonyos-skills-pack')} — 鸿蒙 Ark AI Agent Skills 一键安装
42
+
43
+ ${color.cyan('用法:')}
44
+ npx harmonyos-skills-pack 安装到当前目录
45
+ npx harmonyos-skills-pack --target . 指定目标目录
46
+ npx harmonyos-skills-pack --force 强制覆盖已有文件
47
+ npx harmonyos-skills-pack --claude-only 仅 .claude/skills
48
+ npx harmonyos-skills-pack --copilot-only 仅 .github/skills
49
+ npx harmonyos-skills-pack --codex-only 仅 .codex/skills
50
+ npx harmonyos-skills-pack uninstall 移除已安装的 skills
51
+
52
+ ${color.cyan('安装目标:')}
53
+ .claude/skills/harmonyos-ark/
54
+ .claude/skills/universal-product-quality/
55
+ .github/skills/harmonyos-ark/
56
+ .github/skills/universal-product-quality/
57
+ .codex/skills/harmonyos-ark/
58
+ .codex/skills/universal-product-quality/
59
+
60
+ ${color.cyan('Skills 内容:')}
61
+ harmonyos-ark 84 个文档,覆盖 ArkTS/ArkUI/Stage/路由/状态/网络/Kit
62
+ universal-product-quality 12 个文档,覆盖产品质量检查/深色模式/多端适配
63
+ `);
64
+ process.exit(0);
65
+ }
66
+
67
+ const targetIdx = args.indexOf('--target');
68
+ const targetDir = targetIdx !== -1 ? path.resolve(args[targetIdx + 1] || '.') : process.cwd();
69
+ const force = args.includes('--force');
70
+ const claudeOnly = args.includes('--claude-only');
71
+ const copilotOnly = args.includes('--copilot-only');
72
+ const codexOnly = args.includes('--codex-only');
73
+ const isUninstall = args.includes('uninstall');
74
+
75
+ // 默认全部安装
76
+ const installTargets = [];
77
+ if (claudeOnly) {
78
+ installTargets.push('.claude/skills');
79
+ } else if (copilotOnly) {
80
+ installTargets.push('.github/skills');
81
+ } else if (codexOnly) {
82
+ installTargets.push('.codex/skills');
83
+ } else {
84
+ installTargets.push('.claude/skills', '.github/skills', '.codex/skills');
85
+ }
86
+
87
+ // ── 卸载 ─────────────────────────────────────────────
88
+ if (isUninstall) {
89
+ console.log(color.yellow('🗑 正在卸载 skills...'));
90
+ let removed = 0;
91
+ for (const t of installTargets) {
92
+ for (const skill of SKILLS) {
93
+ const skillPath = path.join(targetDir, t, skill);
94
+ if (fs.existsSync(skillPath)) {
95
+ fs.rmSync(skillPath, { recursive: true, force: true });
96
+ console.log(` ${color.red('✗')} ${skillPath}`);
97
+ removed++;
98
+ }
99
+ }
100
+ }
101
+ console.log(removed > 0
102
+ ? color.green(`\n✅ 已移除 ${removed} 个 skill 目录`)
103
+ : color.yellow('\n⚠️ 未找到已安装的 skills'));
104
+ process.exit(0);
105
+ }
106
+
107
+ // ── 安装 ─────────────────────────────────────────────
108
+ console.log(`
109
+ ${color.bold('🚀 harmonyos-skills-pack')}
110
+ ${color.cyan('从 GitHub 下载最新 skills...')}
111
+ `);
112
+
113
+ // 创建临时目录
114
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'hm-skills-'));
115
+
116
+ try {
117
+ // 下载并解压
118
+ console.log(` 📥 下载 ${ARCHIVE_URL}`);
119
+
120
+ try {
121
+ execSync(`curl -sL "${ARCHIVE_URL}" | tar -xz -C "${tmpDir}"`, {
122
+ stdio: ['pipe', 'pipe', 'pipe'],
123
+ timeout: 60000,
124
+ });
125
+ } catch (e) {
126
+ console.error(color.red('\n❌ 下载失败。请检查网络连接。'));
127
+ console.error(color.yellow(' 可尝试: git clone https://github.com/' + REPO + '.git'));
128
+ process.exit(1);
129
+ }
130
+
131
+ // 找到解压后的目录
132
+ const extracted = fs.readdirSync(tmpDir).find((d) =>
133
+ d.startsWith('harmonyos-skills-pack')
134
+ );
135
+ if (!extracted) {
136
+ console.error(color.red('❌ 解压失败,未找到预期目录'));
137
+ process.exit(1);
138
+ }
139
+ const sourceRoot = path.join(tmpDir, extracted);
140
+
141
+ // 复制 skills
142
+ let installed = 0;
143
+ for (const target of installTargets) {
144
+ for (const skill of SKILLS) {
145
+ const src = path.join(sourceRoot, 'skills', skill);
146
+ const dst = path.join(targetDir, target, skill);
147
+
148
+ if (!fs.existsSync(src)) {
149
+ console.log(` ${color.yellow('⚠')} 源文件不存在: skills/${skill}`);
150
+ continue;
151
+ }
152
+
153
+ if (fs.existsSync(dst)) {
154
+ if (force) {
155
+ fs.rmSync(dst, { recursive: true, force: true });
156
+ } else {
157
+ console.log(` ${color.yellow('⏭')} 已存在,跳过: ${dst} (用 --force 覆盖)`);
158
+ continue;
159
+ }
160
+ }
161
+
162
+ // 递归复制
163
+ fs.mkdirSync(path.dirname(dst), { recursive: true });
164
+ copyDirSync(src, dst);
165
+ console.log(` ${color.green('✓')} ${dst}`);
166
+ installed++;
167
+ }
168
+ }
169
+
170
+ // 复制 AGENTS.md 和 CLAUDE.md 到项目根目录(如果不存在)
171
+ for (const f of ['AGENTS.md', 'CLAUDE.md']) {
172
+ const src = path.join(sourceRoot, f);
173
+ const dst = path.join(targetDir, f);
174
+ if (fs.existsSync(src) && (!fs.existsSync(dst) || force)) {
175
+ fs.copyFileSync(src, dst);
176
+ console.log(` ${color.green('✓')} ${f}`);
177
+ }
178
+ }
179
+
180
+ // 完成
181
+ console.log(`
182
+ ${color.green(color.bold(`✅ 安装完成!${installed} 个 skill 目录已就位。`))}
183
+
184
+ ${color.cyan('下一步:')}
185
+ 1. 打开 AI 编程工具(Claude/Copilot/Codex)
186
+ 2. 开始提问鸿蒙开发问题,Agent 会自动读取 skills
187
+ 3. 示例: "帮我实现一个带登录的鸿蒙应用"
188
+
189
+ ${color.cyan('更多信息:')}
190
+ GitHub: https://github.com/${REPO}
191
+ 文档: npx harmonyos-skills-pack --help
192
+ `);
193
+
194
+ } finally {
195
+ // 清理临时目录
196
+ fs.rmSync(tmpDir, { recursive: true, force: true });
197
+ }
198
+
199
+ // ── 工具函数 ─────────────────────────────────────────
200
+ function copyDirSync(src, dst) {
201
+ fs.mkdirSync(dst, { recursive: true });
202
+ for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
203
+ const srcPath = path.join(src, entry.name);
204
+ const dstPath = path.join(dst, entry.name);
205
+ if (entry.isDirectory()) {
206
+ copyDirSync(srcPath, dstPath);
207
+ } else {
208
+ fs.copyFileSync(srcPath, dstPath);
209
+ }
210
+ }
211
+ }
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "harmonyos-skills-pack",
3
+ "version": "0.1.0",
4
+ "description": "一键安装鸿蒙 Ark 开发文档 + 通用产品质量 skills pack,适配 Claude/Copilot/Codex Agent",
5
+ "keywords": [
6
+ "harmonyos",
7
+ "arkts",
8
+ "arkui",
9
+ "skills",
10
+ "claude",
11
+ "copilot",
12
+ "codex",
13
+ "agent",
14
+ "ai"
15
+ ],
16
+ "author": "yibaiba",
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/yibaiba/harmonyos-skills-pack.git"
21
+ },
22
+ "bin": {
23
+ "harmonyos-skills-pack": "bin/cli.js"
24
+ },
25
+ "files": [
26
+ "bin/",
27
+ "README.md",
28
+ "LICENSE"
29
+ ],
30
+ "engines": {
31
+ "node": ">=16"
32
+ }
33
+ }