musubi-cli 0.1.0 → 0.3.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/README.ja.md +100 -26
- package/README.md +70 -2
- package/dist/add.js +24 -13
- package/dist/check.js +4 -0
- package/dist/cli.js +57 -17
- package/dist/definition.js +13 -1
- package/dist/graph.js +193 -64
- package/dist/install.js +168 -0
- package/dist/skills.js +36 -5
- package/package.json +5 -2
- package/schema/2026-11-20/check.schema.json +68 -0
- package/schema/2026-11-20/musubi.schema.json +81 -0
- package/schema/2026-11-21/check.schema.json +68 -0
- package/schema/2026-11-21/musubi.schema.json +98 -0
- package/spec/musubi.ja.md +220 -135
- package/spec/musubi.md +75 -6
package/spec/musubi.ja.md
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
# musubiの定義
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
定義のバージョンは`2026-11-21`。
|
|
4
4
|
|
|
5
|
-
musubi
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
musubiは、文書の書式や書き方のルールのように、エージェントのスキルが提供するコンテンツと、そのコンテンツに準拠するスキルを結び付ける。
|
|
6
|
+
あるスキルがコンテンツを名前とバージョン付きで宣言し、別のスキルがそのコンテンツに準拠すると宣言する。
|
|
7
|
+
`SKILL.md`を読むエージェントはどれも同じ方法でコンテンツを読み込み、コンテンツが変わると、準拠するスキルが再チェックされる。
|
|
8
|
+
正式な定義は英語の[musubi.md](musubi.md)で、この文書はその日本語訳である。
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## 概要
|
|
11
11
|
|
|
12
|
-
musubi
|
|
12
|
+
musubiに参加するスキルは、Agent Skillsが定める`SKILL.md`をそのまま持ち、その隣に`musubi.json`というファイルを1つ追加する。
|
|
13
13
|
|
|
14
|
-
|
|
|
14
|
+
| ファイル | 書く人 | 持つもの |
|
|
15
15
|
|---|---|---|
|
|
16
|
-
| `SKILL.md` |
|
|
17
|
-
| `musubi.json` |
|
|
18
|
-
|
|
|
19
|
-
|
|
|
16
|
+
| `SKILL.md` | スキルの作者 | Agent Skillsのフロントマターと本文で、変更しない。本文がエージェントに、どのコンテンツを読むかを伝える |
|
|
17
|
+
| `musubi.json` | 作者か`musubi add` | スキルが提供するコンテンツと、準拠するコンテンツ |
|
|
18
|
+
| コンテンツのファイル | provider | 書式や書き方のルールなど、consumerが準拠する文書 |
|
|
19
|
+
| チェックのファイル | provider | `musubi check`がconsumerの例に適用する、JSONのルール |
|
|
20
20
|
|
|
21
21
|
```text
|
|
22
22
|
skills/
|
|
23
|
-
├── design-doc/
|
|
24
|
-
│ ├── SKILL.md
|
|
23
|
+
├── design-doc/ providerのスキル
|
|
24
|
+
│ ├── SKILL.md 提供するコンテンツごとにファイルを指定する
|
|
25
25
|
│ ├── musubi.json "provides": design 1.0.0
|
|
26
|
-
│ ├── formats/design.md
|
|
27
|
-
│ └── checks/design.json
|
|
28
|
-
└── api-design/
|
|
26
|
+
│ ├── formats/design.md コンテンツ
|
|
27
|
+
│ └── checks/design.json チェックのルール
|
|
28
|
+
└── api-design/ consumerのスキル
|
|
29
29
|
├── SKILL.md design-doc/design を指す3行
|
|
30
|
-
├── musubi.json "follows": design-doc/design ^1.0.0
|
|
31
|
-
└── examples/orders-api.md
|
|
30
|
+
├── musubi.json "follows": design-doc/design ^1.0.0 とフィンガープリント
|
|
31
|
+
└── examples/orders-api.md チェックを適用する例
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
ここで使う用語は[GLOSSARY.ja.md](../GLOSSARY.ja.md)で定義する。
|
|
35
35
|
|
|
36
|
-
##
|
|
36
|
+
## providerの宣言
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
providerのスキルは、提供するコンテンツを`musubi.json`の`provides`に並べる。
|
|
39
39
|
|
|
40
40
|
```json
|
|
41
41
|
{
|
|
@@ -47,25 +47,25 @@ skills/
|
|
|
47
47
|
}
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
|
|
|
50
|
+
| フィールド | 必須 | 意味 |
|
|
51
51
|
|---|---|---|
|
|
52
|
-
| `$schema` |
|
|
53
|
-
| `musubi` |
|
|
54
|
-
| `provides.<名前>` |
|
|
55
|
-
| `provides.<名前>.version` |
|
|
56
|
-
| `provides.<名前>.file` |
|
|
57
|
-
| `provides.<名前>.check` |
|
|
52
|
+
| `$schema` | いいえ | エディタがJSON Schemaを見つける場所。`schema/<日付>/musubi.schema.json`を指す |
|
|
53
|
+
| `musubi` | はい | このファイルが準拠する定義のバージョン |
|
|
54
|
+
| `provides.<名前>` | コンテンツごとに1つ | コンテンツの名前。小文字の単語を`-`でつなぐ |
|
|
55
|
+
| `provides.<名前>.version` | はい | コンテンツのバージョン。`MAJOR.MINOR.PATCH`の形で書く |
|
|
56
|
+
| `provides.<名前>.file` | はい | コンテンツのファイル。スキルのフォルダからの相対パスで書く |
|
|
57
|
+
| `provides.<名前>.check` | いいえ | JSONのルールのファイル。スキルのフォルダからの相対パスで書き、形はチェックのルールの節で定める |
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
エージェントは出す側の`SKILL.md`の本文を読んでfileを見つけるので、出す側の本文は中身ごとにfileを名指す (判断の記録[0002](../docs/adr/0002-agents-open-the-provider-by-name.ja.md))。
|
|
64
|
-
`SKILL.md`がAgent Skillsの検査を通り続けるよう、宣言は頭の欄でなく別の`musubi.json`に書く (判断の記録[0001](../docs/adr/0001-declarations-in-musubi-json.ja.md))。
|
|
59
|
+
コンテンツは1つのファイルと、最大1つのチェックからなり、`design-doc/design`のように`<スキル名>/<名前>`で呼ぶ。
|
|
60
|
+
コンテンツごとにバージョンを持つので、1つを変えても、ほかのコンテンツのバージョンは変わらない。
|
|
61
|
+
パスはスキルのフォルダの中に限り、`musubi check`は絶対パスとフォルダの外へ出るパスを拒否する。
|
|
62
|
+
エージェントはproviderの`SKILL.md`の本文を読んでファイルを見つけるので、providerの本文はコンテンツごとにファイルを指定する (判断の記録[0002](../docs/adr/0002-agents-open-the-provider-by-name.ja.md))。
|
|
65
63
|
|
|
66
|
-
|
|
64
|
+
宣言をフロントマターの項目でなく別の`musubi.json`に書くのは、`SKILL.md`がAgent Skillsのチェックを通り続けるようにするためである (判断の記録[0001](../docs/adr/0001-declarations-in-musubi-json.ja.md))。
|
|
67
65
|
|
|
68
|
-
|
|
66
|
+
## consumerの宣言
|
|
67
|
+
|
|
68
|
+
consumerのスキルは、準拠するコンテンツを`musubi.json`の`follows`に並べる。
|
|
69
69
|
|
|
70
70
|
```json
|
|
71
71
|
{
|
|
@@ -80,15 +80,17 @@ pathはスキルのフォルダの中に留める。
|
|
|
80
80
|
}
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
|
|
|
83
|
+
| フィールド | 必須 | 意味 |
|
|
84
84
|
|---|---|---|
|
|
85
|
-
| `follows
|
|
86
|
-
| `follows
|
|
87
|
-
| `follows
|
|
88
|
-
| `follows
|
|
85
|
+
| `follows.<スキル名>/<名前>` | コンテンツごとに1つ | 準拠するコンテンツ |
|
|
86
|
+
| `follows.<参照>.version` | はい | consumerが受け入れるバージョン。形はバージョンとフィンガープリントの節で定める |
|
|
87
|
+
| `follows.<参照>.integrity` | はい | 最後にチェックした時のコンテンツのフィンガープリント |
|
|
88
|
+
| `follows.<参照>.examples` | いいえ | providerのチェックを適用する、consumerのファイル |
|
|
89
|
+
| `follows.<参照>.optional` | いいえ | providerが無くてもconsumerが動く時に`true`を書く。下で定める |
|
|
90
|
+
| `follows.<参照>.when` | いいえ | `optional: true`の時だけ書ける。利用者が名指さなくてもインストーラーがproviderをインストールする言語を書く。下とインストールの節で定める |
|
|
89
91
|
|
|
90
|
-
|
|
91
|
-
3行は`musubi add
|
|
92
|
+
consumerの`SKILL.md`の本文には、準拠するコンテンツごとに次の3行を書く。
|
|
93
|
+
この3行は`musubi add`が出力する。
|
|
92
94
|
|
|
93
95
|
```text
|
|
94
96
|
Write in the `design` format of the `design-doc` skill: open the `design-doc` skill by name and read the file it names for `design`.
|
|
@@ -96,60 +98,132 @@ If the `musubi` command is available, run `musubi check` before reading, and sto
|
|
|
96
98
|
If the `design-doc` skill is not installed, do not start: tell the user that `design-doc` is missing and how to install it, then stop.
|
|
97
99
|
```
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
コンテンツのファイルがスクリプトの時は、1行目が、書式として読む代わりに実行するようエージェントに伝える。
|
|
102
|
+
スクリプトかどうかは拡張子`.py`、`.sh`、`.bash`、`.js`、`.mjs`、`.cjs`、`.ts`で判定し、大文字と小文字は区別しない。
|
|
101
103
|
|
|
102
104
|
```text
|
|
103
105
|
Run the `verify` of the `design-doc` skill: open the `design-doc` skill by name and run the file it names for `verify`.
|
|
104
106
|
```
|
|
105
107
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
出す側の書式が共通の書き方の決まりに従う形がこれに当たる。
|
|
108
|
+
providerのスキルがインストールされていなくても動くconsumerは、その準拠に`optional: true`を書く。
|
|
109
|
+
この準拠を任意の準拠と呼ぶ (判断の記録[0007](../docs/adr/0007-optional-follows.ja.md))。
|
|
110
|
+
任意の準拠では、`musubi add --optional`が代わりに次の3行を出力する。
|
|
110
111
|
|
|
111
|
-
|
|
112
|
+
```text
|
|
113
|
+
When the `design-doc` skill is installed, write in the `design` format of the `design-doc` skill: open the `design-doc` skill by name and read the file it names for `design`.
|
|
114
|
+
If the `musubi` command is available, run `musubi check` before reading, and stop if it fails.
|
|
115
|
+
If the `design-doc` skill is not installed, go on without the `design` of `design-doc`.
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
任意の準拠は、consumerと一緒にproviderをインストールする言語を`when`に書いてもよい。
|
|
119
|
+
たとえば、日本語で書く利用者にだけ書き方のルールをインストールする時に使う (判断の記録[0009](../docs/adr/0009-optional-follows-name-their-languages.ja.md))。
|
|
120
|
+
`languages`には言語タグを並べ、`musubi add --optional --lang ja`がこれを書く。
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"musubi": "2026-11-21",
|
|
125
|
+
"follows": {
|
|
126
|
+
"japanese-writing/rules": {
|
|
127
|
+
"version": "^1.0.0",
|
|
128
|
+
"integrity": "sha256-yNSwpBT+xXEV5bGBqedpHmjWIHVi+JaAnRATAJ0s7wM=",
|
|
129
|
+
"optional": true,
|
|
130
|
+
"when": { "languages": ["ja"] }
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
112
135
|
|
|
113
|
-
|
|
114
|
-
|
|
136
|
+
consumerは、準拠するコンテンツに自分の節を追加できる。
|
|
137
|
+
ただし、providerのチェックが求めるものを削除したり、名前を変えたりはできない。
|
|
138
|
+
1つのスキルが、コンテンツを提供しながら別のコンテンツに準拠してもよい。
|
|
139
|
+
たとえば、providerの書式が、共通の書き方のルールに準拠することがある。
|
|
115
140
|
|
|
116
|
-
|
|
117
|
-
2. 本文が出す側のスキルと中身を名指す。エージェントは入っているスキルから出す側のスキルを名前で開き、その本文がその中身に名指すfileを読む。
|
|
118
|
-
3. エージェントはそのfileだけを丸ごと読み、出す側のほかの中身は読まない。
|
|
119
|
-
4. 出す側のスキルが入っていない時、エージェントは書き始めず、足りないスキルとその入れ方を人に伝えて止まる。
|
|
141
|
+
## 見つけ方と読み込み方
|
|
120
142
|
|
|
121
|
-
|
|
122
|
-
|
|
143
|
+
エージェントは`SKILL.md`の本文を読んでコンテンツを読み込み、スキルを使っている間に`musubi.json`を読むことはない。
|
|
144
|
+
そのため、musubiを知らないエージェントも、`musubi`コマンドを使えるエージェントと同じ方法でコンテンツを読み込む。
|
|
145
|
+
|
|
146
|
+
1. エージェントは、ほかのスキルと同じように、consumerの`SKILL.md`を読む。
|
|
147
|
+
2. 本文は、providerのスキルとコンテンツを名前で示す。エージェントはインストール済みのスキルからproviderのスキルを名前で開き、providerの本文がそのコンテンツについて指定するファイルを読む。
|
|
148
|
+
3. エージェントはそのファイルだけを全文読む。providerのほかのコンテンツは読まない。
|
|
149
|
+
4. providerのスキルがインストールされていない時、エージェントは作業を始めない。足りないスキルとそのインストール方法をユーザーに伝えて止まる。任意の準拠の時は止まらず、そのコンテンツ無しで作業を続ける。
|
|
150
|
+
|
|
151
|
+
Claude Code、Codex、GitHub Copilot CLI、Gemini CLIはどれもインストール済みのスキルを名前で一覧にするので、スキルがどこにインストールされていても名前で開ける。
|
|
152
|
+
別々のプラグインからインストールした2つのスキルは同じ場所に並ぶとは限らないので、スキルのフォルダどうしの相対パスは使わない。
|
|
153
|
+
|
|
154
|
+
`musubi check`と`musubi graph`は、コマンドラインで指定したフォルダからスキルを読む。
|
|
155
|
+
フォルダを指定しない時は、カレントフォルダとホームフォルダにある`.claude/skills`、`.agents/skills`、`.github/skills`、`.gemini/skills`を読む。
|
|
156
|
+
そのいずれかの直下にあり、`SKILL.md`を持つフォルダがスキルで、スキルの名前はフォルダの名前である。
|
|
157
|
+
同じ名前のスキルが2つのフォルダにある時は、上の順で先のフォルダのスキルを使い、`musubi check`がもう一方について警告する。
|
|
158
|
+
|
|
159
|
+
エージェントはコンテンツのファイルを全文読むので、`musubi check`は500行を超えるコンテンツを警告する。
|
|
160
|
+
500行は、Agent Skillsが`SKILL.md`に勧める長さである。
|
|
161
|
+
そのようなコンテンツも拒否はしない。
|
|
162
|
+
長いコンテンツは、providerが複数のコンテンツに分ける。
|
|
163
|
+
|
|
164
|
+
## インストール
|
|
165
|
+
|
|
166
|
+
スキルをインストールする時は、そのスキルが準拠するスキルもインストールする。
|
|
167
|
+
そうすれば、Claude Codeのプラグインの`dependencies`のようなフィールドを持たないエージェントでも、consumerはproviderを見つけられる (判断の記録[0008](../docs/adr/0008-install-follows-from-named-sources.ja.md))。
|
|
168
|
+
`musubi install`もほかのインストーラーも、consumerの`musubi.json`を読み、次の同じ決まりでインストールするスキルを決める。
|
|
169
|
+
|
|
170
|
+
1. 必須の準拠のproviderは全てインストールする。
|
|
171
|
+
2. 任意の準拠のproviderは、利用者がそのproviderを名指した時か、利用者が渡した言語の主な言語が準拠の`when.languages`のタグと同じ時だけインストールする。たとえば`ja-JP`は`ja`に合う。
|
|
172
|
+
3. インストールしたスキルごとに同じことを繰り返し、準拠の連鎖の最後まで辿る。
|
|
173
|
+
4. インストール済みのスキルはそのまま残し、そのスキルの準拠は辿る。
|
|
174
|
+
5. 必須の準拠のproviderがどのインストール元にも無い時と、その名前のコンテンツを提供しない時と、consumerの範囲の外のバージョンを提供する時は、何もインストールせず、その準拠を示す。
|
|
175
|
+
6. インストールした後に、再チェックの節のとおり`musubi check`を実行する。
|
|
176
|
+
|
|
177
|
+
`musubi.json`には、スキルのインストール元を書かない。
|
|
178
|
+
インストール元は利用者が名指し、インストーラーはその中から名前でスキルを探す。
|
|
179
|
+
エージェントがproviderを名前で開くのと同じ方法である。
|
|
180
|
+
|
|
181
|
+
`musubi install`は、インストール元を`--from`で受け取る。
|
|
182
|
+
インストール元はフォルダか、gitのリポジトリのURLである。
|
|
183
|
+
URLの時は`git clone --depth 1`で一時フォルダへクローンし、終わった後に消す。
|
|
184
|
+
インストール元の中で`SKILL.md`を持つフォルダは、`.git`と`node_modules`の中を除き、どの深さにあってもスキルで、スキルの名前はフォルダの名前である。
|
|
185
|
+
同じスキルを持つインストール元が複数ある時は、先に名指したインストール元を使う。
|
|
186
|
+
同じ名前のスキルを2つ持つインストール元は拒否する。
|
|
187
|
+
スキルのフォルダは丸ごと`--to`で指定したフォルダへコピーする。
|
|
188
|
+
`--to`が無い時は、カレントフォルダの`.claude/skills`、`.agents/skills`、`.github/skills`、`.gemini/skills`のうち、最初にあるフォルダへコピーする。
|
|
189
|
+
`musubi check`が見つけるスキルは、インストール済みとして扱う。
|
|
190
|
+
つまり、コピー先のフォルダと、引数の無い`musubi check`が読むフォルダにあるスキルである。
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
musubi install api-design --from ../skills --to .claude/skills
|
|
194
|
+
musubi install convey --from https://github.com/example/skills --lang ja --with design-doc
|
|
195
|
+
```
|
|
123
196
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
197
|
+
| オプション | 意味 |
|
|
198
|
+
|---|---|
|
|
199
|
+
| `--from <フォルダかgitのURL>` | インストール元。複数指定すると、指定した順に探す |
|
|
200
|
+
| `--to <スキルのフォルダ>` | インストールするフォルダ |
|
|
201
|
+
| `--with <スキル名>` | 任意の準拠のproviderを名前で指定してインストールする。複数指定できる |
|
|
202
|
+
| `--lang <言語タグ>` | 利用者が書く言語。`when.languages`と照らし合わせる。複数指定できる |
|
|
128
203
|
|
|
129
|
-
|
|
130
|
-
500行はAgent Skillsが`SKILL.md`に勧める長さである。
|
|
131
|
-
そのような中身も拒まず、長い中身は出す側が複数の中身に分ける。
|
|
204
|
+
`musubi install`の終了コードは、全てをインストールして`musubi check`が通った時は`0`、問題があって何もインストールしなかった時か`musubi check`が問題を見つけた時は`1`、コマンドの呼び出し方が間違っている時は`2`である。
|
|
132
205
|
|
|
133
|
-
##
|
|
206
|
+
## バージョンとフィンガープリント
|
|
134
207
|
|
|
135
|
-
|
|
208
|
+
コンテンツのバージョンは`MAJOR.MINOR.PATCH`の形で書く。
|
|
136
209
|
|
|
137
|
-
|
|
|
210
|
+
| コンテンツかチェックの変更 | 上げる番号 |
|
|
138
211
|
|---|---|
|
|
139
|
-
|
|
|
140
|
-
|
|
|
141
|
-
|
|
|
212
|
+
| consumerがチェックを通らなくなりうる変更。必須の節や列を削除するか名前を変える、チェックを厳しくする | `MAJOR` |
|
|
213
|
+
| consumerが使えるものを追加する変更。任意の節を追加するなど | `MINOR` |
|
|
214
|
+
| 全てのconsumerが通ったままになる、言い回しの変更 | `PATCH` |
|
|
142
215
|
|
|
143
|
-
|
|
216
|
+
consumerは、受け入れるバージョンを次の3つの形のいずれかで書く。
|
|
217
|
+
読み方はnpmと同じである。
|
|
144
218
|
|
|
145
|
-
| 形 |
|
|
219
|
+
| 形 | 受け入れるバージョン | 例 |
|
|
146
220
|
|---|---|---|
|
|
147
|
-
| `^X.Y.Z` | `X.Y.Z`から次の`MAJOR`の手前まで。`0.Y.Z
|
|
148
|
-
| `~X.Y.Z` | `X.Y.Z`から次の`MINOR`の手前まで | `~1.2.0`は`1.2.7
|
|
221
|
+
| `^X.Y.Z` | `X.Y.Z`から次の`MAJOR`の手前まで。`0.Y.Z`の時は次の`MINOR`の手前まで | `^1.2.0`は`1.9.4`を受け入れ、`2.0.0`は受け入れない |
|
|
222
|
+
| `~X.Y.Z` | `X.Y.Z`から次の`MINOR`の手前まで | `~1.2.0`は`1.2.7`を受け入れ、`1.3.0`は受け入れない |
|
|
149
223
|
| `X.Y.Z` | `X.Y.Z`だけ | `1.2.0` |
|
|
150
224
|
|
|
151
|
-
|
|
152
|
-
|
|
225
|
+
フィンガープリントは、consumerが最後にどの内容に対してチェックされたかを正確に記録する。
|
|
226
|
+
エージェントはproviderの`SKILL.md`とコンテンツのファイルを読み、チェックはconsumerが通るかを決めるので、フィンガープリントはこの3つのファイルを対象にする。
|
|
153
227
|
|
|
154
228
|
```text
|
|
155
229
|
for each path in [SKILL.md, <file>, <check, when present>]:
|
|
@@ -159,47 +233,56 @@ for each path in [SKILL.md, <file>, <check, when present>]:
|
|
|
159
233
|
integrity = "sha256-" + base64(sha256 digest)
|
|
160
234
|
```
|
|
161
235
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
`musubi.json
|
|
167
|
-
`musubi check
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
-
|
|
182
|
-
-
|
|
183
|
-
-
|
|
184
|
-
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
236
|
+
パスはproviderのスキルのフォルダからの相対パスで、区切りに`/`を使う。
|
|
237
|
+
バージョンの範囲とフィンガープリントは`musubi.json`に並べて書き、ロックファイルは持たない (判断の記録[0003](../docs/adr/0003-range-and-fingerprint-without-a-lockfile.ja.md))。
|
|
238
|
+
|
|
239
|
+
定義そのもののバージョンは日付で表す。
|
|
240
|
+
`musubi.json`とチェックのファイルは、準拠する日付を`musubi`のフィールドに書く。
|
|
241
|
+
`musubi check`は知っている日付を全て読み、それ以外の日付を拒否する。
|
|
242
|
+
知っている日付は、`schema/`の下にあるフォルダの名前である。
|
|
243
|
+
定義のバージョン`2026-11-20`で`follows.<参照>.optional`を加えた。
|
|
244
|
+
`2026-11-19`を書いた`musubi.json`は今も通り、`optional`は書けない。
|
|
245
|
+
定義のバージョン`2026-11-21`で`follows.<参照>.when`を加えた。
|
|
246
|
+
`2026-11-20`を書いた`musubi.json`は今も通り、`when`は書けない。
|
|
247
|
+
|
|
248
|
+
## 再チェック
|
|
249
|
+
|
|
250
|
+
consumerは、スキルをインストールした後と、スキルを更新した後に再チェックされる。
|
|
251
|
+
`musubi`コマンドが使える時は、エージェントがコンテンツを読む前にも再チェックされる。
|
|
252
|
+
|
|
253
|
+
`musubi check`は次の場合に、ファイルと行を示して拒否する。
|
|
254
|
+
|
|
255
|
+
- `musubi.json`がJSONとして正しくない、定義にないフィールドを持つ、知らない定義のバージョンを指定している
|
|
256
|
+
- バージョンが`MAJOR.MINOR.PATCH`の形でない、範囲が3つの形のどれでもない
|
|
257
|
+
- 準拠が`optional: true`無しで`when`を持つ、`when`が`languages`の言語タグの一覧以外を持つ
|
|
258
|
+
- ファイル、チェック、例のパスがスキルのフォルダの外へ出るか、存在しないファイルを指している
|
|
259
|
+
- チェックがJSONのルールのファイルでない
|
|
260
|
+
- consumerが、インストールされていないスキル (任意の準拠を除く) か、そのスキルが提供していないコンテンツに準拠している
|
|
261
|
+
- providerのバージョンがconsumerの範囲の外にある
|
|
262
|
+
- フィンガープリントが一致しない。最後のチェックの後にコンテンツが変わったことを表す
|
|
263
|
+
- 例がproviderのチェックのルールに違反している
|
|
264
|
+
- スキルどうしが循環して準拠している (`alpha -> beta -> alpha`など)
|
|
265
|
+
|
|
266
|
+
任意の準拠のスキルがインストールされていない時、`musubi check`は警告を出してその準拠を飛ばす。
|
|
267
|
+
インストールされている時は、ほかの準拠と同じようにチェックする。
|
|
268
|
+
循環しない限り、準拠の連鎖はどれだけ深くてもよい。
|
|
269
|
+
フィンガープリントが一致しない時、そのコンテンツはまだ受け入れられていないので、`musubi check`はそのproviderのチェックを適用しない。
|
|
270
|
+
`musubi check --update`は変わったコンテンツにチェックを適用し、全ての例が通った時だけフィンガープリントを書き換える。
|
|
271
|
+
|
|
272
|
+
1つでも通らなかった時は、フィンガープリントを元のまま残す。
|
|
273
|
+
`--update`を付けない`musubi check`は、ファイルを書き込まない。
|
|
274
|
+
|
|
275
|
+
| 終了コード | 意味 |
|
|
193
276
|
|---|---|
|
|
194
|
-
| `0` |
|
|
195
|
-
| `1` | 1
|
|
196
|
-
| `2` |
|
|
277
|
+
| `0` | 全ての宣言と例が通った。警告を出力することがある |
|
|
278
|
+
| `1` | 1つ以上の問題があり、`<ファイル>:<行>: <メッセージ>`の形で出力した |
|
|
279
|
+
| `2` | コマンドの呼び出し方が間違っている |
|
|
197
280
|
|
|
198
|
-
##
|
|
281
|
+
## チェックのルール
|
|
199
282
|
|
|
200
|
-
|
|
201
|
-
`musubi check
|
|
202
|
-
|
|
283
|
+
チェックのファイルは、定義のバージョンとルールの一覧を持つJSONである。
|
|
284
|
+
`musubi check`はルールを読み、consumerが指定した例それぞれに適用する。
|
|
285
|
+
providerのコードは実行しない (判断の記録[0004](../docs/adr/0004-checks-are-json-rules.ja.md))。
|
|
203
286
|
|
|
204
287
|
```json
|
|
205
288
|
{
|
|
@@ -212,31 +295,33 @@ pathは出す側のスキルのフォルダからの相対で、区切りに`/`
|
|
|
212
295
|
}
|
|
213
296
|
```
|
|
214
297
|
|
|
215
|
-
| 種類 |
|
|
298
|
+
| 種類 | フィールド | 例が通る条件 |
|
|
216
299
|
|---|---|---|
|
|
217
|
-
| `headings` | `headings
|
|
218
|
-
| `forbid` | `text
|
|
219
|
-
| `table-columns` | `heading
|
|
300
|
+
| `headings` | `headings`に見出しの行を並べる | 全ての見出しの行がこの順番で現れる。間にほかの見出しがあってもよい |
|
|
301
|
+
| `forbid` | `text`に文字列を並べる | どの行も、並べた文字列のいずれも含まない |
|
|
302
|
+
| `table-columns` | `heading`と`columns` | 見出しの下の最初の表が全ての列を持つ。ほかの列があってもよい |
|
|
220
303
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
304
|
+
ルールは、コードブロックの中の行を読み飛ばす。
|
|
305
|
+
各ルールは求めるものだけを探すので、consumerが追加した節は通る。
|
|
306
|
+
新しい種類のルールは、新しい定義のバージョンで追加する。
|
|
224
307
|
|
|
225
|
-
##
|
|
308
|
+
## 既存の仕組みとの関係
|
|
226
309
|
|
|
227
|
-
| 仕組み |
|
|
310
|
+
| 仕組み | すること | musubiとの関係 |
|
|
228
311
|
|---|---|---|
|
|
229
|
-
|
|
|
230
|
-
| Claude Code
|
|
231
|
-
| Agent Skills | `SKILL.md
|
|
232
|
-
| Agent Skills
|
|
312
|
+
| スキルのインストーラー (APM、npx skills、skillpmなど) | スキルとその依存をインストールし、バージョンを固定する | スキルのインストール元はインストーラーが管理する。`musubi.json`はスキルとコンテンツとバージョンだけを書くので、インストール元を書くのは1か所で済む。`musubi.json`を読むインストーラーは、インストールの節のとおりにproviderをインストールする |
|
|
313
|
+
| Claude Codeのプラグインの`dependencies` | プラグインが依存するプラグインをインストールする | インストーラーと同じ。このようなフィールドを持たないエージェントでは、`musubi install`がproviderをインストールする。何もインストールしなかった時は、consumerの本文にある作業を止める1行がエージェントを止める |
|
|
314
|
+
| Agent Skills | `SKILL.md`とスキルのフォルダを定める | `SKILL.md`は変えず、フォルダの中に`musubi.json`が1つ増えるだけである。musubiは実際のスキルで動くようになった後に、Agent Skillsへ提案する |
|
|
315
|
+
| Agent Skillsの依存ファイルとロックファイルの提案 | スキルが必要とするスキルを宣言する | これらはどのスキルをインストールするかを書く。musubiは、そのスキルのどのコンテンツにどのバージョンで準拠するかを書き、再チェックする |
|
|
233
316
|
|
|
234
|
-
## musubi
|
|
317
|
+
## musubiコマンド
|
|
235
318
|
|
|
236
|
-
|
|
319
|
+
コマンドはNode.js 22.18以降で動き、実行時の依存を持たない。
|
|
320
|
+
`musubi install`は、gitのURLで指定したインストール元をクローンする時だけ`git`を実行する。
|
|
237
321
|
|
|
238
|
-
|
|
|
322
|
+
| コマンド | すること |
|
|
239
323
|
|---|---|
|
|
240
|
-
| `musubi check [<フォルダ>...] [--update]` |
|
|
241
|
-
| `musubi add
|
|
242
|
-
| `musubi
|
|
324
|
+
| `musubi check [<フォルダ>...] [--update]` | フォルダの中の全ての`musubi.json`を、再チェックの節のとおりにチェックする |
|
|
325
|
+
| `musubi add <スキル名>/<名前> [<フォルダ>...] [--optional [--lang <言語タグ>]...]` | consumerのフォルダで実行する。`musubi.json`に範囲`^<今のバージョン>`とフィンガープリントを書き込み、既にあるフィールドは残し、`SKILL.md`に置く3行を出力する。`--optional`を付けると`optional: true`も書いて任意の準拠の3行を出力し、`--lang`を付けると`when.languages`を書く。書くフィールドを`musubi`の定義のバージョンが持たない時は、そのフィールドを持つ最も古い定義のバージョンに上げる |
|
|
326
|
+
| `musubi install <スキル名>... --from <インストール元>... [--to <フォルダ>] [--with <スキル名>]... [--lang <言語タグ>]...` | スキルと、そのスキルが準拠するproviderを、インストールの節のとおりにインストールし、`musubi check`を実行する |
|
|
327
|
+
| `musubi graph [<フォルダ>...] [--out <ファイル>]` | 各スキルと、準拠するコンテンツへの矢印を描いたHTMLのページを1つ書き出す |
|
package/spec/musubi.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The musubi definition
|
|
2
2
|
|
|
3
|
-
Definition version `2026-11-
|
|
3
|
+
Definition version `2026-11-21`.
|
|
4
4
|
|
|
5
5
|
musubi binds the content one agent skill provides, such as a document format or writing rules, to the skills that follow it.
|
|
6
6
|
A skill declares that content under a name and a version, another skill declares that it follows it, agents load it the same way in every agent that reads `SKILL.md`, and the skills that follow it are checked again when it changes.
|
|
@@ -84,6 +84,8 @@ A consumer skill lists the content it follows under `follows` in `musubi.json`.
|
|
|
84
84
|
| `follows.<ref>.version` | Yes | The versions the consumer accepts, described in Versions and fingerprints |
|
|
85
85
|
| `follows.<ref>.integrity` | Yes | The fingerprint of the content at the last check |
|
|
86
86
|
| `follows.<ref>.examples` | No | Files of the consumer that the provider's check is applied to |
|
|
87
|
+
| `follows.<ref>.optional` | No | `true` when the consumer also works without the provider, described below |
|
|
88
|
+
| `follows.<ref>.when` | No | Only with `optional: true`: the languages for which an installer installs the provider without being asked, described below and in Installing |
|
|
87
89
|
|
|
88
90
|
The consumer's `SKILL.md` body carries three lines for each content it follows, which `musubi add` prints.
|
|
89
91
|
|
|
@@ -99,6 +101,32 @@ When the content's file is a script, told apart by the extensions `.py`, `.sh`,
|
|
|
99
101
|
Run the `verify` of the `design-doc` skill: open the `design-doc` skill by name and run the file it names for `verify`.
|
|
100
102
|
```
|
|
101
103
|
|
|
104
|
+
A consumer that also works without the provider writes `optional: true` in that follow, which makes it an optional follow (decision record [0007](../docs/adr/0007-optional-follows.md)).
|
|
105
|
+
For an optional follow, `musubi add --optional` prints these three lines instead.
|
|
106
|
+
|
|
107
|
+
```text
|
|
108
|
+
When the `design-doc` skill is installed, write in the `design` format of the `design-doc` skill: open the `design-doc` skill by name and read the file it names for `design`.
|
|
109
|
+
If the `musubi` command is available, run `musubi check` before reading, and stop if it fails.
|
|
110
|
+
If the `design-doc` skill is not installed, go on without the `design` of `design-doc`.
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
An optional follow may also name in `when` the languages for which the provider is installed together with the consumer, such as writing rules for users who write Japanese (decision record [0009](../docs/adr/0009-optional-follows-name-their-languages.md)).
|
|
114
|
+
`languages` lists language tags, and `musubi add --optional --lang ja` writes them.
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"musubi": "2026-11-21",
|
|
119
|
+
"follows": {
|
|
120
|
+
"japanese-writing/rules": {
|
|
121
|
+
"version": "^1.0.0",
|
|
122
|
+
"integrity": "sha256-yNSwpBT+xXEV5bGBqedpHmjWIHVi+JaAnRATAJ0s7wM=",
|
|
123
|
+
"optional": true,
|
|
124
|
+
"when": { "languages": ["ja"] }
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
102
130
|
A consumer may add its own sections to the content it follows.
|
|
103
131
|
It may not remove or rename what the provider's check requires.
|
|
104
132
|
A skill may both provide content and follow content; a provider's format may follow shared writing rules, for example.
|
|
@@ -111,7 +139,7 @@ An agent that knows nothing of musubi therefore loads content the same way as on
|
|
|
111
139
|
1. The agent reads the consumer's `SKILL.md`, as it does for any skill.
|
|
112
140
|
2. The body names the provider skill and the content. The agent opens the provider skill by name from the skills it has installed and reads the file that the provider's body names for that content.
|
|
113
141
|
3. The agent reads only that file, whole. It does not read the provider's other content.
|
|
114
|
-
4. When the provider skill is not installed, the agent does not start; it tells the user which skill is missing and how to install it, and stops.
|
|
142
|
+
4. When the provider skill is not installed, the agent does not start; it tells the user which skill is missing and how to install it, and stops. When the follow is optional, the agent goes on without that content instead.
|
|
115
143
|
|
|
116
144
|
Claude Code, Codex, GitHub Copilot CLI, and Gemini CLI each list installed skills by name, so opening a skill by name works wherever the skill is installed.
|
|
117
145
|
Relative paths between skill folders are not used, because two skills from different plugins are not installed side by side.
|
|
@@ -124,6 +152,41 @@ When two folders hold a skill of the same name, the first folder in that order w
|
|
|
124
152
|
Agents read a content file whole, so `musubi check` warns when one is over 500 lines, the length Agent Skills suggests for `SKILL.md`.
|
|
125
153
|
It does not refuse such content; a provider splits a long content into several.
|
|
126
154
|
|
|
155
|
+
## Installing
|
|
156
|
+
|
|
157
|
+
Installing a skill also installs the skills it follows, so that a consumer finds its providers in every agent, including agents without a field like Claude Code plugin `dependencies` (decision record [0008](../docs/adr/0008-install-follows-from-named-sources.md)).
|
|
158
|
+
An installer, `musubi install` or another, reads the consumer's `musubi.json` and decides what to install the same way.
|
|
159
|
+
|
|
160
|
+
1. It installs the provider of every required follow.
|
|
161
|
+
2. It installs the provider of an optional follow only when the user names that provider, or when a language the user gives has the same primary language as a tag in the follow's `when.languages`, so `ja-JP` matches `ja`.
|
|
162
|
+
3. It does the same for each skill it installs, down the whole chain.
|
|
163
|
+
4. It keeps a skill that is already installed as it is, and still follows that skill's follows.
|
|
164
|
+
5. When the provider of a required follow is in no source, provides no content of that name, or provides a version outside the consumer's range, it installs nothing and names the follow.
|
|
165
|
+
6. After installing, it runs `musubi check`, as described in Re-checking.
|
|
166
|
+
|
|
167
|
+
`musubi.json` never says where a skill comes from.
|
|
168
|
+
The user names the sources, and the installer finds each skill in them by its name, the way agents open a provider by name.
|
|
169
|
+
|
|
170
|
+
`musubi install` takes each source with `--from`: a folder, or a git repository URL that it clones with `git clone --depth 1` into a temporary folder and removes afterward.
|
|
171
|
+
In a source, every folder that holds `SKILL.md` is a skill named by its folder, at any depth outside `.git` and `node_modules`, and the first source that holds a skill wins.
|
|
172
|
+
A source that holds two skills of the same name is refused.
|
|
173
|
+
It copies each skill folder whole into the folder named with `--to`, or, without `--to`, into the first of `.claude/skills`, `.agents/skills`, `.github/skills`, and `.gemini/skills` that exists in the current folder.
|
|
174
|
+
A skill counts as installed when `musubi check` would find it: in that folder, or in the folders it reads without arguments.
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
musubi install api-design --from ../skills --to .claude/skills
|
|
178
|
+
musubi install convey --from https://github.com/example/skills --lang ja --with design-doc
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
| Option | Means |
|
|
182
|
+
|---|---|
|
|
183
|
+
| `--from <folder or git URL>` | A source. Given more than once, the sources are searched in order |
|
|
184
|
+
| `--to <skills folder>` | The folder to install into |
|
|
185
|
+
| `--with <skill>` | Installs the provider of an optional follow by name. It may be given more than once |
|
|
186
|
+
| `--lang <language tag>` | A language the user writes in, matched against `when.languages`. It may be given more than once |
|
|
187
|
+
|
|
188
|
+
`musubi install` exits with `0` when everything was installed and `musubi check` passed, `1` when it installed nothing because of a problem or `musubi check` found one, and `2` when it was called the wrong way.
|
|
189
|
+
|
|
127
190
|
## Versions and fingerprints
|
|
128
191
|
|
|
129
192
|
A content version is `MAJOR.MINOR.PATCH`.
|
|
@@ -159,6 +222,8 @@ The range and the fingerprint sit together in `musubi.json`; there is no lockfil
|
|
|
159
222
|
The definition itself is versioned by date.
|
|
160
223
|
Each `musubi.json` and each check file names the date it follows in `musubi`, and `musubi check` reads every date it knows and refuses the others.
|
|
161
224
|
The dates it knows are the folders under `schema/`.
|
|
225
|
+
Definition version `2026-11-20` added `follows.<ref>.optional`; a `musubi.json` that names `2026-11-19` still passes and may not use it.
|
|
226
|
+
Definition version `2026-11-21` added `follows.<ref>.when`; a `musubi.json` that names `2026-11-20` still passes and may not use it.
|
|
162
227
|
|
|
163
228
|
## Re-checking
|
|
164
229
|
|
|
@@ -168,14 +233,16 @@ A consumer is checked again after a skill is installed, after a skill is updated
|
|
|
168
233
|
|
|
169
234
|
- `musubi.json` is not valid JSON, has a field the definition does not know, or names a definition version it does not know
|
|
170
235
|
- a version is not `MAJOR.MINOR.PATCH`, or a range is not one of the three forms
|
|
236
|
+
- a follow has `when` without `optional: true`, or `when` holds anything but a list of language tags in `languages`
|
|
171
237
|
- a file, check, or example path leaves the skill folder or names a missing file
|
|
172
238
|
- a check is not a JSON rules file
|
|
173
|
-
- a consumer follows a skill that is not installed, or a content that skill does not provide
|
|
239
|
+
- a consumer follows a skill that is not installed (except in an optional follow), or a content that skill does not provide
|
|
174
240
|
- the provider's version is outside the consumer's range
|
|
175
241
|
- the fingerprint does not match, which means the content changed after the last check
|
|
176
242
|
- an example breaks a rule of the provider's check
|
|
177
243
|
- skills follow each other in a cycle, such as `alpha -> beta -> alpha`
|
|
178
244
|
|
|
245
|
+
When the skill of an optional follow is not installed, `musubi check` warns and skips that follow; when it is installed, the follow is checked like any other.
|
|
179
246
|
Chains of any depth are allowed as long as they do not form a cycle.
|
|
180
247
|
When a fingerprint does not match, `musubi check` does not apply that provider's check, because its content has not been accepted.
|
|
181
248
|
`musubi check --update` applies the check to the changed content and rewrites the fingerprint only when every example passes; when one fails, the fingerprint stays as it was.
|
|
@@ -217,17 +284,19 @@ A new kind of rule is added by a new definition version.
|
|
|
217
284
|
|
|
218
285
|
| System | What it does | How musubi relates |
|
|
219
286
|
|---|---|---|
|
|
220
|
-
| Skill installers (APM, npx skills, skillpm, and others) | Install skills and their dependencies, and lock versions | They own where a skill comes from. `musubi.json` names only the skill, the content, and the version, so the source is written once |
|
|
221
|
-
| Claude Code plugin `dependencies` | Install the plugins a plugin depends on | Same as installers.
|
|
287
|
+
| Skill installers (APM, npx skills, skillpm, and others) | Install skills and their dependencies, and lock versions | They own where a skill comes from. `musubi.json` names only the skill, the content, and the version, so the source is written once. An installer that reads `musubi.json` installs the providers as described in Installing |
|
|
288
|
+
| Claude Code plugin `dependencies` | Install the plugins a plugin depends on | Same as installers. In agents without such a field, `musubi install` installs the providers; when nothing installed them, the stop line in the consumer's body stops the agent |
|
|
222
289
|
| Agent Skills | Defines `SKILL.md` and the skill folder | `SKILL.md` is unchanged and `musubi.json` is one more file in the folder. musubi is to be proposed to Agent Skills once it runs on real skills |
|
|
223
290
|
| Agent Skills proposals for dependency files and lockfiles | Declare which skills a skill needs | They say which skill to install. musubi says which content of it a skill follows, at which version, and checks it again |
|
|
224
291
|
|
|
225
292
|
## The musubi command
|
|
226
293
|
|
|
227
294
|
The command needs Node.js 22.18 or later and has no runtime dependencies.
|
|
295
|
+
`musubi install` runs `git` only to clone a source given as a git URL.
|
|
228
296
|
|
|
229
297
|
| Command | Does |
|
|
230
298
|
|---|---|
|
|
231
299
|
| `musubi check [<folder>...] [--update]` | Checks every `musubi.json` in the folders, as described in Re-checking |
|
|
232
|
-
| `musubi add <skill>/<content> [<folder>...]` | Run in a consumer's folder: writes the range `^<current version>` and the fingerprint into its `musubi.json`, keeps the fields already there, and prints the three lines for its `SKILL.md` |
|
|
300
|
+
| `musubi add <skill>/<content> [<folder>...] [--optional [--lang <language>]...]` | Run in a consumer's folder: writes the range `^<current version>` and the fingerprint into its `musubi.json`, keeps the fields already there, and prints the three lines for its `SKILL.md`. With `--optional` it also writes `optional: true` and prints the three lines for an optional follow, and `--lang` writes `when.languages`. When the file names a definition version that does not know a field it writes, it moves `musubi` to the earliest definition version that does |
|
|
301
|
+
| `musubi install <skill>... --from <source>... [--to <folder>] [--with <skill>]... [--lang <language>]...` | Installs the skills and the providers they follow, as described in Installing, then runs `musubi check` |
|
|
233
302
|
| `musubi graph [<folder>...] [--out <file>]` | Writes one HTML page that draws each skill and an arrow to each content it follows |
|