feat(ms-ai-architect): Spor D N1–N5 — Anthropic-deterministiske skill-sjekker (TDD) [skip-docs]
Legger de fem deterministiske sjekkene fra Anthropics «Skill authoring best practices» som K1–K10-rubrikken manglet, i begge lag av score-motoren: - eval.mjs (disk-laget): extractName + checkN1..checkN5 - N1 name-validitet (≤64, a-z0-9-, ingen «claude»/«anthropic»; gerund rapporteres, gater ikke) - N2 description ikke-tom + ≤1024 tegn - N3 refs én nivå dypt (ref-fil lenker ikke til annen ref-fil) - N4 TOC i ref-filer >100 linjer (delpoeng = andel store filer med TOC) - N5 forward-slash-stier (ingen Windows-backslash-stier i body) wiret inn i evalSkill.deterministic (leser nå ref-fil-innhold for N3/N4) - lib/skill-score.mjs (ren): N1–N5 i CRITERIA (vekt 1, ikke-gulv, det) Live-sanity mot de 5 skills: N1/N2/N5 rene, N3 fanger ekte nøstet ref i advisor (licensing-matrix.md → 3 andre ref-filer), N4 avdekker 387 store ref-filer uten TOC (primær forbedringsspak for oppgraderingsfasen). Tester: kb-eval 110→134 (+24). validate 239, kb-update 316 uendret grønt. [skip-docs]: N1–N5 alt spesifisert i docs/skill-quality-scoring-plan.md §2. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
bab9f2d23d
commit
e87289d929
4 changed files with 323 additions and 0 deletions
|
|
@ -21,6 +21,11 @@ function perfectEval(overrides = {}) {
|
|||
refCountConsistency: { consistent: true, mismatches: [] },
|
||||
K9_timeSensitiveHints: { timeSensitiveTokenHits: 0 },
|
||||
K10_siblingScopeOverlap: { maxCombined: 2.0, worstSibling: 'x', pass: true, threshold: 7.0 },
|
||||
N1_nameValidity: { pass: true },
|
||||
N2_descriptionLength: { pass: true, length: 500 },
|
||||
N3_refNestingDepth: { pass: true, nested: [] },
|
||||
N4_refToc: { largeFiles: 5, withToc: 5, ratio: 1, pass: true },
|
||||
N5_forwardSlashPaths: { pass: true, windowsPaths: [] },
|
||||
},
|
||||
judgeInputs: { description: 'desc', bodyLines: 120 },
|
||||
judge: {
|
||||
|
|
@ -126,6 +131,47 @@ test('scoreSkill — every improvement carries a concrete fix string', () => {
|
|||
assert.ok(k3 && typeof k3.fix === 'string' && k3.fix.length > 0);
|
||||
});
|
||||
|
||||
test('scoreSkill — N1-N5 deterministic criteria are all scored on a perfect eval', () => {
|
||||
const r = scoreSkill(perfectEval());
|
||||
for (const key of ['N1', 'N2', 'N3', 'N4', 'N5']) {
|
||||
const c = r.criteria.find((x) => x.key === key);
|
||||
assert.ok(c && c.available, `${key} should be an available criterion`);
|
||||
assert.equal(c.source, 'det', `${key} is deterministic`);
|
||||
assert.equal(c.floor, false, `${key} is not a floor criterion`);
|
||||
}
|
||||
assert.equal(r.score, 100, 'all N1-N5 passing keeps the perfect score');
|
||||
});
|
||||
|
||||
test('scoreSkill — N4 (TOC) gives partial credit proportional to coverage ratio', () => {
|
||||
const r = scoreSkill(perfectEval({
|
||||
deterministic: { N4_refToc: { largeFiles: 4, withToc: 2, ratio: 0.5, pass: false } },
|
||||
}));
|
||||
const n4 = r.criteria.find((c) => c.key === 'N4');
|
||||
assert.ok(Math.abs(n4.sub - 0.5) < 1e-9, `N4 sub was ${n4.sub}`);
|
||||
assert.equal(r.floored, false, 'N4 is not a floor criterion');
|
||||
assert.ok(r.score < 100 && r.score > FLOOR_CAP, `expected high-but-imperfect, got ${r.score}`);
|
||||
assert.ok(r.improvements.some((i) => i.key === 'N4'));
|
||||
});
|
||||
|
||||
test('scoreSkill — an invalid name (N1) is a non-floor miss that lands in improvements', () => {
|
||||
const r = scoreSkill(perfectEval({
|
||||
deterministic: { N1_nameValidity: { pass: false } },
|
||||
}));
|
||||
const n1 = r.criteria.find((c) => c.key === 'N1');
|
||||
assert.equal(n1.sub, 0);
|
||||
assert.equal(r.floored, false, 'N1 does not floor the score');
|
||||
assert.ok(r.meetsTarget, 'a single non-floor binary miss should not drop below 90');
|
||||
assert.ok(r.improvements.some((i) => i.key === 'N1' && typeof i.fix === 'string'));
|
||||
});
|
||||
|
||||
test('scoreSkill — nested references (N3) reduce the score', () => {
|
||||
const r = scoreSkill(perfectEval({
|
||||
deterministic: { N3_refNestingDepth: { pass: false, nested: [{ file: 'references/a.md', links: ['b.md'] }] } },
|
||||
}));
|
||||
assert.ok(r.score < 100);
|
||||
assert.ok(r.improvements.some((i) => i.key === 'N3'));
|
||||
});
|
||||
|
||||
test('scoreSkill — tolerates a null/garbage eval object without throwing', () => {
|
||||
assert.equal(scoreSkill(null), null);
|
||||
assert.equal(scoreSkill({}), null);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue