@heihei0299/matt-skills 3.0.2 → 3.0.3
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/skills/tdd-implement/SKILL.md +18 -12
- package/.agents/skills/tdd-implement/references/finalize.md +6 -6
- package/.agents/skills/tdd-implement/references/orchestration.md +5 -5
- package/README.md +1 -1
- package/bin/cli.js +45 -18
- package/package.json +1 -1
- package/template/.opencode/CONTEXT.md +8 -26
- package/template/.opencode/docs/agents/runtime-discipline.md +17 -28
- package/template/.opencode/docs/agents/skill-design.md +10 -32
- package/template/.pi/CONTEXT.md +8 -26
- package/template/.pi/docs/agents/runtime-discipline.md +17 -28
- package/template/.pi/docs/agents/skill-design.md +10 -32
- package/template/AGENTS.md +4 -0
|
@@ -35,32 +35,37 @@ disable-model-invocation: true
|
|
|
35
35
|
|
|
36
36
|
读取 [verify.md](references/verify.md),执行当前 issue 所需的最终验证。
|
|
37
37
|
|
|
38
|
-
最终验证通过且 diff
|
|
38
|
+
最终验证通过且 diff 稳定后进入 Review。
|
|
39
39
|
|
|
40
40
|
#### Review
|
|
41
41
|
|
|
42
|
-
每个 issue
|
|
42
|
+
每个 issue 维护以下 Review 状态:
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
- `full_review_done = false`
|
|
45
|
+
- `open_findings = []`
|
|
46
|
+
|
|
47
|
+
当 `full_review_done = false` 时,只调用一次完整 `code-review`。完成后立即设置 `full_review_done = true`,并将 blocking findings 写入 `open_findings`。
|
|
48
|
+
|
|
49
|
+
当 `full_review_done = true` 时,完整 `code-review` 路径关闭,不得再次启动完整双轴 Review。后续仅处理 `open_findings`:
|
|
45
50
|
|
|
46
51
|
1. 仅修复对应 finding,不扩大当前 issue 范围;
|
|
47
|
-
2.
|
|
48
|
-
3.
|
|
49
|
-
4.
|
|
50
|
-
5.
|
|
52
|
+
2. 重新验证该修复直接影响的证据;
|
|
53
|
+
3. 直接针对该 finding 与修复 diff 做增量 Review;增量 Review 不调用完整 `code-review`;
|
|
54
|
+
4. 复核通过后从 `open_findings` 移除该 finding;
|
|
55
|
+
5. 若修复产生新的 Behavior,返回 Red-Green 对该 Behavior 执行 TDD,再回 Verify 验证受影响范围;`full_review_done` 保持为 `true`。
|
|
51
56
|
|
|
52
|
-
|
|
57
|
+
`full_review_done = true` 且 `open_findings` 为空时 Review 才算通过。审查维度、reviewer 数量、提示词和输出格式仍以 `code-review` 为唯一事实源。
|
|
53
58
|
|
|
54
59
|
**出口:**
|
|
55
60
|
|
|
56
61
|
- 当前 issue 所需最终验证通过;
|
|
57
62
|
- 要求的真实运行验证完成;
|
|
58
|
-
-
|
|
59
|
-
-
|
|
63
|
+
- `full_review_done = true`;
|
|
64
|
+
- `open_findings` 为空。
|
|
60
65
|
|
|
61
66
|
## Finalize
|
|
62
67
|
|
|
63
|
-
Verify 通过后读取 [finalize.md](references/finalize.md),完成当前 issue
|
|
68
|
+
Verify 与 Review 通过后读取 [finalize.md](references/finalize.md),完成当前 issue 的必要同步、tracker/progress 与仓库 Git policy 收尾。
|
|
64
69
|
|
|
65
70
|
Finalize 不新增产品 Behavior;若发现实现或验证遗漏,回到对应 Step 完成后再收尾。
|
|
66
71
|
|
|
@@ -69,7 +74,8 @@ Finalize 不新增产品 Behavior;若发现实现或验证遗漏,回到对
|
|
|
69
74
|
- Red-Green 必须覆盖当前 issue 的全部待实现 Behavior,不能只对第一个改动执行 TDD。
|
|
70
75
|
- 一个 Behavior 完成后继续下一个 Behavior,直到 Step ① 出口满足。
|
|
71
76
|
- Verify 只做当前 issue 必要的最终验证;已通过的等价验证不机械重复。
|
|
72
|
-
-
|
|
77
|
+
- 每个 issue 的完整双轴 Review 只允许从 `full_review_done = false` 进入一次;之后只处理 `open_findings` 的增量 Review。
|
|
78
|
+
- Git 提交数量与粒度服从当前仓库规则和用户指令,本技能不另行规定。
|
|
73
79
|
- 当前 Step 达到出口后继续进入下一 Step;仅在需要用户决策或存在外部阻塞时暂停。
|
|
74
80
|
|
|
75
81
|
## References
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# Finalize
|
|
2
2
|
|
|
3
|
-
仅在 Verify 通过后执行;不新增产品 Behavior。
|
|
3
|
+
仅在 Verify 与 Review 通过后执行;不新增产品 Behavior。Git 提交数量与粒度由当前仓库规则和用户指令决定,本文件不另行规定。
|
|
4
4
|
|
|
5
5
|
1. 完成实现要求的必要 docs/config 同步。
|
|
6
|
-
2.
|
|
7
|
-
3.
|
|
8
|
-
4.
|
|
6
|
+
2. 更新 Acceptance Criteria 与 progress/tracker,记录 Review、验证与运行结果;若当前仓库策略已产生 commit,可记录对应 commit。
|
|
7
|
+
3. 将 issue 标记 `resolved`,并解除已满足的 blockers。
|
|
8
|
+
4. 若当前仓库规则或用户指令要求提交,按其 Git policy 执行。
|
|
9
9
|
|
|
10
10
|
若发现实现或验证遗漏,返回对应 Step 完成后再收尾。
|
|
11
11
|
|
|
12
12
|
## 出口
|
|
13
13
|
|
|
14
|
-
- 当前 issue 的独立 commit 已创建;
|
|
15
14
|
- Acceptance Criteria 全部通过;
|
|
16
|
-
- tracker/progress
|
|
15
|
+
- issue、blockers 与 tracker/progress 和实际完成状态一致;
|
|
16
|
+
- Git 行为符合当前仓库规则与用户指令。
|
|
@@ -25,19 +25,19 @@ for each layer:
|
|
|
25
25
|
|
|
26
26
|
一个 issue Finalize 完成后立即进入下一个可调度 issue。前置 issue 未完成时,其依赖项保持 `blocked`。
|
|
27
27
|
|
|
28
|
-
每个 issue 的
|
|
28
|
+
每个 issue 的 Red-Green 与 Review 编排以 `SKILL.md` 为准;验证与 Finalize 分别以 `verify.md`、`finalize.md` 为准,本文件不重复定义。
|
|
29
29
|
|
|
30
30
|
## 3. 状态收敛
|
|
31
31
|
|
|
32
32
|
每个 issue 完成后同步:
|
|
33
33
|
|
|
34
34
|
- `Status`;
|
|
35
|
-
- commit;
|
|
36
35
|
- Review 状态;
|
|
37
36
|
- 验证结果;
|
|
38
|
-
- 已解除的 blockers
|
|
37
|
+
- 已解除的 blockers;
|
|
38
|
+
- commit(仅当当前仓库 Git policy 已产生对应 commit 时)。
|
|
39
39
|
|
|
40
|
-
当前层所有 issue 完成后进入下一层。全部层完成后,确认 issue 与 progress 状态一致即可结束;不额外扩大验证范围,也不再次执行完整 Review。
|
|
40
|
+
当前层所有 issue 完成后进入下一层。全部层完成后,确认 issue 与 progress 状态一致即可结束;不额外扩大验证范围,也不再次执行完整 Review。Git 提交数量与粒度始终服从当前仓库规则和用户指令。
|
|
41
41
|
|
|
42
42
|
## 冲突与失败
|
|
43
43
|
|
|
@@ -49,6 +49,6 @@ for each layer:
|
|
|
49
49
|
## 出口
|
|
50
50
|
|
|
51
51
|
- 所有可执行 issue 均按依赖顺序完成;
|
|
52
|
-
- 每个完成的 issue 均有独立 commit;
|
|
53
52
|
- issue、依赖状态与 progress 一致;
|
|
53
|
+
- Git 行为符合当前仓库规则与用户指令;
|
|
54
54
|
- 不存在被误当作已完成的 blocked issue。
|
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ npx @heihei0299/matt-skills sync --all # 同步全部可分发 skills
|
|
|
55
55
|
npx @heihei0299/matt-skills sync --dry-run --json
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
`init` 默认保护已有 `AGENTS.md`;需要刷新完整模板时使用 `init --all
|
|
58
|
+
`init` 默认保护已有 `AGENTS.md`;需要刷新完整模板时使用 `init --all`。默认 `sync` 只刷新 `AGENTS.md` 的 `matt-skills:managed` 受管区块并保留标记外的项目规则;旧的无标记 `AGENTS.md` 原样保留,`sync --all` 才整体刷新。`sync` 不删除目标项目的额外文件或自定义 skills。
|
|
59
59
|
|
|
60
60
|
默认 programming 范围中的 4 个独有 skills 是 `tdd-implement`、`diagnose-fix`、`grill-to-spec`、`show-me`。
|
|
61
61
|
|
package/bin/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { readdir, readFile, cp, stat, rm, mkdir } from 'node:fs/promises';
|
|
2
|
+
import { readdir, readFile, writeFile, cp, stat, rm, mkdir } from 'node:fs/promises';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
@@ -71,7 +71,7 @@ Sync options:
|
|
|
71
71
|
--dest <path> Target directory (default: current directory)
|
|
72
72
|
--help, -h Show this help
|
|
73
73
|
|
|
74
|
-
说明:默认不带 --all
|
|
74
|
+
说明:默认不带 --all 增量同步默认 programming skill,并只更新 AGENTS.md 的 matt-skills 受管区块;没有受管标记的现有 AGENTS.md 原样保留。--all 时同步全部可分发 skill 并强制刷新 AGENTS.md。
|
|
75
75
|
|
|
76
76
|
提示:matt-skills --help 查看全量
|
|
77
77
|
`;
|
|
@@ -187,6 +187,34 @@ function shouldCopyTemplatePath(src) {
|
|
|
187
187
|
return !(parts[0] === '.agents' && parts[1] === 'skills');
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
const AGENTS_MANAGED_START = '<!-- matt-skills:managed:start -->';
|
|
191
|
+
const AGENTS_MANAGED_END = '<!-- matt-skills:managed:end -->';
|
|
192
|
+
|
|
193
|
+
function findManagedBlock(content) {
|
|
194
|
+
const start = content.indexOf(AGENTS_MANAGED_START);
|
|
195
|
+
if (start < 0 || content.indexOf(AGENTS_MANAGED_START, start + AGENTS_MANAGED_START.length) >= 0) return null;
|
|
196
|
+
const endStart = content.indexOf(AGENTS_MANAGED_END, start + AGENTS_MANAGED_START.length);
|
|
197
|
+
if (endStart < 0 || content.indexOf(AGENTS_MANAGED_END, endStart + AGENTS_MANAGED_END.length) >= 0) return null;
|
|
198
|
+
return { start, end: endStart + AGENTS_MANAGED_END.length };
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function mergeManagedAgents(current, template) {
|
|
202
|
+
const currentBlock = findManagedBlock(current);
|
|
203
|
+
const templateBlock = findManagedBlock(template);
|
|
204
|
+
if (!currentBlock || !templateBlock) return null;
|
|
205
|
+
const managed = template.slice(templateBlock.start, templateBlock.end);
|
|
206
|
+
return current.slice(0, currentBlock.start) + managed + current.slice(currentBlock.end);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async function syncManagedAgents(targetFile) {
|
|
210
|
+
const current = await readFile(targetFile, 'utf8');
|
|
211
|
+
const template = await readFile(path.join(TEMPLATE_DIR, 'AGENTS.md'), 'utf8');
|
|
212
|
+
const merged = mergeManagedAgents(current, template);
|
|
213
|
+
if (merged === null) return false;
|
|
214
|
+
if (merged !== current) await writeFile(targetFile, merged);
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
|
|
190
218
|
const TOOLS = ['codex', 'pi', 'opencode', 'claude'];
|
|
191
219
|
|
|
192
220
|
// 统一源:共享技能全部在 .agents/skills,harness 的 .pi/skills/.opencode/skills 仅用于项目自定义
|
|
@@ -382,26 +410,25 @@ async function syncCommand({ dest, all, dryRun, json, upstreamUrl, ref }) {
|
|
|
382
410
|
process.stdout.write('模板:已复制(AGENTS.md、.opencode/、.pi/)\n');
|
|
383
411
|
} else {
|
|
384
412
|
process.stdout.write('同步:检测到现有项目,将增量更新\n');
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
if (!all) {
|
|
388
|
-
try {
|
|
389
|
-
const content = await readFile(path.join(target, 'AGENTS.md'), 'utf8');
|
|
390
|
-
if (content.includes('tdd-implement')) skipAgents = true;
|
|
391
|
-
} catch {}
|
|
392
|
-
}
|
|
393
|
-
if (skipAgents) {
|
|
394
|
-
await cp(path.join(TEMPLATE_DIR, '.opencode'), path.join(target, '.opencode'), { recursive: true, force: true });
|
|
395
|
-
await cp(path.join(TEMPLATE_DIR, '.pi'), path.join(target, '.pi'), { recursive: true, force: true });
|
|
396
|
-
process.stdout.write('模板:已同步(AGENTS.md 跳过,已含定制)\n');
|
|
397
|
-
} else {
|
|
398
|
-
if (onlyProgramming) await copyTemplateFiltered();
|
|
399
|
-
else await cp(TEMPLATE_DIR, target, {
|
|
413
|
+
if (all) {
|
|
414
|
+
await cp(TEMPLATE_DIR, target, {
|
|
400
415
|
recursive: true,
|
|
401
416
|
force: true,
|
|
402
417
|
filter: shouldCopyTemplatePath,
|
|
403
418
|
});
|
|
404
|
-
process.stdout.write('模板:已同步(AGENTS.md
|
|
419
|
+
process.stdout.write('模板:已同步(AGENTS.md 整体刷新、.opencode/、.pi/)\n');
|
|
420
|
+
} else {
|
|
421
|
+
let agentsManaged = false;
|
|
422
|
+
try {
|
|
423
|
+
agentsManaged = await syncManagedAgents(marker);
|
|
424
|
+
} catch {}
|
|
425
|
+
await cp(path.join(TEMPLATE_DIR, '.opencode'), path.join(target, '.opencode'), { recursive: true, force: true });
|
|
426
|
+
await cp(path.join(TEMPLATE_DIR, '.pi'), path.join(target, '.pi'), { recursive: true, force: true });
|
|
427
|
+
if (agentsManaged) {
|
|
428
|
+
process.stdout.write('模板:已同步(AGENTS.md 受管区块已更新,项目自定义内容已保留)\n');
|
|
429
|
+
} else {
|
|
430
|
+
process.stdout.write('模板:已同步(AGENTS.md 未受管,已原样保留)\n');
|
|
431
|
+
}
|
|
405
432
|
}
|
|
406
433
|
}
|
|
407
434
|
// 技能同步:--all 仅更新同名可分发技能内容,存在则覆盖,不存在则新增,并更新 AGENTS.md(由上一步已处理);默认范围为默认 programming,不删多余
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# matt-skills
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Repository vocabulary for this project. This file defines domain terms only; execution policy belongs to the active `AGENTS.md`, and skill-specific behavior belongs to each live `SKILL.md` and its references.
|
|
4
4
|
|
|
5
5
|
## Repository
|
|
6
6
|
|
|
@@ -9,47 +9,29 @@ This repository's identity. It is the config repo for mattpocock/skills: it dist
|
|
|
9
9
|
_Avoid_: skill distribution repo
|
|
10
10
|
|
|
11
11
|
**Upstream Repository** (上游仓库):
|
|
12
|
-
mattpocock/skills — the source of the
|
|
12
|
+
mattpocock/skills — the source of the upstream Skill bodies mirrored into this repo's Workspace canonical Skill source and then distributed by the CLI. This repo syncs them via `scripts/sync-upstream.js` and `matt-skills sync`.
|
|
13
13
|
_Avoid_: source repo, skill origin
|
|
14
14
|
|
|
15
15
|
**Proprietary Skill** (独有技能):
|
|
16
|
-
A skill that does not exist upstream and lives only in this repo
|
|
16
|
+
A skill that does not exist upstream and lives only in this repo. The current proprietary set is classified in `config/proprietary.json` as distributable or repo-local; that config is the source of truth for membership. Repo-local skills serve matt-skills maintenance and are never distributed. Before adding a new proprietary skill, check the Upstream Repository first.
|
|
17
17
|
_Avoid_: private skill, local skill
|
|
18
18
|
|
|
19
19
|
**Workspace** (工作区):
|
|
20
|
-
The root-level working
|
|
20
|
+
The root-level canonical working area: `.agents/skills/` for shared Skills, `.opencode/` and `.pi/` for harness configuration, plus repository docs and configuration. Shared Skills are authored here. Harness-specific `.pi/skills/` and `.opencode/skills/` are reserved for project-local custom Skills rather than shared mirrors.
|
|
21
21
|
_Avoid_: working copy, source repo
|
|
22
22
|
|
|
23
23
|
**Template Snapshot** (模板快照):
|
|
24
|
-
Everything under `template/`
|
|
24
|
+
Everything under `template/` that is generated or copied from Workspace sources for Target Repository initialization. The snapshot owns project skeleton/configuration, while shared Skills are assembled separately by the CLI from the Workspace canonical source. Skeleton sync is one-way: Workspace → Template Snapshot.
|
|
25
25
|
_Avoid_: release snapshot, published snapshot
|
|
26
26
|
|
|
27
27
|
**Target Repository** (目标仓库):
|
|
28
|
-
A repository initialized
|
|
28
|
+
A repository initialized from the Template Snapshot and selected distributable shared Skills. Its root `AGENTS.md` is the project-level execution policy. Shared Skills live in `.agents/skills/`; project-local custom Skills may live in harness-specific skill directories.
|
|
29
29
|
_Avoid_: inheriting repo, child repo
|
|
30
30
|
|
|
31
31
|
**Initialize** (初始化):
|
|
32
|
-
The one-time action of setting up a Target Repository
|
|
32
|
+
The one-time action of setting up a Target Repository by copying the Template Snapshot skeleton and installing the selected distributable Skills. Repo-local Skills are intentionally excluded.
|
|
33
33
|
_Avoid_: inherit, bootstrap
|
|
34
34
|
|
|
35
35
|
**Sync** (同步):
|
|
36
|
-
`matt-skills sync`
|
|
36
|
+
`matt-skills sync` updates Target Repository skeleton/configuration and selected distributable Skills according to CLI policy. Default sync preserves project customization where the CLI can identify it; `--all` applies the broader distributable scope. Repo-local Skills are never newly distributed by sync.
|
|
37
37
|
_Avoid_: update, force sync
|
|
38
|
-
|
|
39
|
-
## Skill Design
|
|
40
|
-
|
|
41
|
-
**Turn Continuity** (回合连续性):
|
|
42
|
-
The rule that a long-horizon skill must carry a positive instruction to keep executing within a turn — red → green → typecheck → next seam serial in one turn until the stage's exit condition is met. The stage exit is reached when all of its seams are complete — one seam going green is not an exit, and progress output does not itself end the turn. It is the skill's own guard against premature turn-end; it must not rely on the harness `/goal` line (which does not exist when no `/goal` is active).
|
|
43
|
-
_Avoid_: keep going, don't stop
|
|
44
|
-
|
|
45
|
-
**Chunking** (拆小步 / 进度编排):
|
|
46
|
-
Splitting a giant turn — one large `write` or a batch of `replace`s — into small steps that are individually verified before continuing, so the turn never hits output caps and gets truncated mid-work.
|
|
47
|
-
_Avoid_: step-by-step, take it slow
|
|
48
|
-
|
|
49
|
-
**Git History Preservation** (Git 历史保护):
|
|
50
|
-
Every git-touching skill must preserve history after `BASE_HEAD=$(git rev-parse HEAD)` recorded at stage entry — history may only be appended. Before any commit or stage exit, verify `git merge-base --is-ancestor $BASE_HEAD HEAD`; if it fails, history was rewritten and must be recovered via `git reflog` before continuing. "Directory clean" (`git status` clean) may only be achieved by deleting the skill's own temporary artifacts (`[DEBUG-...]`, one-off scripts, untracked probe files); destructive git commands `git reset --hard`, `git checkout .`, `git clean -fd`, `git stash push --include-untracked`, `git push --force`, `git rebase -i` are forbidden without explicit user confirmation.
|
|
51
|
-
_Avoid_: force clean, stash all
|
|
52
|
-
|
|
53
|
-
**Long-Horizon Skill** (长程多阶段技能):
|
|
54
|
-
A skill whose run spans multiple stages or seams executed continuously (e.g. tdd-implement, diagnosing-bugs, improve-codebase-architecture, wayfinder, grill-to-spec, to-spec). The class of skill that must carry a Turn Continuity rule.
|
|
55
|
-
_Avoid_: complex skill, big skill
|
|
@@ -1,37 +1,26 @@
|
|
|
1
1
|
# Runtime Discipline
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This file contains only general execution discipline. It does not override the active project `AGENTS.md` or any skill-specific lifecycle.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Ownership
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- authorization, validation scope, review scope and Git policy come from the active `AGENTS.md` and explicit user instructions;
|
|
8
|
+
- a skill owns only its own lifecycle, state transitions and exit conditions;
|
|
9
|
+
- TDD semantics belong to `.agents/skills/tdd/SKILL.md`;
|
|
10
|
+
- full code-review semantics belong to `.agents/skills/code-review/SKILL.md`.
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
- 合规交互点:技能/流程要求的用户确认(如 tdd-implement 的 seams 清单确认)
|
|
11
|
-
- 外部阻塞:权限拒绝、缺失授权、依赖不可用——明确说明所需授权或替代路径,不静默停止
|
|
12
|
-
- 阶段完成:整个阶段的出口条件满足(如 seam 全绿、typecheck 通过、commit 完成)
|
|
12
|
+
When rules disagree, do not invent a merged policy: follow the higher-scope project/user rule for repository policy and the owning skill for its internal protocol.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
## Execution
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
- Continue the active workflow until its stated exit condition, a required user decision, or an external blocker.
|
|
17
|
+
- Progress output does not reset lifecycle state or authorize restarting completed stages.
|
|
18
|
+
- Reuse still-valid evidence; do not repeat equivalent validation or review merely for reassurance.
|
|
19
|
+
- Do not invent build, test, typecheck, commit, or review requirements that are absent from the owning policy.
|
|
20
|
+
- Keep changes local to the requested scope and reuse existing abstractions and dependency direction.
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
## Documentation Maintenance
|
|
19
23
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
- **Git 历史保护(Git History Preservation)**:任何触及 git 的操作必须追加历史、不可改写丢弃。阶段入口记录 `BASE_HEAD=$(git rev-parse HEAD)`,阶段出口与 commit 前校验 `git merge-base --is-ancestor $BASE_HEAD HEAD`,失败即经 `git reflog` 恢复后才继续。"目录卫生"仅删本次产生的 `[DEBUG-...]`/一次性脚本等未跟踪临时文件,禁止为达干净而执行 `git reset --hard`、`git checkout .`、`git clean -fd`、`git stash push --include-untracked`、`git push --force`、`git rebase -i` 等(需显式用户确认)。
|
|
24
|
-
|
|
25
|
-
## 执行原则(细则)
|
|
26
|
-
|
|
27
|
-
- 先澄清边界再实现;任务收敛后直接执行,不做不必要的形式化流程
|
|
28
|
-
- 局部修改、最小充分实现,避免无关扩张
|
|
29
|
-
- 用户当次明确指令优先于历史经验与参考项目
|
|
30
|
-
- 脏工作区不回滚他人改动;遇到未明改动先理解再兼容
|
|
31
|
-
|
|
32
|
-
## 文档维护(细则)
|
|
33
|
-
|
|
34
|
-
- 本文件与分文件只记录长期有效、跨任务可复用的工程经验与项目级约定
|
|
35
|
-
- 一次性需求、临时接口选择、用户当次指定方案不沉淀;更换接口/方案视为需求变更,不判定"旧错新对"
|
|
36
|
-
- 仅当问题重复出现、暴露长期约束、影响后续多次开发、用户明确要求沉淀,或涉及安全/构建/测试/发布/架构边界时更新
|
|
37
|
-
- 经验条目包含:标题、触发信号、根因/约束、正确做法、验证方式、适用范围
|
|
24
|
+
- Keep only durable, cross-task rules here.
|
|
25
|
+
- One-off decisions and temporary implementation choices do not become runtime policy.
|
|
26
|
+
- When a repeated failure reveals a missing invariant, prefer enforcing it in the owning skill, test, tool, type, or repository policy rather than duplicating prose across layers.
|
|
@@ -1,37 +1,15 @@
|
|
|
1
|
-
# Skill Design
|
|
1
|
+
# Skill Design — Deprecated
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This file is retained temporarily for compatibility. It is **not** a normative rule source.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
## Rule 1 — Turn Continuity
|
|
5
|
+
Current ownership is:
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
- repository or project execution policy → the active `AGENTS.md`;
|
|
8
|
+
- repository vocabulary and distribution concepts → `CONTEXT.md`;
|
|
9
|
+
- skill-specific lifecycle and state → that skill's `SKILL.md` and live references;
|
|
10
|
+
- TDD semantics → `.agents/skills/tdd/SKILL.md`;
|
|
11
|
+
- full code-review semantics → `.agents/skills/code-review/SKILL.md`.
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
- It must be **self-contained** — the skill cannot rely on the harness `/goal` line, because no `/goal` exists when the user does not activate one.
|
|
12
|
-
- Every stage ends on a checkable exit condition; reaching it is the only thing that ends the turn.
|
|
13
|
-
- A sub-step going green (e.g. one seam) is not a stage exit — a stage ends only when all of its seams are complete. Progress output does not itself end the turn: output, then keep executing until one of the three endpoints (compliance checkpoint, external blocker, stage exit) is reached.
|
|
14
|
-
- Canonical example: the 回合连续性 rule in [`.agents/skills/tdd-implement/references/stages.md`](.agents/skills/tdd-implement/references/stages.md), especially the Red-Green continuity section.
|
|
13
|
+
Do not add Git policy, build/test policy, review lifecycle, model-selection rules, or cross-skill orchestration here. New or changed behavior must be owned by the layer that executes it.
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Flash-class models are markedly more likely to stop prematurely on long-horizon agentic work. For critical long tasks, prefer a stronger model or `/goal` mode. This is a runtime choice, not something a skill text can enforce — record it here so skill authors and session runners share the same guidance.
|
|
19
|
-
|
|
20
|
-
## Rule 3 — Progress Chunking
|
|
21
|
-
|
|
22
|
-
Giant turns — a single `write` of a large file, or a batch `replace` of a hundred-plus lines — hit output caps and get truncated mid-work. Chunk the work into small, individually verifiable steps:
|
|
23
|
-
|
|
24
|
-
- A single `write` over ~150 lines: write the skeleton first, then fill in batches.
|
|
25
|
-
- A batch of more than ~5 `replace`s: split into batches and verify after each batch.
|
|
26
|
-
|
|
27
|
-
These thresholds are experience defaults; adjust them as practice shows better values.
|
|
28
|
-
## Rule 4 — Git History Preservation
|
|
29
|
-
|
|
30
|
-
Every skill that touches git must preserve history after `BASE_HEAD`: history may only be appended, never rewritten or dropped. The skill must record `BASE_HEAD=$(git rev-parse HEAD)` at stage entry, and verify `git merge-base --is-ancestor $BASE_HEAD HEAD` at every stage exit and before any commit — failure means history was rewritten and the skill must recover via `git reflog` before continuing.
|
|
31
|
-
|
|
32
|
-
To achieve "directory clean" (`git status` clean) the skill may only delete its own temporary artifacts (`[DEBUG-...]`, one-off scripts, untracked probe files) — it must never use git-level destructive commands to reach a clean state. The following are forbidden without explicit user confirmation: `git reset --hard`, `git checkout .`, `git clean -fd`, `git stash push --include-untracked` (use `--keep-index` instead and `pop` with verification), `git push --force`, `git rebase -i` and any `reset`/`checkout` that moves `HEAD` backward.
|
|
33
|
-
|
|
34
|
-
Canonical enforcement: [`tdd-implement/references/stages.md`](.agents/skills/tdd-implement/references/stages.md) checks `BASE_HEAD` at every delivery-stage exit and before the Finalize commit; multi-issue enforcement lives in [`tdd-implement/references/orchestration.md`](.agents/skills/tdd-implement/references/orchestration.md) A2-A4. Repository-local commit gating remains a workspace-only concern and is not part of the distributable template.
|
|
35
|
-
## Long-horizon skills inventory
|
|
36
|
-
|
|
37
|
-
Skills currently classified as Long-Horizon, to be evolved against these rules as they are touched: `tdd-implement` (fixed), `diagnose-fix` (fixed — orchestration for diagnosis + TDD fix), `diagnosing-bugs`, `improve-codebase-architecture`, `wayfinder`, `grill-to-spec` (fixed — carries its own Turn Continuity rule), `to-spec`. Backfilling existing skill texts is out of scope for now — these rules bind new and edited skills going forward.
|
|
15
|
+
This compatibility file can be removed once no maintained consumer depends on its path.
|
package/template/.pi/CONTEXT.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# matt-skills
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Repository vocabulary for this project. This file defines domain terms only; execution policy belongs to the active `AGENTS.md`, and skill-specific behavior belongs to each live `SKILL.md` and its references.
|
|
4
4
|
|
|
5
5
|
## Repository
|
|
6
6
|
|
|
@@ -9,47 +9,29 @@ This repository's identity. It is the config repo for mattpocock/skills: it dist
|
|
|
9
9
|
_Avoid_: skill distribution repo
|
|
10
10
|
|
|
11
11
|
**Upstream Repository** (上游仓库):
|
|
12
|
-
mattpocock/skills — the source of the
|
|
12
|
+
mattpocock/skills — the source of the upstream Skill bodies mirrored into this repo's Workspace canonical Skill source and then distributed by the CLI. This repo syncs them via `scripts/sync-upstream.js` and `matt-skills sync`.
|
|
13
13
|
_Avoid_: source repo, skill origin
|
|
14
14
|
|
|
15
15
|
**Proprietary Skill** (独有技能):
|
|
16
|
-
A skill that does not exist upstream and lives only in this repo
|
|
16
|
+
A skill that does not exist upstream and lives only in this repo. The current proprietary set is classified in `config/proprietary.json` as distributable or repo-local; that config is the source of truth for membership. Repo-local skills serve matt-skills maintenance and are never distributed. Before adding a new proprietary skill, check the Upstream Repository first.
|
|
17
17
|
_Avoid_: private skill, local skill
|
|
18
18
|
|
|
19
19
|
**Workspace** (工作区):
|
|
20
|
-
The root-level working
|
|
20
|
+
The root-level canonical working area: `.agents/skills/` for shared Skills, `.opencode/` and `.pi/` for harness configuration, plus repository docs and configuration. Shared Skills are authored here. Harness-specific `.pi/skills/` and `.opencode/skills/` are reserved for project-local custom Skills rather than shared mirrors.
|
|
21
21
|
_Avoid_: working copy, source repo
|
|
22
22
|
|
|
23
23
|
**Template Snapshot** (模板快照):
|
|
24
|
-
Everything under `template/`
|
|
24
|
+
Everything under `template/` that is generated or copied from Workspace sources for Target Repository initialization. The snapshot owns project skeleton/configuration, while shared Skills are assembled separately by the CLI from the Workspace canonical source. Skeleton sync is one-way: Workspace → Template Snapshot.
|
|
25
25
|
_Avoid_: release snapshot, published snapshot
|
|
26
26
|
|
|
27
27
|
**Target Repository** (目标仓库):
|
|
28
|
-
A repository initialized
|
|
28
|
+
A repository initialized from the Template Snapshot and selected distributable shared Skills. Its root `AGENTS.md` is the project-level execution policy. Shared Skills live in `.agents/skills/`; project-local custom Skills may live in harness-specific skill directories.
|
|
29
29
|
_Avoid_: inheriting repo, child repo
|
|
30
30
|
|
|
31
31
|
**Initialize** (初始化):
|
|
32
|
-
The one-time action of setting up a Target Repository
|
|
32
|
+
The one-time action of setting up a Target Repository by copying the Template Snapshot skeleton and installing the selected distributable Skills. Repo-local Skills are intentionally excluded.
|
|
33
33
|
_Avoid_: inherit, bootstrap
|
|
34
34
|
|
|
35
35
|
**Sync** (同步):
|
|
36
|
-
`matt-skills sync`
|
|
36
|
+
`matt-skills sync` updates Target Repository skeleton/configuration and selected distributable Skills according to CLI policy. Default sync preserves project customization where the CLI can identify it; `--all` applies the broader distributable scope. Repo-local Skills are never newly distributed by sync.
|
|
37
37
|
_Avoid_: update, force sync
|
|
38
|
-
|
|
39
|
-
## Skill Design
|
|
40
|
-
|
|
41
|
-
**Turn Continuity** (回合连续性):
|
|
42
|
-
The rule that a long-horizon skill must carry a positive instruction to keep executing within a turn — red → green → typecheck → next seam serial in one turn until the stage's exit condition is met. The stage exit is reached when all of its seams are complete — one seam going green is not an exit, and progress output does not itself end the turn. It is the skill's own guard against premature turn-end; it must not rely on the harness `/goal` line (which does not exist when no `/goal` is active).
|
|
43
|
-
_Avoid_: keep going, don't stop
|
|
44
|
-
|
|
45
|
-
**Chunking** (拆小步 / 进度编排):
|
|
46
|
-
Splitting a giant turn — one large `write` or a batch of `replace`s — into small steps that are individually verified before continuing, so the turn never hits output caps and gets truncated mid-work.
|
|
47
|
-
_Avoid_: step-by-step, take it slow
|
|
48
|
-
|
|
49
|
-
**Git History Preservation** (Git 历史保护):
|
|
50
|
-
Every git-touching skill must preserve history after `BASE_HEAD=$(git rev-parse HEAD)` recorded at stage entry — history may only be appended. Before any commit or stage exit, verify `git merge-base --is-ancestor $BASE_HEAD HEAD`; if it fails, history was rewritten and must be recovered via `git reflog` before continuing. "Directory clean" (`git status` clean) may only be achieved by deleting the skill's own temporary artifacts (`[DEBUG-...]`, one-off scripts, untracked probe files); destructive git commands `git reset --hard`, `git checkout .`, `git clean -fd`, `git stash push --include-untracked`, `git push --force`, `git rebase -i` are forbidden without explicit user confirmation.
|
|
51
|
-
_Avoid_: force clean, stash all
|
|
52
|
-
|
|
53
|
-
**Long-Horizon Skill** (长程多阶段技能):
|
|
54
|
-
A skill whose run spans multiple stages or seams executed continuously (e.g. tdd-implement, diagnosing-bugs, improve-codebase-architecture, wayfinder, grill-to-spec, to-spec). The class of skill that must carry a Turn Continuity rule.
|
|
55
|
-
_Avoid_: complex skill, big skill
|
|
@@ -1,37 +1,26 @@
|
|
|
1
1
|
# Runtime Discipline
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This file contains only general execution discipline. It does not override the active project `AGENTS.md` or any skill-specific lifecycle.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Ownership
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- authorization, validation scope, review scope and Git policy come from the active `AGENTS.md` and explicit user instructions;
|
|
8
|
+
- a skill owns only its own lifecycle, state transitions and exit conditions;
|
|
9
|
+
- TDD semantics belong to `.agents/skills/tdd/SKILL.md`;
|
|
10
|
+
- full code-review semantics belong to `.agents/skills/code-review/SKILL.md`.
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
- 合规交互点:技能/流程要求的用户确认(如 tdd-implement 的 seams 清单确认)
|
|
11
|
-
- 外部阻塞:权限拒绝、缺失授权、依赖不可用——明确说明所需授权或替代路径,不静默停止
|
|
12
|
-
- 阶段完成:整个阶段的出口条件满足(如 seam 全绿、typecheck 通过、commit 完成)
|
|
12
|
+
When rules disagree, do not invent a merged policy: follow the higher-scope project/user rule for repository policy and the owning skill for its internal protocol.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
## Execution
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
- Continue the active workflow until its stated exit condition, a required user decision, or an external blocker.
|
|
17
|
+
- Progress output does not reset lifecycle state or authorize restarting completed stages.
|
|
18
|
+
- Reuse still-valid evidence; do not repeat equivalent validation or review merely for reassurance.
|
|
19
|
+
- Do not invent build, test, typecheck, commit, or review requirements that are absent from the owning policy.
|
|
20
|
+
- Keep changes local to the requested scope and reuse existing abstractions and dependency direction.
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
## Documentation Maintenance
|
|
19
23
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
- **Git 历史保护(Git History Preservation)**:任何触及 git 的操作必须追加历史、不可改写丢弃。阶段入口记录 `BASE_HEAD=$(git rev-parse HEAD)`,阶段出口与 commit 前校验 `git merge-base --is-ancestor $BASE_HEAD HEAD`,失败即经 `git reflog` 恢复后才继续。"目录卫生"仅删本次产生的 `[DEBUG-...]`/一次性脚本等未跟踪临时文件,禁止为达干净而执行 `git reset --hard`、`git checkout .`、`git clean -fd`、`git stash push --include-untracked`、`git push --force`、`git rebase -i` 等(需显式用户确认)。
|
|
24
|
-
|
|
25
|
-
## 执行原则(细则)
|
|
26
|
-
|
|
27
|
-
- 先澄清边界再实现;任务收敛后直接执行,不做不必要的形式化流程
|
|
28
|
-
- 局部修改、最小充分实现,避免无关扩张
|
|
29
|
-
- 用户当次明确指令优先于历史经验与参考项目
|
|
30
|
-
- 脏工作区不回滚他人改动;遇到未明改动先理解再兼容
|
|
31
|
-
|
|
32
|
-
## 文档维护(细则)
|
|
33
|
-
|
|
34
|
-
- 本文件与分文件只记录长期有效、跨任务可复用的工程经验与项目级约定
|
|
35
|
-
- 一次性需求、临时接口选择、用户当次指定方案不沉淀;更换接口/方案视为需求变更,不判定"旧错新对"
|
|
36
|
-
- 仅当问题重复出现、暴露长期约束、影响后续多次开发、用户明确要求沉淀,或涉及安全/构建/测试/发布/架构边界时更新
|
|
37
|
-
- 经验条目包含:标题、触发信号、根因/约束、正确做法、验证方式、适用范围
|
|
24
|
+
- Keep only durable, cross-task rules here.
|
|
25
|
+
- One-off decisions and temporary implementation choices do not become runtime policy.
|
|
26
|
+
- When a repeated failure reveals a missing invariant, prefer enforcing it in the owning skill, test, tool, type, or repository policy rather than duplicating prose across layers.
|
|
@@ -1,37 +1,15 @@
|
|
|
1
|
-
# Skill Design
|
|
1
|
+
# Skill Design — Deprecated
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This file is retained temporarily for compatibility. It is **not** a normative rule source.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
## Rule 1 — Turn Continuity
|
|
5
|
+
Current ownership is:
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
- repository or project execution policy → the active `AGENTS.md`;
|
|
8
|
+
- repository vocabulary and distribution concepts → `CONTEXT.md`;
|
|
9
|
+
- skill-specific lifecycle and state → that skill's `SKILL.md` and live references;
|
|
10
|
+
- TDD semantics → `.agents/skills/tdd/SKILL.md`;
|
|
11
|
+
- full code-review semantics → `.agents/skills/code-review/SKILL.md`.
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
- It must be **self-contained** — the skill cannot rely on the harness `/goal` line, because no `/goal` exists when the user does not activate one.
|
|
12
|
-
- Every stage ends on a checkable exit condition; reaching it is the only thing that ends the turn.
|
|
13
|
-
- A sub-step going green (e.g. one seam) is not a stage exit — a stage ends only when all of its seams are complete. Progress output does not itself end the turn: output, then keep executing until one of the three endpoints (compliance checkpoint, external blocker, stage exit) is reached.
|
|
14
|
-
- Canonical example: the 回合连续性 rule in [`.agents/skills/tdd-implement/references/stages.md`](.agents/skills/tdd-implement/references/stages.md), especially the Red-Green continuity section.
|
|
13
|
+
Do not add Git policy, build/test policy, review lifecycle, model-selection rules, or cross-skill orchestration here. New or changed behavior must be owned by the layer that executes it.
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Flash-class models are markedly more likely to stop prematurely on long-horizon agentic work. For critical long tasks, prefer a stronger model or `/goal` mode. This is a runtime choice, not something a skill text can enforce — record it here so skill authors and session runners share the same guidance.
|
|
19
|
-
|
|
20
|
-
## Rule 3 — Progress Chunking
|
|
21
|
-
|
|
22
|
-
Giant turns — a single `write` of a large file, or a batch `replace` of a hundred-plus lines — hit output caps and get truncated mid-work. Chunk the work into small, individually verifiable steps:
|
|
23
|
-
|
|
24
|
-
- A single `write` over ~150 lines: write the skeleton first, then fill in batches.
|
|
25
|
-
- A batch of more than ~5 `replace`s: split into batches and verify after each batch.
|
|
26
|
-
|
|
27
|
-
These thresholds are experience defaults; adjust them as practice shows better values.
|
|
28
|
-
## Rule 4 — Git History Preservation
|
|
29
|
-
|
|
30
|
-
Every skill that touches git must preserve history after `BASE_HEAD`: history may only be appended, never rewritten or dropped. The skill must record `BASE_HEAD=$(git rev-parse HEAD)` at stage entry, and verify `git merge-base --is-ancestor $BASE_HEAD HEAD` at every stage exit and before any commit — failure means history was rewritten and the skill must recover via `git reflog` before continuing.
|
|
31
|
-
|
|
32
|
-
To achieve "directory clean" (`git status` clean) the skill may only delete its own temporary artifacts (`[DEBUG-...]`, one-off scripts, untracked probe files) — it must never use git-level destructive commands to reach a clean state. The following are forbidden without explicit user confirmation: `git reset --hard`, `git checkout .`, `git clean -fd`, `git stash push --include-untracked` (use `--keep-index` instead and `pop` with verification), `git push --force`, `git rebase -i` and any `reset`/`checkout` that moves `HEAD` backward.
|
|
33
|
-
|
|
34
|
-
Canonical enforcement: [`tdd-implement/references/stages.md`](.agents/skills/tdd-implement/references/stages.md) checks `BASE_HEAD` at every delivery-stage exit and before the Finalize commit; multi-issue enforcement lives in [`tdd-implement/references/orchestration.md`](.agents/skills/tdd-implement/references/orchestration.md) A2-A4. Repository-local commit gating remains a workspace-only concern and is not part of the distributable template.
|
|
35
|
-
## Long-horizon skills inventory
|
|
36
|
-
|
|
37
|
-
Skills currently classified as Long-Horizon, to be evolved against these rules as they are touched: `tdd-implement` (fixed), `diagnose-fix` (fixed — orchestration for diagnosis + TDD fix), `diagnosing-bugs`, `improve-codebase-architecture`, `wayfinder`, `grill-to-spec` (fixed — carries its own Turn Continuity rule), `to-spec`. Backfilling existing skill texts is out of scope for now — these rules bind new and edited skills going forward.
|
|
15
|
+
This compatibility file can be removed once no maintained consumer depends on its path.
|
package/template/AGENTS.md
CHANGED