feat(review): 匯入 jsc-review 技能組並統一 marketplace 為 jsc #2
@@ -1,11 +1,74 @@
|
||||
{
|
||||
"name": "template",
|
||||
"name": "jsc",
|
||||
"plugins": [
|
||||
{
|
||||
"name": "jsc-template",
|
||||
"name": "jsc-ask",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/template.git"
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/ask.git"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "jsc-cli",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/cli.git"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "jsc-git",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/git.git"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "jsc-gitea",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/gitea.git"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "jsc-hooks",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/hooks.git"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "jsc-log",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/log.git"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "jsc-meta",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/meta.git"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "jsc-pkg",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/pkg.git"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "jsc-review",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/review.git"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "jsc-sdlc",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/sdlc.git"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,14 +1,89 @@
|
||||
{
|
||||
"name": "template",
|
||||
"description": "JSC 跨 AI 助理共用 skills 的 Claude Code marketplace。",
|
||||
"name": "jsc",
|
||||
"description": "jsc 跨 AI 助理技能組的統一 marketplace(claude / codex / copilot / antigravity / kiro)。",
|
||||
"owner": {
|
||||
"name": "JSC"
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
"name": "jsc-template",
|
||||
"source": "./",
|
||||
"description": "JSC 共用 skills(跨 AI 助理)"
|
||||
"name": "jsc-ask",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/ask.git"
|
||||
},
|
||||
"description": "決策樹問詢與問詢紀錄(QUESTION_* wiki 頁)"
|
||||
},
|
||||
{
|
||||
"name": "jsc-cli",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/cli.git"
|
||||
},
|
||||
"description": "CLI 偵測、模型能力標籤與技能庫批次部署"
|
||||
},
|
||||
{
|
||||
"name": "jsc-git",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/git.git"
|
||||
},
|
||||
"description": "Commit 分組認可與 Push Request 建立"
|
||||
},
|
||||
{
|
||||
"name": "jsc-gitea",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/gitea.git"
|
||||
},
|
||||
"description": "Gitea API 工具、Wiki 讀寫與存取庫批次同步"
|
||||
},
|
||||
{
|
||||
"name": "jsc-hooks",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/hooks.git"
|
||||
},
|
||||
"description": "跨 CLI hooks:STE100 語言強制、工時計時、技能用量記錄"
|
||||
},
|
||||
{
|
||||
"name": "jsc-log",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/log.git"
|
||||
},
|
||||
"description": "工作日誌(LOG_* wiki 頁)與技能使用統計"
|
||||
},
|
||||
{
|
||||
"name": "jsc-meta",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/meta.git"
|
||||
},
|
||||
"description": "技能組自我管理:新建/更新/刪除技能與技能準則"
|
||||
},
|
||||
{
|
||||
"name": "jsc-pkg",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/pkg.git"
|
||||
},
|
||||
"description": "套件批次更新(nodejs/python/dotnet),失敗還原"
|
||||
},
|
||||
{
|
||||
"name": "jsc-review",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/review.git"
|
||||
},
|
||||
"description": "程式碼審查:Refactoring 壞味道六組 + 註解規範 + 淺模組"
|
||||
},
|
||||
{
|
||||
"name": "jsc-sdlc",
|
||||
"source": {
|
||||
"source": "url",
|
||||
"url": "https://gitea.jsc.idv.tw/plugins/sdlc.git"
|
||||
},
|
||||
"description": "開發生命週期:規劃/分析/實作/維護(wiki 追蹤)"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
{
|
||||
"name": "jsc-template",
|
||||
"version": "0.0.3",
|
||||
"description": "JSC 跨 AI 助理共用 plugin 模板(Claude Code / Codex / Antigravity / OpenCode)。所有 skills 以 SKILL.md 為共通標準,於 Claude Code 以 /jsc-template: 前綴呼叫。",
|
||||
"name": "jsc-review",
|
||||
"version": "0.0.1",
|
||||
"description": "程式碼審查:Refactoring 壞味道六組 + 註解規範 + 淺模組",
|
||||
"skills": "./skills",
|
||||
"author": {
|
||||
"name": "JSC"
|
||||
},
|
||||
"homepage": "https://gitea.jsc.idv.tw/plugins/template",
|
||||
"repository": "https://gitea.jsc.idv.tw/plugins/template.git",
|
||||
"keywords": ["template", "skills", "cross-tool", "jsc"]
|
||||
"homepage": "https://gitea.jsc.idv.tw/plugins/review",
|
||||
"repository": "https://gitea.jsc.idv.tw/plugins/review.git",
|
||||
"keywords": [
|
||||
"jsc",
|
||||
"review",
|
||||
"skills",
|
||||
"cross-tool"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jsc-template",
|
||||
"version": "0.0.3",
|
||||
"description": "JSC 跨 AI 助理共用 plugin 模板。所有 skills 以 SKILL.md 為共通標準。",
|
||||
"name": "jsc-review",
|
||||
"version": "0.0.1",
|
||||
"description": "程式碼審查:Refactoring 壞味道六組 + 註解規範 + 淺模組",
|
||||
"skills": "./skills"
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
# jsc-template — 共用 Skills(跨 AI 助理)
|
||||
# jsc-review — 給 AI 助理的指引
|
||||
|
||||
本 repo 是一組以 **Agent Skills(`SKILL.md`)** 標準撰寫的共用 skills,可同時被 Claude Code、Codex、Antigravity、OpenCode 使用。
|
||||
本 repo 是 jsc 技能組的 `review` domain(程式碼審查:Refactoring 壞味道六組、註解規範、淺模組),可同時被 Claude Code / Codex / Copilot / Antigravity / Kiro 使用。
|
||||
|
||||
## 給 AI 助理的指引
|
||||
## 規則
|
||||
|
||||
- 所有可用的 skills 位於本 repo 的 `skills/<name>/SKILL.md`。
|
||||
- 在處理任務前,先比對使用者需求與各 skill `SKILL.md` frontmatter 的 `description`,若相符請載入並依其步驟執行。
|
||||
- **呼叫慣例**:在 Claude Code 與 Antigravity 中,這些 skill 以 `/jsc-template:<name>` 呼叫;Codex 以 `$<name>`、OpenCode 由模型依描述自動觸發 — 兩者沒有 `/jsc-template:` 前綴,不需強制加。
|
||||
- 完整清單與每個 skill 的用途,請見 `README.md` 的「Skills 目錄」。
|
||||
1. 所有交談與輸出內容使用 STE100 繁體中文,帶擬人台灣感:短句、一句一指令、台灣用語、全形標點、去 AI 味、直接講重點。完整規則的唯一來源:`plugins/meta` 的 `references/ste100.md`。
|
||||
2. 技能位於 `skills/{name}/SKILL.md`;處理任務前先比對需求與各技能的 `description`,相符就載入並依其步驟執行。
|
||||
3. 技能準則的唯一來源:`plugins/meta` 存取庫的 `references/guidelines.md`。
|
||||
4. 所有 hook 只放在 `jsc-hooks`;gitea 操作一律經由 `jsc-gitea` 的 `tools/gitea.sh`;問使用者一律依 `jsc-ask:ask` 的決策樹規則。
|
||||
5. 主 agent 不需要處理細節的流程,一律建立 sub agent 處理。
|
||||
|
||||
## 慣例
|
||||
## 呼叫慣例
|
||||
|
||||
- 新增 skill 一律放在 `skills/<name>/`,且 `<name>` 使用小寫與連字號。
|
||||
- `description` 要寫清楚觸發條件(何時用、何時不用),這是跨助理自動載入的唯一依據。
|
||||
Claude Code / Antigravity:`/jsc-review:{name}`;Codex:`$name`;Copilot / Kiro / OpenCode:描述需求自動觸發。
|
||||
|
||||
@@ -1,228 +1,39 @@
|
||||
# jsc-template — 跨 AI 助理 Plugin 模板
|
||||
# jsc-review — 程式碼審查
|
||||
|
||||
一個可同時被 **Claude Code、Codex、Antigravity、OpenCode、GitHub Copilot** 安裝的 plugin 模板。
|
||||
核心是以 [Agent Skills(`SKILL.md`)](https://agentskills.io) 標準撰寫的共用 skills(唯一真實來源放在 `skills/`),
|
||||
搭配各助理各自的 plugin manifest,讓**同一個 repo** 可用各家**原生 plugin CLI** 安裝。
|
||||
在 Claude Code 與 Antigravity 中,skill 以 **`/jsc-template:` 前綴**呼叫(例如 `/jsc-template:hello`)。
|
||||
jsc 技能組的 review domain:基於《Refactoring》壞味道目錄的六組審查(結構與體積、可讀性與命名、耦合與設計、邏輯與壞習慣、註解規範、淺模組),套用在檔案變更完成與實作完成兩個時機。
|
||||
|
||||
---
|
||||
## 安裝、更新、移除
|
||||
|
||||
## 前綴與呼叫方式
|
||||
Marketplace 統一為 `jsc`(https://gitea.jsc.idv.tw/plugins/jsc.git),安裝 token 為 `jsc-review@jsc`。每個指令一行:
|
||||
|
||||
| 助理 | 安裝方式 | 呼叫 | `/jsc-template:` 前綴 |
|
||||
| CLI | 安裝 | 更新 | 移除 |
|
||||
| --- | --- | --- | --- |
|
||||
| Claude Code | `claude plugin`(marketplace) | `/jsc-template:<name>` 或自動觸發 | ✅ |
|
||||
| Codex | `codex plugin`(marketplace) | `$<name>` 或 `/skills` 選單 | ❌(用 `$name`) |
|
||||
| Antigravity | `agy plugin install` | `/jsc-template:<name>` 或自動觸發 | ✅ |
|
||||
| OpenCode | skills 目錄(複製/clone) | 描述需求自動觸發 | ❌(依名稱) |
|
||||
| GitHub Copilot CLI | `copilot plugin`(marketplace) | 自然語言或 plugin skills | ❌(無 `/jsc-template:` 前綴) |
|
||||
| claude | `claude plugin marketplace add https://gitea.jsc.idv.tw/plugins/jsc.git && claude plugin install jsc-review@jsc` | `claude plugin marketplace update jsc && claude plugin update jsc-review@jsc` | `claude plugin uninstall jsc-review@jsc` |
|
||||
| codex | `codex plugin marketplace add https://gitea.jsc.idv.tw/plugins/jsc.git && codex plugin add jsc-review@jsc` | `codex plugin marketplace upgrade jsc` | `codex plugin remove jsc-review@jsc` |
|
||||
| copilot | `copilot plugin marketplace add https://gitea.jsc.idv.tw/plugins/jsc.git && copilot plugin install jsc-review@jsc` | `copilot plugin marketplace update jsc && copilot plugin update jsc-review@jsc` | `copilot plugin uninstall jsc-review@jsc` |
|
||||
| antigravity | `git clone https://gitea.jsc.idv.tw/plugins/review.git ~/plugins/review && agy plugin install ~/plugins/review` | `git -C ~/plugins/review pull && agy plugin uninstall jsc-review && agy plugin install ~/plugins/review` | `agy plugin uninstall jsc-review` |
|
||||
| kiro | `kiro-cli plugin marketplace add https://gitea.jsc.idv.tw/plugins/jsc.git && kiro-cli plugin install jsc-review@jsc` | `kiro-cli plugin marketplace update jsc && kiro-cli plugin update jsc-review@jsc` | `kiro-cli plugin uninstall jsc-review@jsc` |
|
||||
|
||||
> Codex 不支援自訂前綴(skill 以 `$name` 呼叫);OpenCode 由模型依描述自動呼叫;Copilot CLI 透過原生 plugin 安裝後以自然語言或 plugin skills 使用。三者皆**不強制**前綴。
|
||||
|
||||
---
|
||||
|
||||
## 目錄結構
|
||||
|
||||
同一個 repo 同時帶四種 manifest,彼此以路徑隔離、互不干擾;各助理都讀同一份 `skills/`。
|
||||
|
||||
```
|
||||
template/
|
||||
├── .claude-plugin/
|
||||
│ ├── plugin.json # Claude 外掛定義(name: "jsc-template")
|
||||
│ └── marketplace.json # Claude marketplace(name: "template",source 指向本 repo)
|
||||
├── .codex-plugin/
|
||||
│ └── plugin.json # Codex 外掛定義(name: "jsc-template",skills: "./skills")
|
||||
├── .agents/plugins/
|
||||
│ └── marketplace.json # Codex marketplace(name: "template",url source 指向本 repo)
|
||||
├── plugin.json # Antigravity 外掛定義(name: "jsc-template",skills: "./skills/")
|
||||
├── skills/ # ★ 唯一真實來源:所有 skills
|
||||
│ └── hello/SKILL.md
|
||||
├── AGENTS.md # 跨助理共用指引
|
||||
└── README.md
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 安裝 / 更新 / 移除(各助理)
|
||||
|
||||
> 指令中的 repo 網址換成你的:`https://gitea.jsc.idv.tw/plugins/template.git`
|
||||
>
|
||||
> **Claude / Codex 從 git URL 安裝(會 clone 遠端),請先把本 repo `push` 到 gitea。**
|
||||
> **Antigravity 的 `agy plugin install <url>` 目前只支援 github.com**;gitea 請改用「clone + 本地路徑」(見 Antigravity 節)。
|
||||
> 本機/離線:Claude 可用本地路徑加 marketplace;Antigravity 用本地路徑安裝。
|
||||
|
||||
> **⚠ 從 0.0.1 升上來的人請先移除再安裝。** 0.0.2 起 marketplace 名由 `jsc-plugins` 改為 `template`
|
||||
> (舊名與 `jsc-persona` 的 marketplace 撞名)。各助理以 `<plugin 名>@<marketplace 名>` 當安裝識別鍵,
|
||||
> 改名後是兩筆獨立條目,**不能用 update 遷移**:
|
||||
>
|
||||
> ```bash
|
||||
> claude plugin uninstall jsc-template@jsc-plugins
|
||||
> claude plugin marketplace remove jsc-plugins # 若你沒有裝 jsc-persona 才移除,它也用這個名字
|
||||
> claude plugin marketplace add https://gitea.jsc.idv.tw/plugins/template.git
|
||||
> claude plugin install jsc-template@template
|
||||
> ```
|
||||
>
|
||||
> 移除後記得清掉 `~/.claude/settings.json` 裡 `enabledPlugins` 的舊鍵 `jsc-template@jsc-plugins`,
|
||||
> 並重開工作階段。Codex/Copilot 同理(`remove`/`uninstall` 後重新 `add`+`install`)。
|
||||
|
||||
### Claude Code
|
||||
|
||||
```bash
|
||||
# 安裝
|
||||
claude plugin marketplace add https://gitea.jsc.idv.tw/plugins/template.git
|
||||
claude plugin install jsc-template@template
|
||||
|
||||
# 更新
|
||||
claude plugin marketplace update template
|
||||
claude plugin update jsc-template@template
|
||||
|
||||
# 移除
|
||||
claude plugin uninstall jsc-template@template
|
||||
claude plugin marketplace remove template
|
||||
```
|
||||
|
||||
- 工作階段內 slash 版(等價):把 `claude plugin` 換成 `/plugin`。
|
||||
- 本機開發(免 push):`claude plugin marketplace add C:\Users\h3285\source\repos.plugins\template`(本地路徑)後再 install。
|
||||
- **呼叫**:`/jsc-template:<name>`(例 `/jsc-template:hello`)。
|
||||
|
||||
### Codex
|
||||
|
||||
```bash
|
||||
# 安裝
|
||||
codex plugin marketplace add https://gitea.jsc.idv.tw/plugins/template.git
|
||||
codex plugin add jsc-template@template
|
||||
|
||||
# 更新(重新抓取 marketplace 的 git 快照)
|
||||
codex plugin marketplace upgrade template
|
||||
|
||||
# 移除
|
||||
codex plugin remove jsc-template@template
|
||||
codex plugin marketplace remove template
|
||||
```
|
||||
|
||||
- 安裝 token `jsc-template@template` = plugin 名(`.codex-plugin/plugin.json` 的 `name`)@ marketplace 名(`.agents/plugins/marketplace.json` 的 `name`)。
|
||||
- 本 repo 的 Codex marketplace 以 `url` 來源指向自己,故 Codex **一律從 gitea 安裝**(需先 push);安裝後重啟 Codex。
|
||||
- **呼叫**:`$<name>`(例 `$hello`),或用 `/skills` 選單。
|
||||
|
||||
### Antigravity(`agy`)
|
||||
|
||||
> `agy plugin install <url>` 目前**只支援 github.com**;gitea 等自架 git 不支援 URL 安裝,請先 `git clone` 再用**本地路徑**安裝。
|
||||
|
||||
```bash
|
||||
# 安裝:clone 後用本地路徑
|
||||
git clone https://gitea.jsc.idv.tw/plugins/template.git ~/plugins/template
|
||||
agy plugin install ~/plugins/template
|
||||
|
||||
# 更新(agy 無 update 子指令 → git pull 後重裝)
|
||||
git -C ~/plugins/template pull
|
||||
agy plugin uninstall jsc-template
|
||||
agy plugin install ~/plugins/template
|
||||
|
||||
# 移除
|
||||
agy plugin uninstall jsc-template
|
||||
```
|
||||
|
||||
- 若把 skills 放到 GitHub,則可直接 `agy plugin install https://github.com/<owner>/<repo>`。
|
||||
- 其他:`agy plugin list`、`agy plugin enable jsc-template` / `disable jsc-template`、`agy plugin validate <path>`。安裝後重啟工作階段。
|
||||
- **呼叫**:`/jsc-template:<name>`(例 `/jsc-template:hello`)或依描述自動觸發。
|
||||
|
||||
### OpenCode
|
||||
|
||||
OpenCode 的「plugin」是 TypeScript/npm 套件,不適用於 skill 包;skills 改用**目錄安裝**。
|
||||
OpenCode 會讀 `~/.config/opencode/skills/`(也會讀 `~/.claude/skills/`、`~/.agents/skills/`)。
|
||||
|
||||
```bash
|
||||
# 安裝
|
||||
git clone https://gitea.jsc.idv.tw/plugins/template.git ~/plugins/template
|
||||
mkdir -p ~/.config/opencode/skills
|
||||
cp -r ~/plugins/template/skills/* ~/.config/opencode/skills/
|
||||
|
||||
# 更新
|
||||
git -C ~/plugins/template pull
|
||||
cp -r ~/plugins/template/skills/* ~/.config/opencode/skills/
|
||||
|
||||
# 移除
|
||||
rm -rf ~/.config/opencode/skills/hello
|
||||
```
|
||||
|
||||
> **Windows PowerShell**:`cp -r A B` → `Copy-Item A B -Recurse -Force`、`rm -rf X` → `Remove-Item X -Recurse -Force`、`~` → `$HOME`。
|
||||
|
||||
- **呼叫**:直接描述需求,模型會依 skill 描述自動透過 skill 工具呼叫。
|
||||
|
||||
### GitHub Copilot CLI
|
||||
|
||||
Copilot CLI 支援與 Claude Code 類似的原生 plugin / marketplace 指令,可直接從 marketplace 安裝、更新與移除本 plugin。
|
||||
|
||||
```bash
|
||||
# 安裝
|
||||
copilot plugin marketplace add https://gitea.jsc.idv.tw/plugins/template.git
|
||||
copilot plugin install jsc-template@template
|
||||
|
||||
# 更新
|
||||
copilot plugin marketplace update template
|
||||
copilot plugin update jsc-template@template
|
||||
|
||||
# 移除
|
||||
copilot plugin uninstall jsc-template@template
|
||||
copilot plugin marketplace remove template
|
||||
```
|
||||
|
||||
- 安裝 token `jsc-template@template` = plugin 名(plugin manifest 的 `name`)@ marketplace 名。
|
||||
- `copilot plugin marketplace add` 支援 GitHub `owner/repo`、git URL 與本地路徑;Gitea repo 可用上方 HTTPS URL。
|
||||
- **呼叫**:在 Copilot CLI 中用自然語言描述需求,例如 `copilot -i "跑 hello 確認 plugin 裝好了"`。
|
||||
|
||||
---
|
||||
|
||||
## 用 CLI 直接執行 skill(headless / 一次性)
|
||||
|
||||
安裝好之後,不必進互動介面,一行指令就能叫某個 skill 跑完並印出結果:
|
||||
|
||||
| 助理 | headless 指令 | 執行 `hello` skill |
|
||||
| --- | --- | --- |
|
||||
| Claude Code | `claude -p "<prompt>"` | `claude -p "/jsc-template:hello"` |
|
||||
| Codex | `codex exec "<prompt>"` | `codex exec '$hello'` |
|
||||
| Antigravity | `agy -p "<prompt>"` | `agy -p "/jsc-template:hello"` |
|
||||
| OpenCode | `opencode run "<message>"` | `opencode run "用 hello skill 打個招呼"` |
|
||||
| GitHub Copilot CLI | `copilot -p "<message>"` | `copilot -p "用 hello skill 打個招呼"` |
|
||||
|
||||
- Claude / Antigravity 支援 `/jsc-template:` 前綴,直接 `-p "/jsc-template:<name>"` 即可。
|
||||
- Codex 以 `$<name>` 觸發;在 shell 請用**單引號**避免 `$` 被展開:`codex exec '$hello'`。
|
||||
- OpenCode 與 Copilot 沒有前綴,用自然語言描述需求;Copilot CLI 會讀取已安裝 plugin 提供的 skills。
|
||||
- 帶引數就接在後面,例如 `claude -p "/jsc-template:hello 參數"`、`codex exec '$hello 參數'`。
|
||||
|
||||
---
|
||||
> antigravity 不支援 gitea URL 安裝,改用本地 clone 路徑。批次操作五個 CLI:使用 `/jsc-cli:deploy`。
|
||||
|
||||
## Skills 目錄
|
||||
|
||||
> 此區塊列出本 plugin 內含的所有 skills(名稱/描述/使用方法)。
|
||||
> 新增或修改 skill 後,請同步手動更新標記之間的內容。
|
||||
呼叫方式:Claude / Antigravity `/jsc-review:{name}`;Codex `${name}`;Copilot / Kiro 描述需求自動觸發。
|
||||
|
||||
<!-- JSC-SKILLS:START -->
|
||||
|
||||
### `hello`
|
||||
### `code-review`
|
||||
|
||||
範例 skill,用來驗證 jsc plugin 是否安裝成功,也是新增 skill 的範本。當使用者輸入 hello、想測試 plugin、或想看 skill 模板長什麼樣子時觸發;回覆一句問候並簡述此 plugin 的用途。
|
||||
|
||||
- **Claude Code / Antigravity**:`/jsc-template:hello`
|
||||
- **Codex**:`$hello`,或用 `/skills` 選單
|
||||
- **OpenCode / GitHub Copilot CLI**:描述需求自動觸發
|
||||
對 git diff 進行六組壞味道審查,每組一個 sub agent 平行執行;回報 `檔案:行號`、嚴重度、建議重構手法,修正與否由呼叫端決定。安全性與 bug 審查交給 CLI 內建 review,不重複。
|
||||
|
||||
<!-- JSC-SKILLS:END -->
|
||||
|
||||
---
|
||||
## 參考
|
||||
|
||||
## 新增一個 skill
|
||||
| 檔案 | 用途 |
|
||||
| --- | --- |
|
||||
| `references/smells.md` | 六組壞味道完整清單:定義、偵測訊號、建議重構手法、嚴重度分級;範例資料必須去識別化 |
|
||||
|
||||
1. 複製範本:`cp -r skills/hello skills/<your-skill-name>`
|
||||
2. 編輯 `skills/<your-skill-name>/SKILL.md` 的 frontmatter:
|
||||
- `name`:小寫、數字、連字號(`-`),最長 64 字元。**這就是 Claude Code / Antigravity 的 `/jsc-template:<name>`**。
|
||||
- `description`:第三人稱,寫清楚「何時用、何時不用」與觸發關鍵字 — 這是各助理自動載入的唯一依據。
|
||||
3. 在內文寫下 skill 的具體步驟。
|
||||
4. 手動把這個 skill 補進上方「Skills 目錄」區塊。
|
||||
5. **bump 版本並 push**:各助理都以 git 內容/版本判斷更新,請把 `.claude-plugin/plugin.json`、`.codex-plugin/plugin.json`、`plugin.json` 三個 manifest 的 `version` 一起 bump,commit 後 push 到 gitea。
|
||||
6. 讓各助理更新:
|
||||
- Claude:`claude plugin update jsc-template@template`
|
||||
- Codex:`codex plugin marketplace upgrade template`
|
||||
- Antigravity:`git -C ~/jsc-plugin pull && agy plugin uninstall jsc-template && agy plugin install ~/jsc-plugin`
|
||||
- OpenCode:`git pull` 後重新複製 `skills/`
|
||||
- Copilot:`copilot plugin marketplace update template && copilot plugin update jsc-template@template`
|
||||
## 相關 domain
|
||||
|
||||
- [`jsc-sdlc`](https://gitea.jsc.idv.tw/plugins/sdlc):實作階段完成後呼叫本審查
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jsc-template",
|
||||
"version": "0.0.3",
|
||||
"description": "JSC 跨 AI 助理共用 plugin 模板。所有 skills 以 SKILL.md 為共通標準;於 Antigravity 以 /jsc-template: 前綴呼叫。",
|
||||
"name": "jsc-review",
|
||||
"version": "0.0.1",
|
||||
"description": "程式碼審查:Refactoring 壞味道六組 + 註解規範 + 淺模組",
|
||||
"skills": "./skills/"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
# 程式碼壞味道審查清單
|
||||
|
||||
來源:《Refactoring》(Martin Fowler)與《A Philosophy of Software Design》(John Ousterhout,第 6 組)。
|
||||
`code-review` 技能依此清單分六組審查,每組由一個 sub agent 執行。
|
||||
每項格式:**定義、偵測訊號、建議重構手法**。
|
||||
|
||||
## 第 1 組:結構與體積問題(Bloaters)
|
||||
|
||||
### 1.1 巨型類別(Large Class)
|
||||
|
||||
- **定義**:單一 Class 數千行,包山包海,違反單一職責原則。
|
||||
- **偵測訊號**:類別行數過大(> 500 行需注意、> 1000 行必列);欄位過多;方法分成多個互不相干的群組;類別名稱含 Manager、Util、Helper 等萬用字。
|
||||
- **建議重構手法**:Extract Class、Extract Subclass、Extract Interface;依職責拆分後以組合取代繼承。
|
||||
|
||||
### 1.2 臃腫函式(Long Method)
|
||||
|
||||
- **定義**:一個 Function 寫了幾百行,邏輯複雜到沒人敢動。
|
||||
- **偵測訊號**:函式行數 > 50 行需注意、> 100 行必列;一個函式內有多段以空行或註解分隔的「段落」;區域變數過多;圈複雜度高。
|
||||
- **建議重構手法**:Extract Function(每個段落抽成具名函式)、Replace Temp with Query、Decompose Conditional、Replace Function with Command。
|
||||
|
||||
### 1.3 過長參數列(Long Parameter List)
|
||||
|
||||
- **定義**:傳入超過 4、5 個以上的參數,呼叫時極易傳錯。
|
||||
- **偵測訊號**:參數 ≥ 5 個必列、4 個需注意;連續同型別參數(例:三個 string 相鄰);boolean 旗標參數;呼叫端常以固定組合傳值。
|
||||
- **建議重構手法**:Introduce Parameter Object、Preserve Whole Object、Replace Parameter with Query、Remove Flag Argument。
|
||||
|
||||
### 1.4 基本型態偏執(Primitive Obsession)
|
||||
|
||||
- **定義**:不用物件包裝,全部用字串或數字代替(金額、電話、狀態碼、範圍等)。
|
||||
- **偵測訊號**:以 string/int 表達有格式或規則的概念;同一組基本型態欄位在多處一起出現;以字串常數當型別碼;到處重複的驗證邏輯。
|
||||
- **建議重構手法**:Replace Primitive with Object、Replace Type Code with Subclasses、Introduce Parameter Object、Extract Class。
|
||||
|
||||
## 第 2 組:可讀性與命名問題(Obscurity)
|
||||
|
||||
### 2.1 神秘命名(Mysterious Name)
|
||||
|
||||
- **定義**:使用毫無意義的變數名(a、tmp、data2、doStuff)。
|
||||
- **偵測訊號**:單字母或縮寫命名(迴圈索引除外);名稱與實際行為不符;需要讀實作才知道用途;名稱含編號(data1、data2)。
|
||||
- **建議重構手法**:Rename Variable、Rename Function、Rename Field;名稱表達「意圖」而非「實作」。
|
||||
|
||||
### 2.2 魔術數字(Magic Numbers)
|
||||
|
||||
- **定義**:程式碼中直接出現沒人知道代表什麼的字面值。
|
||||
- **偵測訊號**:條件式或運算中出現裸數字、裸字串(0、1、-1、空字串與明顯單位換算除外需判斷);同一字面值在多處出現。
|
||||
- **建議重構手法**:Replace Magic Literal(抽成具名常數或 enum);有行為就升級為 Replace Type Code with Class。
|
||||
|
||||
### 2.3 死碼(Dead Code)
|
||||
|
||||
- **定義**:已經不用卻不刪除的註解掉程式碼、變數、函式或類別。
|
||||
- **偵測訊號**:被註解掉的程式碼區塊;無人呼叫的函式、類別(grep 全庫零引用);永遠不成立的條件分支;未使用的 import、參數、變數。
|
||||
- **建議重構手法**:Remove Dead Code(直接刪除,歷史交給版本控制)。
|
||||
|
||||
### 2.4 過度註解(Comments)
|
||||
|
||||
- **定義**:因為程式碼寫太爛,只好寫一堆註解來解釋邏輯;好的程式碼應該能「自我解釋」。
|
||||
- **偵測訊號**:註解在解釋「這段在做什麼」而非「為什麼這樣做」;註解與程式碼不同步;每隔幾行就一條註解;用註解分段的長函式(同時列 1.2)。
|
||||
- **建議重構手法**:Extract Function(用函式名取代註解)、Rename(用命名取代註解)、Introduce Assertion;保留「為什麼」與外部限制類註解。
|
||||
- **注意**:本項與「註解問題」(第 5 組)互補:刪除解釋性廢話註解,補齊第 5 組要求的介面契約註解,兩者不衝突。
|
||||
|
||||
## 第 3 組:耦合與設計問題(Couplers)
|
||||
|
||||
### 3.1 依賴嫉妒(Feature Envy)
|
||||
|
||||
- **定義**:A 類別的函式不斷去存取、修改 B 類別的資料,顯示該函式放錯地方。
|
||||
- **偵測訊號**:函式內對別的物件的 getter/setter 呼叫次數多於對自身成員的使用;連續鏈式取值後運算(`order.customer.address.city`)。
|
||||
- **建議重構手法**:Move Function(搬到資料所在的類別)、Extract Function 後再 Move。
|
||||
|
||||
### 3.2 散彈式修改(Shotgun Surgery)
|
||||
|
||||
- **定義**:每當要修改一個小功能,就必須同時修改多個不同的檔案。
|
||||
- **偵測訊號**:本次 diff 為了單一需求橫跨多檔做同質小改動;同一常數或規則散落多處;歷史上同組檔案總是一起被改。
|
||||
- **建議重構手法**:Move Function / Move Field 集中職責、Combine Functions into Class、Inline Function 後重新抽取。
|
||||
|
||||
### 3.3 發散式變化(Divergent Change)
|
||||
|
||||
- **定義**:一個類別因為各種完全不相關的原因需要被修改。
|
||||
- **偵測訊號**:類別的修改歷史來自多種不相干需求;類別內方法可依「變更原因」分成多群;「如果要加 X 就改這裡,要加 Y 也改這裡」。
|
||||
- **建議重構手法**:Split Phase、Extract Class、Move Function,讓每個模組只有一個變更理由。
|
||||
|
||||
### 3.4 親密關係(Inappropriate Intimacy)
|
||||
|
||||
- **定義**:兩個類別過度了解彼此的私有實作細節。
|
||||
- **偵測訊號**:存取對方的 private/internal 成員或繞過封裝(反射、friend、直接操作內部集合);雙向依賴;子類別依賴父類別實作細節。
|
||||
- **建議重構手法**:Move Function / Move Field、Change Bidirectional to Unidirectional、Hide Delegate、Replace Subclass with Delegate。
|
||||
|
||||
## 第 4 組:邏輯與壞習慣(Dispensables & Others)
|
||||
|
||||
### 4.1 重複程式碼(Duplicated Code)
|
||||
|
||||
- **定義**:到處複製貼上(Copy-Paste),改一個 Bug 要改好幾個地方。
|
||||
- **偵測訊號**:相同或僅參數不同的程式片段出現 ≥ 2 處;兄弟類別有相同方法;diff 中新增的程式碼與既有程式碼雷同。
|
||||
- **建議重構手法**:Extract Function、Pull Up Method、Form Template Method、Slide Statements 後合併。
|
||||
|
||||
### 4.2 巢狀地獄(Nested If Hell)
|
||||
|
||||
- **定義**:If-Else 或 Loop 疊了 5、6 層以上,箭頭型程式碼(Arrow Anti-pattern)。
|
||||
- **偵測訊號**:縮排深度 ≥ 4 層需注意、≥ 5 層必列;else 鏈過長;條件式中混合多個否定。
|
||||
- **建議重構手法**:Replace Nested Conditional with Guard Clauses(衛語句早退)、Decompose Conditional、Replace Conditional with Polymorphism、Extract Function。
|
||||
|
||||
### 4.3 誇誇其談未來性(Speculative Generality)
|
||||
|
||||
- **定義**:為了解決「未來可能」會用到的功能,寫了一堆現在用不到的複雜架構。
|
||||
- **偵測訊號**:只有一個實作的抽象層或介面;從未被覆寫的 hook 方法;只在測試中使用的參數或彈性;「以後可能會需要」的註解。
|
||||
- **建議重構手法**:Collapse Hierarchy、Inline Function / Inline Class、Remove Dead Code、移除未用參數(Change Function Declaration)。
|
||||
|
||||
### 4.4 吞掉異常(Swallowed Exceptions)
|
||||
|
||||
- **定義**:try-catch 裡面留白,發生錯誤時直接隱瞞,導致難以 Debug。
|
||||
- **偵測訊號**:空的 catch 區塊;catch 後只留註解或 `// ignore`;catch 住廣義 Exception 後回傳 null 或預設值而不記錄;錯誤訊息被丟棄後重包。
|
||||
- **建議重構手法**:最少要記錄(log)並保留原始例外鏈;能處理才 catch,不能處理就往上拋;以 Introduce Special Case 取代以 null 掩蓋錯誤。
|
||||
|
||||
## 第 5 組:註解問題(介面契約註解)
|
||||
|
||||
此組檢查「該有而沒有」的註解,與 2.4(該刪的註解)互補。
|
||||
|
||||
### 5.1 方法描述
|
||||
|
||||
- **定義**:每個公開方法要有一句話描述,並標明所屬層級:**顯示層、邏輯層、存取層**。
|
||||
- **偵測訊號**:公開方法無描述;描述未標層級;描述與方法實際行為不符。
|
||||
- **建議重構手法**:補上單句描述與層級標記;若一個方法橫跨多層,先依 Split Phase 拆分再各自標註。
|
||||
|
||||
### 5.2 輸入參數說明
|
||||
|
||||
- **定義**:所有輸入參數都要有用途說明。
|
||||
- **偵測訊號**:參數無說明;說明只是重複參數名稱;可選參數未說明預設行為。
|
||||
- **建議重構手法**:逐參數補「用途」說明;參數多到說明困難時同時列 1.3 並建議 Introduce Parameter Object。
|
||||
|
||||
### 5.3 輸出說明
|
||||
|
||||
- **定義**:輸出(回傳值)要說明回傳的資料內容概要。
|
||||
- **偵測訊號**:無回傳說明;未說明 null、空集合、錯誤時的回傳;回傳布林但未說明 true/false 意義。
|
||||
- **建議重構手法**:補回傳內容概要與邊界情況說明。
|
||||
|
||||
### 5.4 輸入與輸出範例
|
||||
|
||||
- **定義**:輸入與輸出參數都必須有範例;範例內容**優先嘗試從資料庫取得真實資料,失敗才透過邏輯推理**產生。
|
||||
- **偵測訊號**:註解缺範例;範例與型別不符;範例顯然是佔位假資料而環境可取得真實資料。
|
||||
- **建議重構手法**:以可用的連線查詢一筆代表性資料當範例(去識別化,不可含個資);無法連線才以邏輯推理造出合理範例並標明為推理值。
|
||||
|
||||
### 5.5 巢狀結構註解
|
||||
|
||||
- **定義**:如果參數有巢狀結構(例如 class 內還有 class),就必須完全補齊每一層的註解。
|
||||
- **偵測訊號**:DTO/ViewModel 僅頂層有註解;內層類別、集合元素型別的欄位無說明或無範例。
|
||||
- **建議重構手法**:逐層補齊 5.1–5.4;巢狀過深(≥ 3 層)時同時評估 Extract Class 是否被濫用。
|
||||
|
||||
## 第 6 組:淺模組(Shallow Module)
|
||||
|
||||
- **定義**:介面複雜度相對於功能深度過高的模組——使用它要懂的事,跟自己寫差不多(出自《A Philosophy of Software Design》:好模組要「介面簡單、實作深」)。
|
||||
- **偵測訊號**:只有一行轉呼叫(pass-through)的方法或類別;包裝層與被包裝者介面幾乎相同;參數原封不動往下傳的層層委派;為每個底層方法都開一個對應方法的「殼」。
|
||||
- **建議重構手法**:Inline Class / Inline Function 移除殼層;或反向加深模組——把散在呼叫端的邏輯(驗證、轉換、錯誤處理)收進模組內,讓介面吸收複雜度。
|
||||
|
||||
## 嚴重度分級
|
||||
|
||||
| 級別 | 意義 | 例 |
|
||||
| --- | --- | --- |
|
||||
| 高 | 會造成錯誤或已阻礙修改 | 吞掉異常、重複程式碼改漏、死碼誤導 |
|
||||
| 中 | 持續增加維護成本 | 巨型類別、臃腫函式、巢狀地獄、Couplers 全組 |
|
||||
| 低 | 可讀性與一致性 | 命名、魔術數字、註解缺漏、淺模組 |
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
name: code-review
|
||||
description: Review changed code against the Refactoring smell catalog in six groups (bloaters, obscurity, couplers, dispensables, comment contract, shallow modules). Run when a file change is complete or an implementation is complete, e.g. from jsc-sdlc implement. Each group runs as a sub agent over the git diff; findings are reported with file:line, severity, and refactoring, and the caller decides whether to fix. Not a replacement for the CLI's built-in security or bug review.
|
||||
---
|
||||
|
||||
# code-review
|
||||
|
||||
Review changed code against `references/smells.md` (from the book *Refactoring*). The reference is written in Traditional Chinese; read it as-is.
|
||||
|
||||
## When to run
|
||||
|
||||
1. **When a file change is complete**: one file or one related group of files is done.
|
||||
2. **When an implementation is complete**: all todos of a work package are done (called by `jsc-sdlc:implement` step 6).
|
||||
|
||||
## Division of labor
|
||||
|
||||
- This skill covers the *Refactoring* smells, the comment contract (group 5), and shallow modules (group 6).
|
||||
- Security, logic bugs, and test coverage belong to the CLI's built-in review (e.g. claude's `/security-review`); do not duplicate them.
|
||||
|
||||
## Steps
|
||||
|
||||
1. Get the review scope: `git diff` (uncommitted changes) or `git diff {base}...HEAD` (against the base branch when an implementation is complete); list the changed files.
|
||||
2. Review in six groups, and every group **MUST run as a sub agent**; the six groups may run in parallel:
|
||||
|
||||
| Group | Scope |
|
||||
| --- | --- |
|
||||
| 1 Bloaters | smells.md group 1 |
|
||||
| 2 Obscurity | smells.md group 2 |
|
||||
| 3 Couplers | smells.md group 3 |
|
||||
| 4 Dispensables & Others | smells.md group 4 |
|
||||
| 5 Comment contract | smells.md group 5 |
|
||||
| 6 Shallow Module | smells.md group 6 |
|
||||
|
||||
Instructions for each sub agent: read only, change nothing; check every changed line and its enclosing function or class against the group's definitions and detection signals in smells.md; report each finding as `file:line`, smell name, severity (高、中、低 per the smells.md scale), one sentence of evidence, and the suggested refactoring. Findings are reported in Traditional Chinese.
|
||||
3. Merge the six groups' findings: deduplicate (when one location hits several groups, merge and list every smell), then sort by severity.
|
||||
4. Report the finding list. **This skill never modifies code**; the caller decides what to fix (inside the implementation flow, 高 and 中 are normally mandatory, 低 is judgment).
|
||||
|
||||
## Notes
|
||||
|
||||
- If group 5 examples are fetched from a database, they must be de-identified; never include personal data.
|
||||
- When there are no findings, report the literal 「無發現」 explicitly; never leave the report empty.
|
||||
@@ -1,38 +0,0 @@
|
||||
---
|
||||
name: hello
|
||||
description: 範例 skill,用來驗證 jsc plugin 是否安裝成功,也是新增 skill 的範本。當使用者輸入 hello、想測試 plugin、或想看 skill 模板長什麼樣子時觸發;回覆一句問候並簡述此 plugin 的用途。
|
||||
---
|
||||
|
||||
# hello(範例 skill)
|
||||
|
||||
這是 `jsc-template` plugin 的範例 skill。它有兩個用途:
|
||||
|
||||
1. **驗證安裝** — 跨各家 AI 助理確認 skill 已被正確載入。
|
||||
2. **作為範本** — 複製這個資料夾即可新增一個新的 skill。
|
||||
|
||||
## 呼叫方式
|
||||
|
||||
| 助理 | 呼叫方式 |
|
||||
| --- | --- |
|
||||
| Claude Code | `/jsc-template:hello` |
|
||||
| Antigravity | `/jsc-template:hello`,或描述需求自動觸發 |
|
||||
| Codex | 在提示詞輸入 `$hello`,或用 `/skills` 選單 |
|
||||
| OpenCode | 直接描述需求,模型會透過 skill 工具自動呼叫 |
|
||||
| GitHub Copilot CLI | 直接描述需求,Copilot 會讀取已安裝 plugin 的 skills |
|
||||
|
||||
## 行為
|
||||
|
||||
當這個 skill 被觸發時:
|
||||
|
||||
1. 回覆「Hello from **jsc** 👋」。
|
||||
2. 用一句話說明 `jsc-template` 是一個跨 AI 助理的共用 skill 集合。
|
||||
3. 提示使用者可以在 README 的「Skills 目錄」查看所有可用的 skills。
|
||||
|
||||
## 如何以此為範本新增 skill
|
||||
|
||||
1. 複製 `skills/hello/` 為 `skills/<your-skill-name>/`。
|
||||
2. 修改 `SKILL.md` 的 frontmatter:
|
||||
- `name`:小寫、數字、連字號(`-`),最長 64 字元。**這個名稱會成為 Claude Code / Antigravity 的 `/jsc-template:<name>` 指令**。
|
||||
- `description`:第三人稱,寫清楚「什麼時候該用、什麼時候不該用」與觸發關鍵字 — 各家助理靠這段文字決定是否自動載入。
|
||||
3. 在內文寫下 skill 的具體步驟。
|
||||
4. 手動把新 skill 補進 README 的「Skills 目錄」區塊。
|
||||
Reference in New Issue
Block a user