jhste-skills 0.1.1 → 0.1.2
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 +0 -1
- package/README.ko.md +0 -1
- package/README.md +3 -4
- package/README.zh.md +0 -1
- package/cli/install-actions/skills.mjs +48 -6
- package/cli/sync-core.mjs +9 -1
- package/docs/ACCEPTANCE_CHECK.md +2 -0
- package/docs/CONFLICT_RESOLUTION.md +2 -0
- package/package.json +1 -1
- package/scripts/smoke/connect-scenarios.mjs +2 -2
- package/scripts/smoke/install-scenarios.mjs +33 -5
- package/scripts/smoke/mode-scenarios.mjs +1 -1
- package/scripts/vendor-check.mjs +2 -3
- package/vendor/matt-pocock/allowlist.json +0 -1
- package/vendor/matt-pocock/source-lock.json +0 -8
- package/skills/diagnose/SKILL.md +0 -125
- package/skills/diagnose/scripts/hitl-loop.template.sh +0 -41
package/README.ja.md
CHANGED
|
@@ -158,7 +158,6 @@ Normal install では、Matt Pocock の [`mattpocock/skills`](https://github.com
|
|
|
158
158
|
|
|
159
159
|
| Skill | いつ使うか |
|
|
160
160
|
|---|---|
|
|
161
|
-
| [`diagnose`](skills/diagnose/SKILL.md)<br>reproduce、minimize、hypothesize、instrument、fix、regression-check を強制する診断ループ skill | hard bug や performance regression を体系的に診断するとき |
|
|
162
161
|
| [`diagnosing-bugs`](skills/diagnosing-bugs/SKILL.md)<br>高速な pass/fail feedback loop を中心に root cause を絞り込む debugging skill | reproduce → minimise → hypothesise → instrument → fix ループが必要なとき |
|
|
163
162
|
| [`grill-me`](skills/grill-me/SKILL.md)<br>計画や設計の穴がなくなるまで粘り強く質問する skill | agent に計画や設計を明確になるまで質問させたいとき |
|
|
164
163
|
| [`grill-with-docs`](skills/grill-with-docs/SKILL.md)<br>質問しながら domain terms と decisions を文書化する design validation skill | 質問プロセスで project vocabulary や docs/ADR も更新したいとき |
|
package/README.ko.md
CHANGED
|
@@ -158,7 +158,6 @@ Normal install은 Matt Pocock의 [`mattpocock/skills`](https://github.com/mattpo
|
|
|
158
158
|
|
|
159
159
|
| Skill | 언제 쓰나 |
|
|
160
160
|
|---|---|
|
|
161
|
-
| [`diagnose`](skills/diagnose/SKILL.md)<br>재현, 축소, 가설, 계측, 수정, 회귀 확인을 강제하는 진단 루프 스킬 | hard bug 또는 performance regression을 체계적으로 진단할 때 |
|
|
162
161
|
| [`diagnosing-bugs`](skills/diagnosing-bugs/SKILL.md)<br>빠른 pass/fail feedback loop를 중심으로 원인을 좁혀가는 debugging 스킬 | reproduce → minimise → hypothesise → instrument → fix 루프가 필요할 때 |
|
|
163
162
|
| [`grill-me`](skills/grill-me/SKILL.md)<br>계획이나 설계의 빈틈이 사라질 때까지 집요하게 질문하는 스킬 | agent가 계획이나 설계를 명확해질 때까지 질문하게 하고 싶을 때 |
|
|
164
163
|
| [`grill-with-docs`](skills/grill-with-docs/SKILL.md)<br>질문 과정에서 도메인 용어와 의사결정을 문서화하는 설계 검증 스킬 | 질문 과정에서 project vocabulary와 docs/ADR까지 함께 정리하고 싶을 때 |
|
package/README.md
CHANGED
|
@@ -154,11 +154,10 @@ These are the jhste-authored guardrail skills. They are installed by default as
|
|
|
154
154
|
|
|
155
155
|
## Bundled workflow skills
|
|
156
156
|
|
|
157
|
-
Normal install also includes
|
|
157
|
+
Normal install also includes 13 workflow skills vendored from Matt Pocock's [`mattpocock/skills`](https://github.com/mattpocock/skills). These are useful for debugging, planning, architecture, issue workflows, prototyping, and handoffs. Use `--skill-set core` if you do not want them installed.
|
|
158
158
|
|
|
159
159
|
| Skill | Use it when |
|
|
160
160
|
|---|---|
|
|
161
|
-
| [`diagnose`](skills/diagnose/SKILL.md)<br>A diagnosis-loop skill that forces reproduce, minimize, hypothesize, instrument, fix, and regression-check steps | Diagnosing a hard bug or performance regression systematically |
|
|
162
161
|
| [`diagnosing-bugs`](skills/diagnosing-bugs/SKILL.md)<br>A debugging skill that narrows root cause around a fast pass/fail feedback loop | You need a reproduce → minimise → hypothesise → instrument → fix loop |
|
|
163
162
|
| [`grill-me`](skills/grill-me/SKILL.md)<br>A skill that asks persistent questions until a plan or design has no obvious gaps | You want the agent to question your plan or design until it becomes clear |
|
|
164
163
|
| [`grill-with-docs`](skills/grill-with-docs/SKILL.md)<br>A design-challenge skill that documents domain terms and decisions while questioning the plan | You want project vocabulary and docs/ADRs updated during the questioning process |
|
|
@@ -175,7 +174,7 @@ Normal install also includes 14 workflow skills vendored from Matt Pocock's [`ma
|
|
|
175
174
|
|
|
176
175
|
## Attribution: Matt Pocock skills
|
|
177
176
|
|
|
178
|
-
This repository vendors the
|
|
177
|
+
This repository vendors the 13 skills listed above from Matt Pocock's [`mattpocock/skills`](https://github.com/mattpocock/skills).
|
|
179
178
|
|
|
180
179
|
Those skills are vendored under the upstream MIT License. This repository preserves the required copyright/license notice and records the imported sources.
|
|
181
180
|
|
|
@@ -253,4 +252,4 @@ See [`docs/ACCEPTANCE_CHECK.md`](docs/ACCEPTANCE_CHECK.md) for release acceptanc
|
|
|
253
252
|
|
|
254
253
|
Fast agents need guardrails. `jhste-skills` gives them a repo-respecting engineering workflow.
|
|
255
254
|
|
|
256
|
-
Installed skill directories are tracked with `.jhste-skills-manifest.json`. `--force` refreshes manifest-managed skill copies; overwriting unmanaged differing skill directories still requires the separate `--allow-unmanaged-skill-overwrite` flag after review. `sync` and `update` can also adopt additional known jhste skills into an already managed skills directory so older mixed installs can be reconciled without a manual overwrite flag.
|
|
255
|
+
Installed skill directories are tracked with `.jhste-skills-manifest.json`. `--force` refreshes manifest-managed skill copies; overwriting unmanaged differing skill directories still requires the separate `--allow-unmanaged-skill-overwrite` flag after review. `sync` and `update` can also adopt additional known jhste skills into an already managed skills directory so older mixed installs can be reconciled without a manual overwrite flag. Legacy vendored renames are also reconciled during `sync` and `update`, so older managed installs that still have `diagnose` are migrated to `diagnosing-bugs` without leaving duplicate skill directories.
|
package/README.zh.md
CHANGED
|
@@ -158,7 +158,6 @@ Normal install 还会安装 14 个从 Matt Pocock 的 [`mattpocock/skills`](http
|
|
|
158
158
|
|
|
159
159
|
| Skill | 何时使用 |
|
|
160
160
|
|---|---|
|
|
161
|
-
| [`diagnose`](skills/diagnose/SKILL.md)<br>强制执行 reproduce、minimize、hypothesize、instrument、fix、regression-check 的诊断循环 skill | 系统性诊断 hard bug 或 performance regression 时 |
|
|
162
161
|
| [`diagnosing-bugs`](skills/diagnosing-bugs/SKILL.md)<br>围绕快速 pass/fail feedback loop 缩小 root cause 的 debugging skill | 需要 reproduce → minimise → hypothesise → instrument → fix 循环时 |
|
|
163
162
|
| [`grill-me`](skills/grill-me/SKILL.md)<br>持续提问,直到计划或设计没有明显空洞的 skill | 希望 agent 持续追问计划或设计直到清晰时 |
|
|
164
163
|
| [`grill-with-docs`](skills/grill-with-docs/SKILL.md)<br>在提问过程中记录 domain terms 和 decisions 的设计验证 skill | 希望在提问过程中更新 project vocabulary 和 docs/ADR 时 |
|
|
@@ -5,6 +5,13 @@ import { readJsonFile, validateJsonObject, validateStringArray } from '../json-f
|
|
|
5
5
|
|
|
6
6
|
export const SKILLS_MANIFEST_NAME = '.jhste-skills-manifest.json';
|
|
7
7
|
export const MANIFEST_MANAGED_BY = 'jhste-skills';
|
|
8
|
+
export const LEGACY_SKILL_RENAMES = Object.freeze({
|
|
9
|
+
diagnose: 'diagnosing-bugs',
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export function canonicalSkillName(name) {
|
|
13
|
+
return LEGACY_SKILL_RENAMES[name] || name;
|
|
14
|
+
}
|
|
8
15
|
|
|
9
16
|
function vendoredSkillNames() {
|
|
10
17
|
const allowlistPath = path.join(KIT_ROOT, 'vendor', 'matt-pocock', 'allowlist.json');
|
|
@@ -16,7 +23,7 @@ function vendoredSkillNames() {
|
|
|
16
23
|
|
|
17
24
|
export function skillNamesForSet(skillSet) {
|
|
18
25
|
const sourceRoot = path.join(KIT_ROOT, 'skills');
|
|
19
|
-
const all = listDirectories(sourceRoot);
|
|
26
|
+
const all = listDirectories(sourceRoot).filter((name) => !Object.prototype.hasOwnProperty.call(LEGACY_SKILL_RENAMES, name));
|
|
20
27
|
const vendored = vendoredSkillNames();
|
|
21
28
|
if (skillSet === 'all') return all;
|
|
22
29
|
if (skillSet === 'vendor') return all.filter((name) => vendored.has(name));
|
|
@@ -72,6 +79,27 @@ function canAdoptKnownSkill({ manifest = null, adoptKnownSkills = false } = {})
|
|
|
72
79
|
return Boolean(adoptKnownSkills && manifest && !manifest.invalid);
|
|
73
80
|
}
|
|
74
81
|
|
|
82
|
+
function canMigrateLegacySkill({ currentManifest, legacyName, allowUnmanagedOverwrite = false, adoptKnownSkills = false }) {
|
|
83
|
+
if (allowUnmanagedOverwrite) return true;
|
|
84
|
+
if (currentManifest?.skills?.[legacyName]) return true;
|
|
85
|
+
return canAdoptKnownSkill({ manifest: currentManifest, adoptKnownSkills });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function removeLegacySkillDirectories(skillsDir, selected, currentManifest, nextManifest, { allowUnmanagedOverwrite = false, adoptKnownSkills = false } = {}) {
|
|
89
|
+
const selectedSet = new Set(selected.map((name) => canonicalSkillName(name)));
|
|
90
|
+
const results = [];
|
|
91
|
+
for (const [legacyName, canonicalName] of Object.entries(LEGACY_SKILL_RENAMES)) {
|
|
92
|
+
delete nextManifest.skills[legacyName];
|
|
93
|
+
if (!selectedSet.has(canonicalName)) continue;
|
|
94
|
+
const legacyPath = path.join(skillsDir, legacyName);
|
|
95
|
+
if (!fs.existsSync(legacyPath)) continue;
|
|
96
|
+
if (!canMigrateLegacySkill({ currentManifest, legacyName, allowUnmanagedOverwrite, adoptKnownSkills })) continue;
|
|
97
|
+
fs.rmSync(legacyPath, { recursive: true, force: true });
|
|
98
|
+
results.push({ status: 'removed-legacy-renamed-skill', source: legacyPath, destination: path.join(skillsDir, canonicalName), legacyName, canonicalName });
|
|
99
|
+
}
|
|
100
|
+
return results;
|
|
101
|
+
}
|
|
102
|
+
|
|
75
103
|
function copyManagedSkill(source, destination, name, {
|
|
76
104
|
force = false,
|
|
77
105
|
allowUnmanagedOverwrite = false,
|
|
@@ -124,9 +152,7 @@ function unmanagedSkillConflicts(selected, sourceRoot, skillsDir, currentManifes
|
|
|
124
152
|
for (const name of selected) {
|
|
125
153
|
const source = path.join(sourceRoot, name);
|
|
126
154
|
const destination = path.join(skillsDir, name);
|
|
127
|
-
if (
|
|
128
|
-
if (directoryDigest(source) === directoryDigest(destination)) continue;
|
|
129
|
-
if (!currentManifest?.skills?.[name] && !canAdopt) {
|
|
155
|
+
if (fs.existsSync(source) && fs.existsSync(destination) && directoryDigest(source) !== directoryDigest(destination) && !currentManifest?.skills?.[name] && !canAdopt) {
|
|
130
156
|
out.push({
|
|
131
157
|
status: 'skipped-unmanaged-different',
|
|
132
158
|
source,
|
|
@@ -135,6 +161,18 @@ function unmanagedSkillConflicts(selected, sourceRoot, skillsDir, currentManifes
|
|
|
135
161
|
});
|
|
136
162
|
}
|
|
137
163
|
}
|
|
164
|
+
for (const [legacyName, canonicalName] of Object.entries(LEGACY_SKILL_RENAMES)) {
|
|
165
|
+
if (!selected.includes(canonicalName)) continue;
|
|
166
|
+
const legacyPath = path.join(skillsDir, legacyName);
|
|
167
|
+
if (!fs.existsSync(legacyPath)) continue;
|
|
168
|
+
if (canMigrateLegacySkill({ currentManifest, legacyName, adoptKnownSkills })) continue;
|
|
169
|
+
out.push({
|
|
170
|
+
status: 'skipped-unmanaged-different',
|
|
171
|
+
source: legacyPath,
|
|
172
|
+
destination: path.join(skillsDir, canonicalName),
|
|
173
|
+
reason: `${legacyName} is an older skill name that is not recorded as managed by ${MANIFEST_MANAGED_BY}; pass --allow-unmanaged-skill-overwrite only after review`,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
138
176
|
return out;
|
|
139
177
|
}
|
|
140
178
|
|
|
@@ -146,7 +184,7 @@ export function installSkills(skillsDir, {
|
|
|
146
184
|
} = {}) {
|
|
147
185
|
const sourceRoot = path.join(KIT_ROOT, 'skills');
|
|
148
186
|
ensureDir(skillsDir);
|
|
149
|
-
const selected = Array.isArray(skillSet) ? skillSet : skillNamesForSet(skillSet);
|
|
187
|
+
const selected = (Array.isArray(skillSet) ? skillSet : skillNamesForSet(skillSet)).map((name) => canonicalSkillName(name));
|
|
150
188
|
const currentManifest = loadSkillsManifest(skillsDir);
|
|
151
189
|
if (currentManifest?.invalid) return [{ status: 'invalid-manifest', source: '', destination: manifestPath(skillsDir), reason: currentManifest.reason }];
|
|
152
190
|
const nextManifest = currentManifest || { managed_by: MANIFEST_MANAGED_BY, version: packageVersion(), installed_at: nowIso(), skills: {} };
|
|
@@ -158,6 +196,10 @@ export function installSkills(skillsDir, {
|
|
|
158
196
|
? unmanagedSkillConflicts(selected, sourceRoot, skillsDir, currentManifest, { adoptKnownSkills })
|
|
159
197
|
: [];
|
|
160
198
|
if (conflicts.length) return conflicts;
|
|
199
|
+
const legacyResults = removeLegacySkillDirectories(skillsDir, selected, currentManifest, nextManifest, {
|
|
200
|
+
allowUnmanagedOverwrite,
|
|
201
|
+
adoptKnownSkills,
|
|
202
|
+
});
|
|
161
203
|
const results = selected.map((name) => copyManagedSkill(path.join(sourceRoot, name), path.join(skillsDir, name), name, {
|
|
162
204
|
force,
|
|
163
205
|
allowUnmanagedOverwrite,
|
|
@@ -166,5 +208,5 @@ export function installSkills(skillsDir, {
|
|
|
166
208
|
nextManifest,
|
|
167
209
|
}));
|
|
168
210
|
writeSkillsManifest(skillsDir, nextManifest);
|
|
169
|
-
return results;
|
|
211
|
+
return [...legacyResults, ...results];
|
|
170
212
|
}
|
package/cli/sync-core.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
readIfExists,
|
|
13
13
|
} from './shared.mjs';
|
|
14
14
|
import { applyPlan, preflightPlan, printApplyResult } from './install-actions.mjs';
|
|
15
|
+
import { LEGACY_SKILL_RENAMES, canonicalSkillName } from './install-actions/skills.mjs';
|
|
15
16
|
import { gitHooksDir, HOOKS, isManagedHook } from './hook-utils.mjs';
|
|
16
17
|
import { printConfigErrors, printPlanSummary } from './install-flow/output.mjs';
|
|
17
18
|
import { readJsonFile, validateStringArray } from './json-file.mjs';
|
|
@@ -91,7 +92,14 @@ function sourceSkillNames() {
|
|
|
91
92
|
|
|
92
93
|
function detectInstalledSkillNames(skillsDir) {
|
|
93
94
|
const known = new Set(sourceSkillNames());
|
|
94
|
-
|
|
95
|
+
const detected = new Set();
|
|
96
|
+
for (const name of listDirectories(skillsDir)) {
|
|
97
|
+
const canonicalName = canonicalSkillName(name);
|
|
98
|
+
if (known.has(canonicalName) || Object.prototype.hasOwnProperty.call(LEGACY_SKILL_RENAMES, name)) {
|
|
99
|
+
detected.add(canonicalName);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return [...detected];
|
|
95
103
|
}
|
|
96
104
|
|
|
97
105
|
function skillNamesForSet(skillSet) {
|
package/docs/ACCEPTANCE_CHECK.md
CHANGED
|
@@ -52,3 +52,5 @@ npm pack --dry-run
|
|
|
52
52
|
Record actual command output in release notes before publishing a release.
|
|
53
53
|
|
|
54
54
|
Release gates include dependency-free syntax checking, a first-run `install -> deep-scan -> tune --yes -> guard` smoke flow, `npm pack --dry-run` contents checks, and packed-tarball bin execution in a fresh temp consumer. These gates are not part of commit-time hooks.
|
|
55
|
+
|
|
56
|
+
- Verify `sync`/`update` migrates older managed vendored renames without leaving duplicate directories, including `diagnose` → `diagnosing-bugs`.
|
|
@@ -56,3 +56,5 @@ If a similar section exists, the installer prints the snippet instead of editing
|
|
|
56
56
|
## Existing hooks
|
|
57
57
|
|
|
58
58
|
Managed hooks are identified by the jhste-skills hook markers. Existing non-managed hooks are never overwritten, including in `Full` mode and with `--force`. Full may install multiple hook targets, but each target is reported separately as installed, refreshed, skipped because non-managed, or failed.
|
|
59
|
+
|
|
60
|
+
Legacy vendored renames are treated differently from unmanaged conflicts. During `sync` and `update`, an older managed `diagnose` install is migrated to `diagnosing-bugs` automatically so the skills directory does not keep both names.
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@ export function runConnectScenarios({ root, tmp, skillsDir }) {
|
|
|
13
13
|
fs.mkdirSync(nonGitCwd, { recursive: true });
|
|
14
14
|
run(process.execPath, [path.join(root, 'cli/install.mjs'), '--yes', '--skills-dir', nonGitCwdSkills, '--skip-deep-scan'], { cwd: nonGitCwd });
|
|
15
15
|
if (fs.existsSync(path.join(nonGitCwd, '.jhste'))) fail('install outside git repo created .jhste');
|
|
16
|
-
if (skillDirs(nonGitCwdSkills).length !==
|
|
16
|
+
if (skillDirs(nonGitCwdSkills).length !== 20) fail('install outside git repo did not install 20 bundled skills');
|
|
17
17
|
|
|
18
18
|
const explicitNonGitRepo = path.join(tmp, 'explicit-non-git-repo');
|
|
19
19
|
const explicitNonGitSkills = path.join(tmp, 'explicit-non-git-skills');
|
|
@@ -42,6 +42,6 @@ export function runConnectScenarios({ root, tmp, skillsDir }) {
|
|
|
42
42
|
if (connectMissing.status !== 3) fail(`connect missing skills should exit 3, got ${connectMissing.status}`);
|
|
43
43
|
if (fs.existsSync(path.join(connectMissingRepo, '.jhste'))) fail('connect missing skills created .jhste');
|
|
44
44
|
run(process.execPath, [path.join(root, 'cli/connect.mjs'), '--mode', 'normal', '--yes', '--repo', connectMissingRepo, '--skills-dir', connectMissingSkills, '--skip-deep-scan', '--install-missing'], { cwd: connectMissingRepo });
|
|
45
|
-
if (skillDirs(connectMissingSkills).length !==
|
|
45
|
+
if (skillDirs(connectMissingSkills).length !== 20) fail('connect --install-missing did not install 20 bundled skills');
|
|
46
46
|
if (!fs.existsSync(path.join(connectMissingRepo, '.jhste', 'profile.yaml'))) fail('connect --install-missing did not create profile');
|
|
47
47
|
}
|
|
@@ -28,6 +28,15 @@ function initRepo(repo) {
|
|
|
28
28
|
run('git', ['init'], { cwd: repo });
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
function readManagedSkillsManifest(skillsDir) {
|
|
32
|
+
const manifestPath = path.join(skillsDir, '.jhste-skills-manifest.json');
|
|
33
|
+
const parsed = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
34
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) fail('skills manifest is not an object');
|
|
35
|
+
if (parsed.managed_by !== 'jhste-skills') fail('skills manifest managed_by is invalid');
|
|
36
|
+
if (!parsed.skills || typeof parsed.skills !== 'object' || Array.isArray(parsed.skills)) fail('skills manifest skills map is invalid');
|
|
37
|
+
return parsed;
|
|
38
|
+
}
|
|
39
|
+
|
|
31
40
|
function runRefusalScenarios({ root, tmp }) {
|
|
32
41
|
const nonInteractiveRepo = path.join(tmp, 'noninteractive-repo');
|
|
33
42
|
const nonInteractiveSkills = path.join(tmp, 'noninteractive-skills');
|
|
@@ -103,10 +112,10 @@ function runDefaultInstall(ctx) {
|
|
|
103
112
|
if (!fs.readFileSync(defaultPreCommit, 'utf8').includes(`# jhste-skills version=${version}`)) fail('default pre-commit hook missing version comment');
|
|
104
113
|
if (!fs.existsSync(path.join(skillsDir, 'jhste-red-team-review', 'SKILL.md'))) fail('install did not copy jhste-red-team-review skill');
|
|
105
114
|
if (!fs.existsSync(path.join(skillsDir, '.jhste-skills-manifest.json'))) fail('install did not write skills manifest');
|
|
106
|
-
const manifest =
|
|
115
|
+
const manifest = readManagedSkillsManifest(skillsDir);
|
|
107
116
|
if (manifest.managed_by !== 'jhste-skills' || !manifest.skills?.['jhste-red-team-review']?.digest) fail('skills manifest missing managed skill digest');
|
|
108
117
|
const defaultSkillDirs = skillDirs(skillsDir);
|
|
109
|
-
if (defaultSkillDirs.length !==
|
|
118
|
+
if (defaultSkillDirs.length !== 20) fail(`default install should copy 20 bundled skills, got ${defaultSkillDirs.length}`);
|
|
110
119
|
if (!defaultSkillDirs.includes('improve-codebase-architecture')) fail('default install should copy vendored workflow skills');
|
|
111
120
|
}
|
|
112
121
|
|
|
@@ -162,9 +171,28 @@ run_jhste_skills guard --scope staged --format text --fail-on warning
|
|
|
162
171
|
if (!updatedPreCommit.includes(`# jhste-skills version=${version}`)) fail('update did not refresh hook version comment');
|
|
163
172
|
if (updatedPreCommit.includes('stale hook')) fail('update did not replace stale managed hook content');
|
|
164
173
|
|
|
165
|
-
const managedManifest =
|
|
174
|
+
const managedManifest = readManagedSkillsManifest(skillsDir);
|
|
166
175
|
if (!managedManifest.skills?.[adoptedSkillName]?.digest) fail('update did not record adopted known skill in manifest');
|
|
167
176
|
|
|
177
|
+
const legacySkillName = 'diagnose';
|
|
178
|
+
const canonicalSkillName = 'diagnosing-bugs';
|
|
179
|
+
const legacySkillDir = path.join(skillsDir, legacySkillName);
|
|
180
|
+
fs.mkdirSync(legacySkillDir, { recursive: true });
|
|
181
|
+
fs.writeFileSync(path.join(legacySkillDir, 'SKILL.md'), '# stale legacy diagnose copy\n');
|
|
182
|
+
managedManifest.skills[legacySkillName] = { digest: 'legacy-digest' };
|
|
183
|
+
fs.writeFileSync(path.join(skillsDir, '.jhste-skills-manifest.json'), `${JSON.stringify(managedManifest, null, 2)}\n`);
|
|
184
|
+
|
|
185
|
+
run(process.execPath, [path.join(root, 'cli/update.mjs'), '--yes', '--repo', repo, '--skills-dir', skillsDir], { cwd: repo });
|
|
186
|
+
|
|
187
|
+
if (fs.existsSync(legacySkillDir)) fail('update did not remove legacy diagnose skill directory');
|
|
188
|
+
const canonicalSkillPath = path.join(skillsDir, canonicalSkillName, 'SKILL.md');
|
|
189
|
+
if (fs.readFileSync(canonicalSkillPath, 'utf8') !== fs.readFileSync(path.join(root, 'skills', canonicalSkillName, 'SKILL.md'), 'utf8')) {
|
|
190
|
+
fail('update did not keep canonical diagnosing-bugs skill content after legacy migration');
|
|
191
|
+
}
|
|
192
|
+
const migratedManifest = readManagedSkillsManifest(skillsDir);
|
|
193
|
+
if (migratedManifest.skills?.[legacySkillName]) fail('update left legacy diagnose entry in manifest after migration');
|
|
194
|
+
if (!migratedManifest.skills?.[canonicalSkillName]?.digest) fail('update did not keep canonical diagnosing-bugs entry in manifest after migration');
|
|
195
|
+
|
|
168
196
|
const unmanagedSkills = path.join(path.dirname(skillsDir), 'unmanaged-skills');
|
|
169
197
|
fs.mkdirSync(path.join(unmanagedSkills, 'jhste-code-quality'), { recursive: true });
|
|
170
198
|
fs.writeFileSync(path.join(unmanagedSkills, 'jhste-code-quality', 'SKILL.md'), '# unmanaged local copy\n');
|
|
@@ -218,7 +246,7 @@ function runSkillSetScenarios({ root, tmp }) {
|
|
|
218
246
|
fs.writeFileSync(path.join(vendorRepo, 'AGENTS.md'), '# Vendor skill repo\n');
|
|
219
247
|
run(process.execPath, [path.join(root, 'cli/install.mjs'), '--yes', '--repo', vendorRepo, '--skills-dir', vendorSkillsDir, '--skip-deep-scan', '--skip-hooks', '--skill-set', 'vendor'], { cwd: vendorRepo });
|
|
220
248
|
const vendorSkillDirs = skillDirs(vendorSkillsDir);
|
|
221
|
-
if (vendorSkillDirs.length !==
|
|
249
|
+
if (vendorSkillDirs.length !== 13) fail(`--skill-set vendor should copy 13 skills, got ${vendorSkillDirs.length}`);
|
|
222
250
|
if (!vendorSkillDirs.includes('improve-codebase-architecture')) fail('--skill-set vendor did not copy expected vendored skill');
|
|
223
251
|
if (vendorSkillDirs.includes('jhste-red-team-review')) fail('--skill-set vendor copied core skill');
|
|
224
252
|
|
|
@@ -228,7 +256,7 @@ function runSkillSetScenarios({ root, tmp }) {
|
|
|
228
256
|
fs.writeFileSync(path.join(allRepo, 'AGENTS.md'), '# All skill repo\n');
|
|
229
257
|
run(process.execPath, [path.join(root, 'cli/install.mjs'), '--yes', '--repo', allRepo, '--skills-dir', allSkillsDir, '--skip-deep-scan', '--skip-hooks', '--skill-set', 'all'], { cwd: allRepo });
|
|
230
258
|
const allSkillDirs = skillDirs(allSkillsDir);
|
|
231
|
-
if (allSkillDirs.length !==
|
|
259
|
+
if (allSkillDirs.length !== 20) fail(`--skill-set all should copy 20 skills, got ${allSkillDirs.length}`);
|
|
232
260
|
if (!allSkillDirs.includes('jhste-red-team-review') || !allSkillDirs.includes('improve-codebase-architecture')) fail('--skill-set all missing core or vendored skill');
|
|
233
261
|
}
|
|
234
262
|
|
|
@@ -47,7 +47,7 @@ function runFullModeScenarios({ root, tmp }) {
|
|
|
47
47
|
fs.writeFileSync(path.join(fullModeRepo, 'AGENTS.md'), '# Full mode repo\n');
|
|
48
48
|
run(process.execPath, [path.join(root, 'cli/install.mjs'), '--mode', 'full', '--yes', '--repo', fullModeRepo, '--skills-dir', fullModeSkillsDir, '--skip-deep-scan'], { cwd: fullModeRepo });
|
|
49
49
|
const fullModeSkillDirs = skillDirs(fullModeSkillsDir);
|
|
50
|
-
if (fullModeSkillDirs.length !==
|
|
50
|
+
if (fullModeSkillDirs.length !== 20) fail(`--mode full should copy 20 skills, got ${fullModeSkillDirs.length}`);
|
|
51
51
|
const fullPreCommit = path.join(fullModeRepo, '.git', 'hooks', 'pre-commit');
|
|
52
52
|
const fullPrePush = path.join(fullModeRepo, '.git', 'hooks', 'pre-push');
|
|
53
53
|
if (!fs.existsSync(fullPreCommit) || !fs.existsSync(fullPrePush)) fail('--mode full did not install pre-commit and pre-push');
|
package/scripts/vendor-check.mjs
CHANGED
|
@@ -6,7 +6,6 @@ import { readJsonFile, validateJsonObject, validateStringArray } from '../cli/js
|
|
|
6
6
|
|
|
7
7
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
8
8
|
const expected = [
|
|
9
|
-
'diagnose',
|
|
10
9
|
'grill-with-docs',
|
|
11
10
|
'triage',
|
|
12
11
|
'improve-codebase-architecture',
|
|
@@ -39,12 +38,12 @@ function readJson(file) {
|
|
|
39
38
|
|
|
40
39
|
const allowlist = readJson('vendor/matt-pocock/allowlist.json');
|
|
41
40
|
if (JSON.stringify(allowlist) !== JSON.stringify(expected)) {
|
|
42
|
-
fail('allowlist does not match the exact
|
|
41
|
+
fail('allowlist does not match the exact 13 selected skills');
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
const sourceLock = readJson('vendor/matt-pocock/source-lock.json');
|
|
46
45
|
if (!Array.isArray(sourceLock.skills) || sourceLock.skills.length !== expected.length) {
|
|
47
|
-
fail('source-lock must contain exactly
|
|
46
|
+
fail('source-lock must contain exactly 13 skills');
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
const seen = new Set();
|
|
@@ -3,14 +3,6 @@
|
|
|
3
3
|
"imported_at": "2026-06-18T10:53:47Z",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"skills": [
|
|
6
|
-
{
|
|
7
|
-
"name": "diagnose",
|
|
8
|
-
"source": "https://github.com/mattpocock/skills/tree/main/skills/engineering/diagnose",
|
|
9
|
-
"commit": "694fa30311e02c2639942308513555e61ee84a6f",
|
|
10
|
-
"license": "MIT; see vendor/matt-pocock/LICENSE",
|
|
11
|
-
"vendored_path": "skills/diagnose",
|
|
12
|
-
"imported_at": "2026-06-17T10:11:18Z"
|
|
13
|
-
},
|
|
14
6
|
{
|
|
15
7
|
"name": "grill-with-docs",
|
|
16
8
|
"source": "https://github.com/mattpocock/skills/tree/main/skills/engineering/grill-with-docs",
|
package/skills/diagnose/SKILL.md
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: diagnose
|
|
3
|
-
description: Disciplined diagnosis loop for hard bugs and performance regressions. Reproduce → minimise → hypothesise → instrument → fix → regression-test. Use when user says "diagnose this" / "debug this", reports a bug, says something is broken/throwing/failing, or describes a performance regression.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## jhste compatibility
|
|
7
|
-
|
|
8
|
-
- Repo-local instructions remain authoritative.
|
|
9
|
-
- Use `jhste-engineering-judgment` for scope, seams, assumptions, and failure paths when it applies.
|
|
10
|
-
- Vocabulary in this vendored skill is advisory unless adopted by repo-local docs; do not rename established repo concepts only to match this skill.
|
|
11
|
-
- File, repo, command, issue, PR, or other external side effects require explicit approval unless the user already requested that exact side effect.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# Diagnose
|
|
15
|
-
|
|
16
|
-
A discipline for hard bugs. Skip phases only when explicitly justified.
|
|
17
|
-
|
|
18
|
-
When exploring the codebase, use the project's domain glossary to get a clear mental model of the relevant modules, and check ADRs in the area you're touching.
|
|
19
|
-
|
|
20
|
-
## Phase 1 — Build a feedback loop
|
|
21
|
-
|
|
22
|
-
**This is the skill.** Everything else is mechanical. If you have a fast, deterministic, agent-runnable pass/fail signal for the bug, you will find the cause — bisection, hypothesis-testing, and instrumentation all just consume that signal. If you don't have one, no amount of staring at code will save you.
|
|
23
|
-
|
|
24
|
-
Spend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**
|
|
25
|
-
|
|
26
|
-
### Ways to construct one — try them in roughly this order
|
|
27
|
-
|
|
28
|
-
1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e.
|
|
29
|
-
2. **Curl / HTTP script** against a running dev server.
|
|
30
|
-
3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.
|
|
31
|
-
4. **Headless browser script** (Playwright / Puppeteer) — drives the UI, asserts on DOM/console/network.
|
|
32
|
-
5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.
|
|
33
|
-
6. **Throwaway harness.** Spin up a minimal subset of the system (one service, mocked deps) that exercises the bug code path with a single function call.
|
|
34
|
-
7. **Property / fuzz loop.** If the bug is "sometimes wrong output", run 1000 random inputs and look for the failure mode.
|
|
35
|
-
8. **Bisection harness.** If the bug appeared between two known states (commit, dataset, version), automate "boot at state X, check, repeat" so you can `git bisect run` it.
|
|
36
|
-
9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.
|
|
37
|
-
10. **HITL bash script.** Last resort. If a human must click, drive _them_ with `scripts/hitl-loop.template.sh` so the loop is still structured. Captured output feeds back to you.
|
|
38
|
-
|
|
39
|
-
Build the right feedback loop, and the bug is 90% fixed.
|
|
40
|
-
|
|
41
|
-
### Iterate on the loop itself
|
|
42
|
-
|
|
43
|
-
Treat the loop as a product. Once you have _a_ loop, ask:
|
|
44
|
-
|
|
45
|
-
- Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)
|
|
46
|
-
- Can I make the signal sharper? (Assert on the specific symptom, not "didn't crash".)
|
|
47
|
-
- Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)
|
|
48
|
-
|
|
49
|
-
A 30-second flaky loop is barely better than no loop. A 2-second deterministic loop is a debugging superpower.
|
|
50
|
-
|
|
51
|
-
### Non-deterministic bugs
|
|
52
|
-
|
|
53
|
-
The goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100×, parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not — keep raising the rate until it's debuggable.
|
|
54
|
-
|
|
55
|
-
### When you genuinely cannot build a loop
|
|
56
|
-
|
|
57
|
-
Stop and say so explicitly. List what you tried. Ask the user for: (a) access to whatever environment reproduces it, (b) a captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or (c) permission to add temporary production instrumentation. Do **not** proceed to hypothesise without a loop.
|
|
58
|
-
|
|
59
|
-
Do not proceed to Phase 2 until you have a loop you believe in.
|
|
60
|
-
|
|
61
|
-
## Phase 2 — Reproduce
|
|
62
|
-
|
|
63
|
-
Run the loop. Watch the bug appear.
|
|
64
|
-
|
|
65
|
-
Confirm:
|
|
66
|
-
|
|
67
|
-
- [ ] The loop produces the failure mode the **user** described — not a different failure that happens to be nearby. Wrong bug = wrong fix.
|
|
68
|
-
- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).
|
|
69
|
-
- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.
|
|
70
|
-
|
|
71
|
-
Do not proceed until you reproduce the bug.
|
|
72
|
-
|
|
73
|
-
## Phase 3 — Hypothesise
|
|
74
|
-
|
|
75
|
-
Generate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.
|
|
76
|
-
|
|
77
|
-
Each hypothesis must be **falsifiable**: state the prediction it makes.
|
|
78
|
-
|
|
79
|
-
> Format: "If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse."
|
|
80
|
-
|
|
81
|
-
If you cannot state the prediction, the hypothesis is a vibe — discard or sharpen it.
|
|
82
|
-
|
|
83
|
-
**Show the ranked list to the user before testing.** They often have domain knowledge that re-ranks instantly ("we just deployed a change to #3"), or know hypotheses they've already ruled out. Cheap checkpoint, big time saver. Don't block on it — proceed with your ranking if the user is AFK.
|
|
84
|
-
|
|
85
|
-
## Phase 4 — Instrument
|
|
86
|
-
|
|
87
|
-
Each probe must map to a specific prediction from Phase 3. **Change one variable at a time.**
|
|
88
|
-
|
|
89
|
-
Tool preference:
|
|
90
|
-
|
|
91
|
-
1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.
|
|
92
|
-
2. **Targeted logs** at the boundaries that distinguish hypotheses.
|
|
93
|
-
3. Never "log everything and grep".
|
|
94
|
-
|
|
95
|
-
**Tag every debug log** with a unique prefix, e.g. `[DEBUG-a4f2]`. Cleanup at the end becomes a single grep. Untagged logs survive; tagged logs die.
|
|
96
|
-
|
|
97
|
-
**Perf branch.** For performance regressions, logs are usually wrong. Instead: establish a baseline measurement (timing harness, `performance.now()`, profiler, query plan), then bisect. Measure first, fix second.
|
|
98
|
-
|
|
99
|
-
## Phase 5 — Fix + regression test
|
|
100
|
-
|
|
101
|
-
Write the regression test **before the fix** — but only if there is a **correct seam** for it.
|
|
102
|
-
|
|
103
|
-
A correct seam is one where the test exercises the **real bug pattern** as it occurs at the call site. If the only available seam is too shallow (single-caller test when the bug needs multiple callers, unit test that can't replicate the chain that triggered the bug), a regression test there gives false confidence.
|
|
104
|
-
|
|
105
|
-
**If no correct seam exists, that itself is the finding.** Note it. The codebase architecture is preventing the bug from being locked down. Flag this for the next phase.
|
|
106
|
-
|
|
107
|
-
If a correct seam exists:
|
|
108
|
-
|
|
109
|
-
1. Turn the minimised repro into a failing test at that seam.
|
|
110
|
-
2. Watch it fail.
|
|
111
|
-
3. Apply the fix.
|
|
112
|
-
4. Watch it pass.
|
|
113
|
-
5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.
|
|
114
|
-
|
|
115
|
-
## Phase 6 — Cleanup + post-mortem
|
|
116
|
-
|
|
117
|
-
Required before declaring done:
|
|
118
|
-
|
|
119
|
-
- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)
|
|
120
|
-
- [ ] Regression test passes (or absence of seam is documented)
|
|
121
|
-
- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)
|
|
122
|
-
- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)
|
|
123
|
-
- [ ] The hypothesis that turned out correct is stated in the commit / PR message — so the next debugger learns
|
|
124
|
-
|
|
125
|
-
**Then ask: what would have prevented this bug?** If the answer involves architectural change (no good test seam, tangled callers, hidden coupling) hand off to the `/improve-codebase-architecture` skill with the specifics. Make the recommendation **after** the fix is in, not before — you have more information now than when you started.
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Human-in-the-loop reproduction loop.
|
|
3
|
-
# Copy this file, edit the steps below, and run it.
|
|
4
|
-
# The agent runs the script; the user follows prompts in their terminal.
|
|
5
|
-
#
|
|
6
|
-
# Usage:
|
|
7
|
-
# bash hitl-loop.template.sh
|
|
8
|
-
#
|
|
9
|
-
# Two helpers:
|
|
10
|
-
# step "<instruction>" → show instruction, wait for Enter
|
|
11
|
-
# capture VAR "<question>" → show question, read response into VAR
|
|
12
|
-
#
|
|
13
|
-
# At the end, captured values are printed as KEY=VALUE for the agent to parse.
|
|
14
|
-
|
|
15
|
-
set -euo pipefail
|
|
16
|
-
|
|
17
|
-
step() {
|
|
18
|
-
printf '\n>>> %s\n' "$1"
|
|
19
|
-
read -r -p " [Enter when done] " _
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
capture() {
|
|
23
|
-
local var="$1" question="$2" answer
|
|
24
|
-
printf '\n>>> %s\n' "$question"
|
|
25
|
-
read -r -p " > " answer
|
|
26
|
-
printf -v "$var" '%s' "$answer"
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
# --- edit below ---------------------------------------------------------
|
|
30
|
-
|
|
31
|
-
step "Open the app at http://localhost:3000 and sign in."
|
|
32
|
-
|
|
33
|
-
capture ERRORED "Click the 'Export' button. Did it throw an error? (y/n)"
|
|
34
|
-
|
|
35
|
-
capture ERROR_MSG "Paste the error message (or 'none'):"
|
|
36
|
-
|
|
37
|
-
# --- edit above ---------------------------------------------------------
|
|
38
|
-
|
|
39
|
-
printf '\n--- Captured ---\n'
|
|
40
|
-
printf 'ERRORED=%s\n' "$ERRORED"
|
|
41
|
-
printf 'ERROR_MSG=%s\n' "$ERROR_MSG"
|