Allow XML-block prose form in SKILL.md DON'T parser

Recognize "DO NOT" / "DO" lines (with optional colon) inside <rules>
and <absolute_bans> blocks, and make skillGuideline substring matching
case-insensitive so the validator handles the new XML-structured
SKILL.md without rejecting the refactored prose.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Paul Bakaus
2026-04-08 11:38:26 -07:00
co-authored by Claude Opus 4.6
parent 282987ad7b
commit 0728eaadea
2 changed files with 50 additions and 19 deletions
+8 -4
View File
@@ -122,10 +122,14 @@ function validateAntipatternRules(rootDir) {
const antipatterns = new Function(`return [${apMatch[1]}]`)();
const { antipatterns: skillSections } = readPatterns(rootDir);
// Build section -> joined-DON'T-text lookup for substring matching
// Build section -> joined-DON'T-text lookup for substring matching.
// Lowercased for case-insensitive matching: my XML refactor uses sentence-
// case "DO NOT nest cards" while the rules' skillGuideline strings are
// sentence-cased "Nest cards inside cards" (a fragment from the original
// markdown bullet "**DON'T**: Nest cards inside cards.").
const sectionText = {};
for (const section of skillSections) {
sectionText[section.name] = section.items.join('\n');
sectionText[section.name] = section.items.join('\n').toLowerCase();
}
let errors = 0;
@@ -143,8 +147,8 @@ function validateAntipatternRules(rootDir) {
errors++;
continue;
}
if (!text.includes(rule.skillGuideline)) {
console.error(` ❌ Rule '${rule.id}': skillGuideline '${rule.skillGuideline}' not found in any **DON'T** of section '${rule.skillSection}' in source/skills/impeccable/SKILL.md`);
if (!text.includes(rule.skillGuideline.toLowerCase())) {
console.error(` ❌ Rule '${rule.id}': skillGuideline '${rule.skillGuideline}' not found in any DON'T of section '${rule.skillSection}' in source/skills/impeccable/SKILL.md`);
errors++;
continue;
}