@moon791017/neo-skills 1.0.43 → 1.1.1
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/AGENTS.md +13 -22
- package/README.md +97 -121
- package/bin/_utils.js +0 -87
- package/bin/install-skills.js +61 -67
- package/package.json +4 -18
- package/.antigravityignore +0 -44
- package/dist/hooks/secret-guard.js +0 -5
- package/dist/server.js +0 -218
package/AGENTS.md
CHANGED
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
# Repository Guidelines
|
|
12
12
|
|
|
13
13
|
## Project Structure & Module Organization
|
|
14
|
-
`
|
|
14
|
+
`bin/` contains the installer CLI `install-system-instructions.js` and shared helpers. `skills/<skill-name>/` is the main content surface for contributors; each skill centers on a `SKILL.md` file and may also include `reference/` or `references/` docs, `assets/` templates, or reusable helper `scripts/`. Tests live in `test/*.test.js`.
|
|
15
15
|
|
|
16
16
|
## Build, Test, and Development Commands
|
|
17
|
-
Use `npm install` for local setup; CI uses `npm ci`.
|
|
17
|
+
Use `npm install` for local setup; CI uses `npm ci`. Use `npm test` to run the Node test suite (`node --test`).
|
|
18
18
|
|
|
19
19
|
## Coding Style & Naming Conventions
|
|
20
|
-
Use ESM modules, 2-space indentation, and keep code ASCII unless a file already uses localized text. Follow the existing style of the file you touch instead of reformatting unrelated lines; current JS utilities mostly use single quotes
|
|
20
|
+
Use ESM modules, 2-space indentation, and keep code ASCII unless a file already uses localized text. Follow the existing style of the file you touch instead of reformatting unrelated lines; current JS utilities mostly use single quotes. Prefer `camelCase` for functions and variables, `UPPER_SNAKE_CASE` for shared constants, and `kebab-case` for skill directories and hook filenames (for example, `neo-python`). Keep comments brief and only where intent is not obvious.
|
|
21
21
|
|
|
22
22
|
### AI Helper Script Specifications (scripts/)
|
|
23
23
|
When writing scripts under `skills/<skill-name>/scripts/` or global helper scripts:
|
|
@@ -26,44 +26,35 @@ When writing scripts under `skills/<skill-name>/scripts/` or global helper scrip
|
|
|
26
26
|
3. **Inline Dependencies (PEP 723)**: Python scripts must include an inline PEP 723 dependency block (e.g., `# /// script ...`) to enable self-contained runs via `uv run`.
|
|
27
27
|
|
|
28
28
|
## Testing Guidelines
|
|
29
|
-
Add or update tests whenever you change installer behavior, filesystem layout, or hook logic. Place tests in `test/` and name them `*.test.js`. Mirror existing patterns: use temp directories, assert on exit codes, and verify real files were created.
|
|
29
|
+
Add or update tests whenever you change installer behavior, filesystem layout, or hook logic. Place tests in `test/` and name them `*.test.js`. Mirror existing patterns: use temp directories, assert on exit codes, and verify real files were created. PR CI must pass `npm test`.
|
|
30
30
|
|
|
31
31
|
## Commit & Pull Request Guidelines
|
|
32
32
|
Follow the Conventional Commits pattern already used in history: `feat:`, `fix:`, `docs:`, `test(ci):`, `refactor(skills):`. Keep subjects short and imperative; add a scope when it clarifies impact. PRs against `develop` trigger the validation workflow, while merges to `main` feed the `release-please` release flow. In each PR, summarize behavior changes, list the commands you ran, and link the related issue when applicable.
|
|
33
33
|
|
|
34
34
|
## Security & Content Notes
|
|
35
|
-
Do not commit secrets, sample credentials, or unsafe prompts.
|
|
35
|
+
Do not commit secrets, sample credentials, or unsafe prompts. When updating a skill, keep its `SKILL.md`, references, and any user-facing docs aligned.
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
39
39
|
## 📂 系統架構
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
專案組織為主要核心層次:
|
|
42
42
|
|
|
43
|
-
###
|
|
44
|
-
擴充套件的進入點。提供了一個 MCP 伺服器,負責:
|
|
45
|
-
* 註冊 **工具 (Tools)**(例如:`fetch_web_content` 用於網頁擷取)。
|
|
46
|
-
* *注意:若要在 AGY CLI 中使用此工具,需手動在 AGY 的 MCP 設定中配置此伺服器。*
|
|
47
|
-
|
|
48
|
-
### 2. 知識庫 (`skills/` & `.agents/skills`)
|
|
43
|
+
### 知識庫 (`skills/` & `.agents/skills`)
|
|
49
44
|
每個子目錄代表一個包含專家知識的「技能模組」。
|
|
50
45
|
* **結構與漸進式揭露 (Progressive Disclosure) 規範:**
|
|
51
|
-
* `SKILL.md`:**大腦**。定義該領域的 **Perceive-Reason-Act** 迴圈。**其第一行必須是 YAML frontmatter 分界符
|
|
46
|
+
* `SKILL.md`:**大腦**。定義該領域的 **Perceive-Reason-Act** 迴圈。**其第一行必須是 YAML frontmatter 分界符 `---`**,並包含正確 the `name`(必須與其父目錄名稱完全一致以利 Discovery 自動偵測)與 trigger-focused 的 `description`。
|
|
52
47
|
* `references/`:**深度知識**。將詳細的檢核表、分析框架或長文檔放於此處,僅在 Reason 階段依需求由 Agent 動態載入。
|
|
53
48
|
* `assets/`:**輸出範本**。提供標準的 Markdown 結構範本,降低 Token 開銷。
|
|
54
49
|
* `evals/`:**評估集**。必須包含 `evals.json` 與 `eval_queries.json` 用於檢測技能的觸發率與輸出品質。
|
|
55
|
-
*
|
|
56
|
-
* **全域技能**: 載入自 `~/.gemini/
|
|
57
|
-
* **專案專屬技能**: 載入自專案根目錄下的 `.agents/skills
|
|
58
|
-
* **範例:** `skills/neo-azure-pipelines/` 包含設計 CI/CD
|
|
59
|
-
|
|
60
|
-
### 3. 安全層 (`src/hooks/`)
|
|
61
|
-
確保操作安全與數據隱私的機制。
|
|
62
|
-
* **安全守衛 (`secret-guard.ts`)**:一個即時分析工具執行參數的攔截掛鉤 (Hook)。它會阻斷涉及敏感檔案(如 `.env`, 私鑰, 憑證)的操作,以防止意外洩漏。
|
|
50
|
+
* **載入邏輯(對齊 npx skills add 標準):**
|
|
51
|
+
* **全域技能**: 載入自 `~/.gemini/skills/`,可透過 `npx skills add -g Benknightdark/neo-skills` 安裝。
|
|
52
|
+
* **專案專屬技能**: 載入自專案根目錄下的 `.agents/skills/`,可透過 `npx skills add Benknightdark/neo-skills` 安裝。
|
|
53
|
+
* **範例:** `skills/neo-azure-pipelines/` 包含設計 CI/CD 管線的邏輯, `skills/neo-typescript/` 包含 TypeScript 強型別與互通性最佳實踐。
|
|
63
54
|
|
|
64
55
|
## 💡 使用哲學
|
|
65
56
|
|
|
66
|
-
|
|
57
|
+
在使用此程式碼庫時,Agent 遵循 **Perceive-Reason-Act** 協定:
|
|
67
58
|
|
|
68
59
|
1. **感知 (Perceive)**:分析使用者的專案上下文(語言、框架、現有設定)。
|
|
69
60
|
2. **推理 (Reason)**:諮詢內部知識庫 (`SKILL.md`) 以制定策略。
|
package/README.md
CHANGED
|
@@ -86,176 +86,166 @@
|
|
|
86
86
|
|
|
87
87
|
* **AI 助手開發治理 (`skills/neo-agent-harness`)**:檢查專案規則、測試、CI、審查流程與安全防護是否足夠清楚,協助 AI 助手更穩定、更安全地參與開發。
|
|
88
88
|
|
|
89
|
-
### 13. 安全守衛 (Security Guard)
|
|
90
|
-
|
|
91
|
-
* **主動防護 (`secret-guard.ts`)**:作為 CLI 的中介軟體 (Hook),自動攔截並掃描所有工具執行的參數。若偵測到敏感資訊(如環境設定檔、私鑰、雲端憑證等)將強制阻擋執行,防止機密外洩。
|
|
92
|
-
|
|
93
89
|
## 📂 系統架構
|
|
94
90
|
|
|
95
|
-
|
|
91
|
+
本專案主要由標準專家技能模組組成的知識庫所構成:
|
|
96
92
|
|
|
97
93
|
| 層次 | 目錄 | 描述 |
|
|
98
94
|
| :--- | :--- | :--- |
|
|
99
|
-
| **Server** | `src/server.ts` | 擴充套件的進入點,負責註冊 Tool,處理與 AI Agent CLI 的通訊。 |
|
|
100
95
|
| **Knowledge Base** | `skills/` | **"大腦"**。包含各領域知識 (`SKILL.md`) 與可重用的模板 (`templates/`)。 |
|
|
101
|
-
| **Security Layer** | `src/hooks/` | **"安全守衛"**。攔截並掃描工具執行參數,防止敏感資訊外洩。 |
|
|
102
96
|
|
|
103
97
|
## 📦 安裝與使用
|
|
104
98
|
|
|
105
|
-
|
|
99
|
+
Neo Skills 已全面升級並支援專屬的極簡安裝器,同時相容於 [agentskills.io](https://agentskills.io) 官方推薦的 **Agent Skills 開源標準規範**。
|
|
106
100
|
|
|
107
|
-
|
|
108
|
-
| :--- | :--- | :--- | :--- |
|
|
109
|
-
| **Antigravity** | [Antigravity CLI](https://antigravity.google) | 透過外掛程式自動載入 | `agents.md` |
|
|
110
|
-
| **Claude** | [Claude Code](https://docs.anthropic.com/en/docs/claude-code) | `.claude/skills/` | `CLAUDE.md` |
|
|
111
|
-
| **Copilot** | [GitHub Copilot CLI](https://docs.github.com/en/copilot) | `.copilot/skills/`(全域)<br>`.github/skills/`(專案) | `.copilot/copilot-instructions.md`(全域)<br>`.github/copilot-instructions.md`(專案) |
|
|
112
|
-
| **Codex** | [OpenAI Codex CLI](https://github.com/openai/codex) | `.codex/skills/` | `AGENTS.md` |
|
|
113
|
-
|
|
114
|
-
Neo Skills 提供兩個 CLI 工具,分別用於安裝**技能模組**與**系統提示詞**:
|
|
115
|
-
|
|
116
|
-
| 工具 | 用途 | 安裝目標 |
|
|
117
|
-
| :--- | :--- | :--- |
|
|
118
|
-
| `install-skills` | 將技能模組(`skills/`)複製到 Agent 的技能目錄 | 資料夾(如 `.claude/skills`) |
|
|
119
|
-
| `install-system-instructions` | 將系統提示詞寫入 Agent 的指導檔 | 單一檔案(如 `CLAUDE.md`) |
|
|
120
|
-
|
|
121
|
-
> 兩個工具皆支援 `--ai-agent` 與 `--project-path` 參數,邏輯一致。
|
|
101
|
+
根據您的使用場景,可以選擇以下兩種最適合您的安裝方式:
|
|
122
102
|
|
|
123
103
|
---
|
|
124
104
|
|
|
125
|
-
###
|
|
105
|
+
### 一、一鍵同步全域技能(Antigravity CLI 專用,推薦)
|
|
126
106
|
|
|
127
|
-
Antigravity CLI
|
|
107
|
+
如果您使用的是 **Antigravity CLI**,建議使用專門設計的 `neo-skills` 安裝工具(舊稱 `install-skills`)。這是一個極簡化的工具,會一鍵將本專案所有的專家技能,複製到您的全域路徑 `~/.gemini/antigravity-cli/skills` 中,同時自動過濾無關檔案(如 `.git`、`node_modules`、`.DS_Store` 等)。
|
|
128
108
|
|
|
109
|
+
#### 透過 npx 直接執行:
|
|
129
110
|
```bash
|
|
130
|
-
|
|
131
|
-
npx -p @moon791017/neo-skills install-skills --ai-agent agy -y
|
|
111
|
+
npx -y @moon791017/neo-skills@latest
|
|
132
112
|
```
|
|
133
113
|
|
|
134
|
-
|
|
114
|
+
#### 本地開發手動安裝:
|
|
115
|
+
如果您已複製本專案至本地,也可以直接在專案根目錄下執行:
|
|
116
|
+
```bash
|
|
117
|
+
node bin/install-skills.js
|
|
118
|
+
```
|
|
135
119
|
|
|
136
120
|
---
|
|
137
121
|
|
|
138
|
-
###
|
|
122
|
+
### 二、使用標準 Skills CLI 安裝(通用於專案或其他 AI Agent)
|
|
139
123
|
|
|
140
|
-
|
|
124
|
+
針對其他支援 [agentskills.io](https://agentskills.io) 標準規範的 AI 代理(如 Claude Code, Cursor, Copilot 等),您可以使用標準的 `skills` 包管理器。預設會安裝至當前專案,**若您希望將技能安裝至全域路徑,只需在指令後方加上 `-g` 參數**。
|
|
141
125
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
install-skills [--ai-agent <name>] [--project-path <path>]
|
|
126
|
+
#### 1. 專案一鍵安裝所有技能(免互動勾選):
|
|
127
|
+
```bash
|
|
128
|
+
npx skills add Benknightdark/neo-skills --all
|
|
146
129
|
```
|
|
147
130
|
|
|
148
|
-
|
|
131
|
+
> [!TIP]
|
|
132
|
+
> * **全域一鍵安裝**:若要將所有技能安裝至標準全域路徑下,只需加上 `-g`:`npx skills add Benknightdark/neo-skills --all -g`。
|
|
133
|
+
> * **命令行指定**:若只需安裝特定 Skill,可以使用 `--skill <名稱>`(例如 `npx skills add Benknightdark/neo-skills --skill neo-typescript,neo-vue`)。
|
|
149
134
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
**安裝路徑對照:**
|
|
156
|
-
|
|
157
|
-
| Agent | 全域路徑 | 專案路徑 |
|
|
158
|
-
| :--- | :--- | :--- |
|
|
159
|
-
| Antigravity | `~/.gemini/skills/` | `<project>/.agents/skills/` |
|
|
160
|
-
| Claude | `~/.claude/skills/` | `<project>/.claude/skills/` |
|
|
161
|
-
| Copilot | `~/.copilot/skills/` | `<project>/.github/skills/` |
|
|
162
|
-
| Codex | `~/.codex/skills/` | `<project>/.codex/skills/` |
|
|
135
|
+
#### 💡 終端機互動選單操作小秘訣:
|
|
136
|
+
如果您執行了不帶 `--all` 的預設互動選單命令 `npx skills add Benknightdark/neo-skills`:
|
|
137
|
+
1. **一鍵全選 (Select All)**:在選單畫面中直接按下鍵盤上的 **`a`** 鍵,即可立刻自動勾選所有的技能!
|
|
138
|
+
2. **反向選取 (Invert Selection)**:按下鍵盤上的 **`i`** 鍵,反向切換目前的所有勾選狀態。
|
|
139
|
+
3. **確認送出**:全選後按下 `Enter` 鍵即可一次完成安裝。
|
|
163
140
|
|
|
164
|
-
|
|
141
|
+
---
|
|
165
142
|
|
|
166
|
-
|
|
167
|
-
# 安裝指定 Agent 至全域
|
|
168
|
-
npx -p @moon791017/neo-skills install-skills --ai-agent claude -y
|
|
143
|
+
### 三、按需安裝特定技能
|
|
169
144
|
|
|
170
|
-
|
|
171
|
-
npx -p @moon791017/neo-skills install-skills --ai-agent copilot --project-path /my/project -y
|
|
145
|
+
如果您只需要其中某幾項特定領域的專家技能,您可以使用 `--skill` 參數指定安裝:
|
|
172
146
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
147
|
+
| 內建專家技能 | 一鍵安裝指令 |
|
|
148
|
+
| :--- | :--- |
|
|
149
|
+
| **1. C# 語法專家** | `npx skills add Benknightdark/neo-skills --skill neo-csharp` |
|
|
150
|
+
| **2. .NET 核心路由** | `npx skills add Benknightdark/neo-skills --skill neo-dotnet` |
|
|
151
|
+
| **3. .NET Minimal APIs 專家** | `npx skills add Benknightdark/neo-skills --skill neo-dotnet-minimal-apis` |
|
|
152
|
+
| **4. .NET Web API 專家** | `npx skills add Benknightdark/neo-skills --skill neo-dotnet-webapi` |
|
|
153
|
+
| **5. .NET MVC 專家** | `npx skills add Benknightdark/neo-skills --skill neo-dotnet-mvc` |
|
|
154
|
+
| **6. EF Core 專家** | `npx skills add Benknightdark/neo-skills --skill neo-dotnet-ef-core` |
|
|
155
|
+
| **7. .NET Tag Helper 專家** | `npx skills add Benknightdark/neo-skills --skill neo-dotnet-tag-helper` |
|
|
156
|
+
| **8. C# Interface 生成器** | `npx skills add Benknightdark/neo-skills --skill neo-csharp-interface-generator` |
|
|
157
|
+
| **9. Python 3.10+ 專家** | `npx skills add Benknightdark/neo-skills --skill neo-python` |
|
|
158
|
+
| **10. Python 環境與依賴管理專家** | `npx skills add Benknightdark/neo-skills --skill neo-python-manager` |
|
|
159
|
+
| **11. Swift 5.0+ 專家** | `npx skills add Benknightdark/neo-skills --skill neo-swift` |
|
|
160
|
+
| **12. SwiftUI 專家** | `npx skills add Benknightdark/neo-skills --skill neo-swift-ui` |
|
|
161
|
+
| **13. JavaScript 專家** | `npx skills add Benknightdark/neo-skills --skill neo-javascript` |
|
|
162
|
+
| **14. TypeScript 專家** | `npx skills add Benknightdark/neo-skills --skill neo-typescript` |
|
|
163
|
+
| **15. Vue 3 現代開發專家** | `npx skills add Benknightdark/neo-skills --skill neo-vue` |
|
|
164
|
+
| **16. Rust 開發專家** | `npx skills add Benknightdark/neo-skills --skill neo-rust` |
|
|
165
|
+
| **17. DevOps (Azure Pipelines) 架構師** | `npx skills add Benknightdark/neo-skills --skill neo-azure-pipelines` |
|
|
166
|
+
| **18. Code Review 專家** | `npx skills add Benknightdark/neo-skills --skill neo-code-review` |
|
|
167
|
+
| **19. 程式碼解釋助手** | `npx skills add Benknightdark/neo-skills --skill neo-explain` |
|
|
168
|
+
| **20. 需求分析與釐清助手** | `npx skills add Benknightdark/neo-skills --skill neo-clarification` |
|
|
169
|
+
| **21. AI 開發流程治理專家** | `npx skills add Benknightdark/neo-skills --skill neo-agent-harness` |
|
|
176
170
|
|
|
177
171
|
---
|
|
178
172
|
|
|
179
|
-
###
|
|
173
|
+
### 四、安裝系統提示詞 (`install-system-instructions`)
|
|
180
174
|
|
|
181
|
-
|
|
175
|
+
> [!IMPORTANT]
|
|
176
|
+
> **獨家加值特色功能**:由於 [agentskills.io](https://agentskills.io) 標準僅處理 `.agents/skills` 專案技能的目錄同步,**並未提供將核心系統提示詞(System Instructions)附加至 AI 代理引導檔** 的功能。
|
|
177
|
+
>
|
|
178
|
+
> 為了解決這個問題,Neo Skills 專門保留並提供強大的系統提示詞安裝器 `install-system-instructions`。此 CLI 工具會自動掃描、建立,並在不破壞您既有檔案內容的前提下,將專家提示詞完美附加或更新至各 AI 代理的專屬引導檔中。
|
|
182
179
|
|
|
183
180
|
**語法:**
|
|
184
181
|
|
|
185
|
-
```
|
|
186
|
-
install-system-instructions --instructions <key> [--ai-agent <name>] [--project-path <path>]
|
|
182
|
+
```bash
|
|
183
|
+
npx -p @moon791017/neo-skills install-system-instructions --instructions <key> [--ai-agent <name>] [--project-path <path>] [--replace-all]
|
|
187
184
|
```
|
|
188
185
|
|
|
189
|
-
|
|
186
|
+
**參數與引數說明:**
|
|
190
187
|
|
|
191
188
|
| 參數 | 必填 | 說明 |
|
|
192
189
|
| :--- | :---: | :--- |
|
|
193
|
-
| `--instructions <key>` | ✅ |
|
|
194
|
-
| `--ai-agent <name>` | 否 | 指定目標 Agent(`claude` / `copilot` / `codex`)。省略時安裝至全部。 |
|
|
195
|
-
| `--project-path <path>` | 否 |
|
|
196
|
-
| `--replace-all` | 否 |
|
|
190
|
+
| `--instructions <key>` | ✅ | 指定要安裝的系統提示詞(可用選項見下方列表)。 |
|
|
191
|
+
| `--ai-agent <name>` | 否 | 指定目標 Agent(`claude` / `copilot` / `codex` / `agy`)。省略時安裝至全部。 |
|
|
192
|
+
| `--project-path <path>` | 否 | 指定專案根目錄。省略時安裝至使用者的全域路徑。 |
|
|
193
|
+
| `--replace-all` | 否 | 若先前已安裝過該提示詞,則會將其移除後全新重裝,適合用於更新提示詞版本。 |
|
|
197
194
|
|
|
198
|
-
|
|
195
|
+
**系統引導檔路徑對照:**
|
|
199
196
|
|
|
200
|
-
| Agent |
|
|
197
|
+
| Agent | 全域引導檔路徑 | 專案引導檔路徑 |
|
|
201
198
|
| :--- | :--- | :--- |
|
|
202
|
-
| Claude | `~/.claude/CLAUDE.md` | `<project>/CLAUDE.md` |
|
|
203
|
-
| Copilot | `~/.copilot/copilot-instructions.md` | `<project>/.github/copilot-instructions.md` |
|
|
204
|
-
| Codex | `~/.codex/AGENTS.md` | `<project>/AGENTS.md` |
|
|
199
|
+
| **Claude Code** | `~/.claude/CLAUDE.md` | `<project>/CLAUDE.md` |
|
|
200
|
+
| **Copilot CLI** | `~/.copilot/copilot-instructions.md` | `<project>/.github/copilot-instructions.md` |
|
|
201
|
+
| **Codex** | `~/.codex/AGENTS.md` | `<project>/AGENTS.md` |
|
|
202
|
+
| **Antigravity (AGY)** | `~/.gemini/antigravity-cli/instructions.md` | `<project>/agents.md` |
|
|
205
203
|
|
|
206
|
-
|
|
204
|
+
**支援的系統提示詞種類:**
|
|
207
205
|
|
|
208
|
-
| Key |
|
|
206
|
+
| Key | 提示詞名稱 | 核心功能與扮演角色 |
|
|
209
207
|
| :--- | :--- | :--- |
|
|
210
|
-
| `technical-co-founder` | Technical Co-Founder | 讓 AI
|
|
211
|
-
| `git-commit` | Git Commit Message Generator |
|
|
212
|
-
| `fact-check` | Fact-Check Thinking | 強制 AI 在回答前先進行「事實檢查思考」,嚴格依據來源與事實回答,避免臆測與捏造內容。 |
|
|
208
|
+
| `technical-co-founder` | **Technical Co-Founder** | 讓 AI 扮演您的技術共同創辦人,以 Discovery → Planning → Building → Polish → Handoff 五階段框架,協助您從零打造可上線的真實產品。 |
|
|
209
|
+
| `git-commit` | **Git Commit Message Generator** | 智能分析暫存區變更,自動生成符合 Conventional Commits 規範的精確提交訊息,經確認後一鍵提交。 |
|
|
210
|
+
| `fact-check` | **Fact-Check Thinking** | 強制 AI 在回答前先進行「事實檢查思考」,嚴格依據來源與事實回答,避免臆測與捏造內容。 |
|
|
213
211
|
|
|
214
|
-
|
|
212
|
+
**實用範例:**
|
|
215
213
|
|
|
216
214
|
```bash
|
|
217
|
-
#
|
|
218
|
-
npx -p @moon791017/neo-skills install-system-instructions
|
|
219
|
-
--instructions technical-co-founder -y
|
|
220
|
-
|
|
221
|
-
# 安裝至指定 Agent 的全域指導檔 (~/.claude/CLAUDE.md)
|
|
222
|
-
npx -p @moon791017/neo-skills install-system-instructions \
|
|
223
|
-
--ai-agent claude --instructions technical-co-founder -y
|
|
215
|
+
# 1. 一次安裝「技術共同創辦人」提示詞至全部支援的 AI Agent 全域引導檔
|
|
216
|
+
npx -p @moon791017/neo-skills install-system-instructions --instructions technical-co-founder -y
|
|
224
217
|
|
|
225
|
-
#
|
|
226
|
-
npx -p @moon791017/neo-skills install-system-instructions
|
|
227
|
-
--ai-agent claude --instructions technical-co-founder --project-path /my/project -y
|
|
218
|
+
# 2. 安裝「技術共同創辦人」提示詞至 Claude Code 的專案級 CLAUDE.md
|
|
219
|
+
npx -p @moon791017/neo-skills install-system-instructions --ai-agent claude --instructions technical-co-founder --project-path . -y
|
|
228
220
|
|
|
229
|
-
#
|
|
230
|
-
npx -p @moon791017/neo-skills install-system-instructions
|
|
231
|
-
--ai-agent copilot --instructions technical-co-founder --project-path /my/project -y
|
|
221
|
+
# 3. 如果需要更新/覆蓋已安裝的 git-commit 提示詞,加上 --replace-all 進行重裝
|
|
222
|
+
npx -p @moon791017/neo-skills install-system-instructions --ai-agent claude --instructions git-commit --replace-all -y
|
|
232
223
|
```
|
|
233
224
|
|
|
234
|
-
|
|
225
|
+
---
|
|
235
226
|
|
|
236
227
|
## 💡 常用指令範例
|
|
237
228
|
|
|
238
|
-
|
|
229
|
+
您可以根據不同的開發與維運需求場景,快速安裝對應的專家技能,並直接對 AI 代理下達相關指令:
|
|
239
230
|
|
|
240
|
-
| 需求場景 | 推薦咒語範例 |
|
|
241
|
-
| :--- | :--- |
|
|
242
|
-
| **設定 .NET CI Pipeline** | `幫這個專案設定 CI 流程` |
|
|
243
|
-
| **部署至 IIS** | `部署到 IIS,站台名稱為 MySite` |
|
|
244
|
-
|
|
|
245
|
-
|
|
|
246
|
-
| **生成 C# Interface
|
|
247
|
-
| **
|
|
248
|
-
|
|
|
249
|
-
| **AI
|
|
231
|
+
| 需求場景 | 所需專家技能 | 快速安裝指令 | 推薦咒語範例 |
|
|
232
|
+
| :--- | :--- | :--- | :--- |
|
|
233
|
+
| **設定 .NET CI Pipeline** | `neo-azure-pipelines` | `npx skills add Benknightdark/neo-skills --skill neo-azure-pipelines` | `幫這個專案設定 CI 流程` |
|
|
234
|
+
| **部署至 IIS On-Premises** | `neo-azure-pipelines` | `npx skills add Benknightdark/neo-skills --skill neo-azure-pipelines` | `部署到 IIS,站台名稱為 MySite` |
|
|
235
|
+
| **全方位程式碼深度審查** | `neo-code-review` | `npx skills add Benknightdark/neo-skills --skill neo-code-review` | `幫我 code review 剛才的修改` |
|
|
236
|
+
| **技術解析與架構洞察** | `neo-explain` | `npx skills add Benknightdark/neo-skills --skill neo-explain` | `分析這個專案的架構` |
|
|
237
|
+
| **生成 C# Interface 介面** | `neo-csharp-interface-generator` | `npx skills add Benknightdark/neo-skills --skill neo-csharp-interface-generator` | `幫我針對這個 class 產生介面` |
|
|
238
|
+
| **TS 型別設計與 CJS/ESM 互通** | `neo-typescript` | `npx skills add Benknightdark/neo-skills --skill neo-typescript` | `解決 tsconfig 還有 ESM/CJS 互通性的問題` |
|
|
239
|
+
| **複雜/模糊需求釐清與規格化** | `neo-clarification` | `npx skills add Benknightdark/neo-skills --skill neo-clarification` | `我想做一個電商網站` |
|
|
240
|
+
| **AI 助手開發治理與流程健檢** | `neo-agent-harness` | `npx skills add Benknightdark/neo-skills --skill neo-agent-harness` | `幫我檢查這個專案怎麼讓 AI 助手開發得更穩、更安全` |
|
|
250
241
|
|
|
251
|
-
## 🛠
|
|
242
|
+
## 🛠 開發與測試指南
|
|
252
243
|
|
|
253
|
-
|
|
244
|
+
本專案支援本地測試與 NPM 打包。
|
|
254
245
|
|
|
255
246
|
### 前置需求
|
|
256
247
|
|
|
257
248
|
* **[Node.js](https://nodejs.org/) (v18+)**:基本執行環境。
|
|
258
|
-
* **[Bun](https://bun.sh/)**:僅在**開發**、**建置**或執行 **Gemini MCP Server** 時需要。
|
|
259
249
|
|
|
260
250
|
### 快速開始
|
|
261
251
|
|
|
@@ -265,22 +255,8 @@ npx -p @moon791017/neo-skills install-system-instructions \
|
|
|
265
255
|
npm install
|
|
266
256
|
```
|
|
267
257
|
|
|
268
|
-
2.
|
|
269
|
-
直接執行原始碼進行測試:
|
|
270
|
-
|
|
271
|
-
```bash
|
|
272
|
-
bun src/server.ts
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
3. **建置專案**
|
|
276
|
-
將 TypeScript 編譯並打包至 `dist/` 目錄:
|
|
277
|
-
|
|
278
|
-
```bash
|
|
279
|
-
bun run build
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
4. **類型檢查**
|
|
258
|
+
2. **執行單元測試**
|
|
283
259
|
|
|
284
260
|
```bash
|
|
285
|
-
|
|
261
|
+
npm test
|
|
286
262
|
```
|
package/bin/_utils.js
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared utilities for agent skill installers.
|
|
3
3
|
*/
|
|
4
|
-
import { cp, mkdir, access } from 'node:fs/promises';
|
|
5
|
-
import { join, resolve, dirname } from 'node:path';
|
|
6
|
-
import { homedir } from 'node:os';
|
|
7
|
-
import { fileURLToPath } from 'node:url';
|
|
8
|
-
|
|
9
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
const packageRoot = resolve(__dirname, '..');
|
|
11
|
-
const sourceDir = join(packageRoot, 'skills');
|
|
12
4
|
|
|
13
5
|
/**
|
|
14
6
|
* Agent 設定中心 — 所有 agent 的安裝參數集中管理於此。
|
|
@@ -61,82 +53,3 @@ export const AGENTS = {
|
|
|
61
53
|
hint: 'Neo Skills 已安裝。請確保 AGY 已載入 instructions.md 或 agents.md 作為上下文檔案。',
|
|
62
54
|
},
|
|
63
55
|
};
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* 根據 agent config 建立 installer 函式。
|
|
67
|
-
*
|
|
68
|
-
* 路徑解析邏輯:
|
|
69
|
-
* 1. 決定根目錄 (baseDir):
|
|
70
|
-
* - 有 --project-path → 使用者指定的絕對路徑
|
|
71
|
-
* - 無 --project-path → $HOME
|
|
72
|
-
* 2. 決定子目錄 (subDir):
|
|
73
|
-
* - 有 --project-path 且 config 定義了 projectPath → 使用 projectPath
|
|
74
|
-
* - 其餘情況 → 使用 homePath
|
|
75
|
-
* 3. 最終安裝路徑 = baseDir + subDir
|
|
76
|
-
*
|
|
77
|
-
* 範例(以 Copilot 為例):
|
|
78
|
-
* 預設: ~/.copilot/skills (homedir + homePath)
|
|
79
|
-
* --project-path /my/project: /my/project/.github/skills (projectPath + projectPath)
|
|
80
|
-
*
|
|
81
|
-
* @param {object} config - AGENTS 中的 agent 設定物件
|
|
82
|
-
* @param {string} [targetPath] - 使用者透過 --project-path 指定的自訂根目錄
|
|
83
|
-
*/
|
|
84
|
-
export function createInstaller({ name: agentName, homePath, projectPath, sourceDir: customSourceDir, hint }, cliBasePath) {
|
|
85
|
-
return async function install() {
|
|
86
|
-
console.log(`🚀 [${agentName}] 開始同步 Neo Skills...`);
|
|
87
|
-
|
|
88
|
-
const effectiveSourceDir = customSourceDir ? resolve(packageRoot, customSourceDir) : sourceDir;
|
|
89
|
-
|
|
90
|
-
try {
|
|
91
|
-
await access(effectiveSourceDir);
|
|
92
|
-
} catch {
|
|
93
|
-
const msg = `在 ${effectiveSourceDir} 找不到來源目錄。`;
|
|
94
|
-
console.error(`❌ 錯誤: ${msg}`);
|
|
95
|
-
return { success: false, message: msg };
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// 根目錄:--project-path 優先,否則 $HOME
|
|
99
|
-
const baseDir = cliBasePath ? resolve(cliBasePath) : homedir();
|
|
100
|
-
// 子目錄:專案層級有獨立路徑時採用 projectPath,否則用預設的 homePath
|
|
101
|
-
const subDir = cliBasePath && projectPath ? projectPath : homePath;
|
|
102
|
-
const targetSkillsDir = join(baseDir, subDir);
|
|
103
|
-
|
|
104
|
-
console.log(`📁 來源路徑: ${effectiveSourceDir}`);
|
|
105
|
-
console.log(`🎯 目標路徑: ${targetSkillsDir}`);
|
|
106
|
-
|
|
107
|
-
await mkdir(targetSkillsDir, { recursive: true });
|
|
108
|
-
|
|
109
|
-
let copyCount = 0;
|
|
110
|
-
await cp(effectiveSourceDir, targetSkillsDir, {
|
|
111
|
-
recursive: true,
|
|
112
|
-
force: true,
|
|
113
|
-
filter: (src) => {
|
|
114
|
-
const relativePath = src.replace(effectiveSourceDir, '');
|
|
115
|
-
const isIgnored =
|
|
116
|
-
relativePath.includes('node_modules') ||
|
|
117
|
-
relativePath.includes('.git') ||
|
|
118
|
-
relativePath.includes('dist') ||
|
|
119
|
-
relativePath.includes('.antigravitycli') ||
|
|
120
|
-
relativePath.includes('.agents');
|
|
121
|
-
|
|
122
|
-
if (!isIgnored) {
|
|
123
|
-
// 只有當 src 不是目錄時才增加計數,或者簡化計數邏輯
|
|
124
|
-
copyCount++;
|
|
125
|
-
return true;
|
|
126
|
-
}
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
if (copyCount === 0) {
|
|
132
|
-
console.warn('⚠️ 警告: 沒有任何檔案被複製。請檢查來源目錄是否正確。');
|
|
133
|
-
return { success: true, message: '沒有任何檔案被複製' };
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const displayPath = cliBasePath || homePath;
|
|
137
|
-
const msg = `已同步 ${copyCount} 個檔案/資料夾至 ${displayPath}`;
|
|
138
|
-
console.log(`✅ [${agentName}] 安裝成功!${msg}`);
|
|
139
|
-
if (hint) console.log(`💡 提示: ${hint}`);
|
|
140
|
-
return { success: true, message: msg };
|
|
141
|
-
};
|
|
142
|
-
}
|
package/bin/install-skills.js
CHANGED
|
@@ -1,90 +1,84 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Neo Skills
|
|
3
|
+
* Neo Skills — 全域技能安裝程式
|
|
4
4
|
*
|
|
5
5
|
* 用法:
|
|
6
|
-
* install-skills
|
|
7
|
-
* install-skills --ai-agent claude 只安裝 Claude 技能至 $HOME
|
|
8
|
-
* install-skills --ai-agent copilot --project-path . 安裝 Copilot 技能至指定專案
|
|
9
|
-
*
|
|
10
|
-
* 參數:
|
|
11
|
-
* --ai-agent <name> 指定要安裝的 agent(可用值見 _utils.js 的 AGENTS)。
|
|
12
|
-
* 省略時安裝全部 agent。
|
|
13
|
-
* --project-path <path> 指定專案根目錄作為安裝基底(取代 $HOME)。
|
|
14
|
-
* 省略時安裝至全域路徑。
|
|
6
|
+
* install-skills 安裝專案的技能至全域 Antigravity CLI 技能目錄 (~/.gemini/skills)
|
|
15
7
|
*/
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
8
|
+
import { cp, mkdir, access } from 'node:fs/promises';
|
|
9
|
+
import { join, resolve, dirname } from 'node:path';
|
|
10
|
+
import { homedir } from 'node:os';
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
18
12
|
|
|
19
|
-
setupGlobalErrorHandlers
|
|
13
|
+
import { setupGlobalErrorHandlers } from './_cli-utils.js';
|
|
20
14
|
|
|
21
|
-
|
|
22
|
-
// 統一解析 CLI 參數
|
|
23
|
-
const args = parseCliArgs();
|
|
24
|
-
const agentKey = args['ai-agent'];
|
|
25
|
-
const projectPath = args['project-path'];
|
|
26
|
-
|
|
27
|
-
// ── 模式一:指定單一 agent ──
|
|
28
|
-
if (agentKey) {
|
|
29
|
-
// 以 AGENTS 作為唯一白名單來源,避免使用者輸入未支援的 agent 名稱。
|
|
30
|
-
const config = AGENTS[agentKey];
|
|
31
|
-
if (!config) {
|
|
32
|
-
const valid = Object.keys(AGENTS).join(', ');
|
|
33
|
-
console.error(`❌ 未知的 agent: "${agentKey}"。可用選項: ${valid}`);
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
15
|
+
setupGlobalErrorHandlers();
|
|
36
16
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const result = await installFn();
|
|
41
|
-
if (!result.success) process.exit(1);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
17
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
const packageRoot = resolve(__dirname, '..');
|
|
19
|
+
const sourceDir = join(packageRoot, 'skills');
|
|
44
20
|
|
|
45
|
-
|
|
21
|
+
async function main() {
|
|
46
22
|
console.log('╔══════════════════════════════════════════╗');
|
|
47
|
-
console.log('║ 🧠 Neo Skills —
|
|
23
|
+
console.log('║ 🧠 Neo Skills — 全域技能安裝程式 ║');
|
|
48
24
|
console.log('╚══════════════════════════════════════════╝');
|
|
49
25
|
console.log('');
|
|
50
26
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
console.log(`━━━ 正在安裝: ${config.name} ━━━`);
|
|
57
|
-
try {
|
|
58
|
-
const installFn = createInstaller(config, projectPath);
|
|
59
|
-
const result = await installFn();
|
|
60
|
-
results.push({ name: config.name, ...result });
|
|
61
|
-
} catch (error) {
|
|
62
|
-
console.error(`❌ [${config.name}] 安裝失敗:`, error.message || error);
|
|
63
|
-
results.push({ name: config.name, success: false, message: error.message || String(error) });
|
|
64
|
-
}
|
|
65
|
-
console.log('');
|
|
27
|
+
try {
|
|
28
|
+
await access(sourceDir);
|
|
29
|
+
} catch {
|
|
30
|
+
console.error(`❌ 錯誤: 找不到來源技能目錄 ${sourceDir}`);
|
|
31
|
+
process.exit(1);
|
|
66
32
|
}
|
|
67
33
|
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const failed = results.filter(r => !r.success);
|
|
72
|
-
|
|
73
|
-
// 統一列出每個 agent 的最終結果,讓使用者能快速判斷成功與失敗原因。
|
|
74
|
-
for (const r of results) {
|
|
75
|
-
console.log(` ${r.success ? '✅' : '❌'} ${r.name}: ${r.message}`);
|
|
76
|
-
}
|
|
34
|
+
// 決定安裝目標路徑 (支援透過 TEST_HOME_DIR 覆寫以供測試)
|
|
35
|
+
const home = process.env.TEST_HOME_DIR || homedir();
|
|
36
|
+
const targetDir = join(home, '.gemini/antigravity-cli/skills');
|
|
77
37
|
|
|
38
|
+
console.log(`🚀 開始同步 Neo Skills 至全域 Antigravity CLI...`);
|
|
39
|
+
console.log(`📁 來源路徑: ${sourceDir}`);
|
|
40
|
+
console.log(`🎯 目標路徑: ${targetDir}`);
|
|
78
41
|
console.log('');
|
|
79
|
-
console.log(`成功: ${results.length - failed.length} / ${results.length}`);
|
|
80
42
|
|
|
81
|
-
|
|
82
|
-
|
|
43
|
+
try {
|
|
44
|
+
await mkdir(targetDir, { recursive: true });
|
|
45
|
+
|
|
46
|
+
let copyCount = 0;
|
|
47
|
+
await cp(sourceDir, targetDir, {
|
|
48
|
+
recursive: true,
|
|
49
|
+
force: true,
|
|
50
|
+
filter: (src) => {
|
|
51
|
+
// 解析相對於來源目錄的相對路徑
|
|
52
|
+
const relativePath = src.replace(sourceDir, '');
|
|
53
|
+
|
|
54
|
+
// 忽略無關的隱藏檔案或特定資料夾
|
|
55
|
+
const isIgnored =
|
|
56
|
+
relativePath.includes('node_modules') ||
|
|
57
|
+
relativePath.includes('.git') ||
|
|
58
|
+
relativePath.includes('dist') ||
|
|
59
|
+
relativePath.includes('.antigravitycli') ||
|
|
60
|
+
relativePath.includes('.agents') ||
|
|
61
|
+
relativePath.includes('.DS_Store');
|
|
62
|
+
|
|
63
|
+
if (!isIgnored) {
|
|
64
|
+
copyCount++;
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (copyCount === 0) {
|
|
72
|
+
console.warn('⚠️ 警告: 沒有任何技能檔案被複製。');
|
|
73
|
+
} else {
|
|
74
|
+
console.log('══════════════════════════════════════════');
|
|
75
|
+
console.log(`✅ 安裝成功!已同步 ${copyCount} 個項目到全域。`);
|
|
76
|
+
console.log('💡 提示: Neo Skills 已成功安裝。請確保您的 Antigravity CLI 已正常啟用技能!');
|
|
77
|
+
}
|
|
78
|
+
} catch (error) {
|
|
79
|
+
console.error(`❌ 安裝失敗:`, error.message || error);
|
|
83
80
|
process.exit(1);
|
|
84
81
|
}
|
|
85
|
-
|
|
86
|
-
console.log('🎉 全部安裝完成!');
|
|
87
82
|
}
|
|
88
83
|
|
|
89
|
-
// 以單一入口啟動 CLI,讓所有例外都集中經過上方的全域錯誤處理。
|
|
90
84
|
main();
|