Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2b072a0
feat: add skill quality validator
Rupam0710 Sep 8, 2026
8ed3e47
fix: resolve skill-quality validator review comments
Rupam0710 Sep 8, 2026
7ecef04
fix: tighten strict skill section validation
Rupam0710 Sep 8, 2026
346a28d
fix: resolve skill validator lint and strict checks
Rupam0710 Sep 8, 2026
bbc30bf
fix: address skill validator review feedback
Rupam0710 Sep 8, 2026
fdd769c
fix: replace unsupported end-of-input assertion
Rupam0710 Sep 8, 2026
11eb2c7
fix: finalize skill validator guardrails
Rupam0710 Sep 9, 2026
7cd34d9
fix: resolve final review comments
Rupam0710 Sep 9, 2026
f1f9173
fix: handle unreadable skill directories
Rupam0710 Sep 9, 2026
f277946
Merge branch 'main' into feat/skill-quality-validator
Rupam0710 Sep 19, 2026
e03e011
refactor: merge quality checks into validate-skills with rules-based …
Rupam0710 Sep 23, 2026
f71bddf
fix: resolve Greptile review feedback for skill-quality-validator
Rupam0710 Sep 23, 2026
bac0e47
fix: eliminate collection mutations in skill-quality-validator
Rupam0710 Sep 23, 2026
04036ae
fix: reduce credential detection minimum and eliminate collection mut…
Rupam0710 Sep 23, 2026
7c58b9c
fix: restore section boundary state in extractSectionBody to prevent …
Rupam0710 Sep 23, 2026
9378b64
test: add standalone validator regression coverage for untrusted CLI …
Rupam0710 Sep 23, 2026
f66454e
fix: unify skill quality validation rules
Rupam0710 Oct 2, 2026
b768cc7
Merge upstream/main into feat/skill-quality-validator
Rupam0710 Oct 2, 2026
412f898
fix: enforce skill quality checks on changed skills in CI
Rupam0710 Oct 3, 2026
75d9f79
fix: handle non-ASCII skill paths and push events in changed-skill qu…
Rupam0710 Oct 3, 2026
f8a71eb
fix: diff new-branch and force pushes against the default branch in s…
Rupam0710 Oct 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ jobs:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js
Expand All @@ -211,6 +212,32 @@ jobs:
run: node scripts/ci/validate-skills.js
continue-on-error: false

- name: Validate skill quality (changed skills)
env:
PR_BASE_REF: ${{ github.base_ref }}
PUSH_BEFORE_SHA: ${{ github.event.before }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
# Pull requests diff against their base branch. Pushes diff against the
# commit before the push; new branches (all-zero SHA) and force pushes
# (before SHA no longer in history) diff against the default branch so
# every commit on the branch is covered, not just the last one.
if [ -n "$PR_BASE_REF" ]; then
base="origin/$PR_BASE_REF"
elif [ -n "$PUSH_BEFORE_SHA" ] && [ -z "${PUSH_BEFORE_SHA//0/}" ]; then
base="origin/${DEFAULT_BRANCH:-main}"
elif [ -n "$PUSH_BEFORE_SHA" ] && git cat-file -e "$PUSH_BEFORE_SHA^{commit}" 2>/dev/null; then
base="$PUSH_BEFORE_SHA"
else
base="origin/${DEFAULT_BRANCH:-main}"
fi
git rev-parse --verify --quiet "$base^{commit}" >/dev/null || {
echo "ERROR: cannot resolve diff base '$base'" >&2
exit 1
}
node scripts/ci/validate-skill-quality.js --strict --changed "$base"
continue-on-error: false

- name: Validate install manifests
run: node scripts/ci/validate-install-manifests.js
continue-on-error: false
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/reusable-validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js
Expand All @@ -41,6 +42,31 @@ jobs:
- name: Validate skills
run: node scripts/ci/validate-skills.js

- name: Validate skill quality (changed skills)
env:
PR_BASE_REF: ${{ github.base_ref }}
PUSH_BEFORE_SHA: ${{ github.event.before }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
# Pull requests diff against their base branch. Pushes diff against the
# commit before the push; new branches (all-zero SHA) and force pushes
# (before SHA no longer in history) diff against the default branch so
# every commit on the branch is covered, not just the last one.
if [ -n "$PR_BASE_REF" ]; then
base="origin/$PR_BASE_REF"
elif [ -n "$PUSH_BEFORE_SHA" ] && [ -z "${PUSH_BEFORE_SHA//0/}" ]; then
base="origin/${DEFAULT_BRANCH:-main}"
elif [ -n "$PUSH_BEFORE_SHA" ] && git cat-file -e "$PUSH_BEFORE_SHA^{commit}" 2>/dev/null; then
base="$PUSH_BEFORE_SHA"
else
base="origin/${DEFAULT_BRANCH:-main}"
fi
git rev-parse --verify --quiet "$base^{commit}" >/dev/null || {
echo "ERROR: cannot resolve diff base '$base'" >&2
exit 1
}
node scripts/ci/validate-skill-quality.js --strict --changed "$base"

- name: Validate install manifests
run: node scripts/ci/validate-install-manifests.js

Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@
"scripts/catalog.js",
"scripts/ci/scan-supply-chain-iocs.js",
"scripts/ci/supply-chain-advisory-sources.js",
"scripts/ci/validate-skill-quality.js",
"scripts/ci/skill-quality-rules.js",
"scripts/consult.js",
"scripts/profile.js",
"scripts/auto-update.js",
Expand Down Expand Up @@ -499,6 +501,8 @@
"orchestrate:worker": "bash scripts/orchestrate-codex-worker.sh",
"orchestrate:tmux": "node scripts/orchestrate-worktrees.js",
"test": "node scripts/ci/check-unicode-safety.js && node scripts/ci/validate-agents.js && node scripts/ci/validate-commands.js && node scripts/ci/validate-rules.js && node scripts/ci/validate-skills.js && node scripts/ci/validate-hooks.js && node scripts/ci/check-hooks-schema-keys.js && node scripts/ci/validate-install-manifests.js && node scripts/ci/validate-context-profiles.js && node scripts/ci/validate-no-personal-paths.js && npm run catalog:check && npm run command-registry:check && node tests/run-all.js",
"validate:skill-quality": "node scripts/ci/validate-skill-quality.js",
"validate:skill-quality:changed": "node scripts/ci/validate-skill-quality.js --strict --changed origin/main",
"coverage": "c8 --all --include=\"scripts/**/*.js\" --include=\"scripts/**/*.mjs\" --check-coverage --lines 80 --functions 80 --branches 79 --statements 80 --reporter=text --reporter=lcov node tests/run-all.js",
"build:opencode": "node scripts/build-opencode.js",
"prepack": "npm run build:opencode",
Expand Down
122 changes: 122 additions & 0 deletions scripts/ci/skill-quality-rules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
'use strict';

const REQUIRED_SECTIONS = [
'When to Activate',
'Core Concepts',
'Examples',
'Anti-Patterns',
'Best Practices',
];

const SECRET_PATTERNS = [
{
regex: /(?:api[_-]?key|token|secret|passwd|password|access[_-]?key)\s*[:=]\s*["']([A-Za-z0-9_\-:/.!@#$%^&*()=+[\]{}|;'<>?,~]{8,})["']/gi,
},
{
regex: /(?:api[_-]?key|token|secret|passwd|password|access[_-]?key)\s*[:=]\s*([A-Za-z0-9][A-Za-z0-9_-]{11,})(?![A-Za-z0-9_(])/gi,
accept: (match) => /\d/.test(match[1]) || match[1].length >= 24,
},
{ regex: /sk_(?:live|test)_[A-Za-z0-9]{32,}/g },
{ regex: /ghp_[A-Za-z0-9]{20,}(?![a-z])/g },
{ regex: /xox[baprs]-[A-Za-z0-9-]{32,}/g },
];

const QUALITY_RULES = [
{
name: 'required-sections',
description: 'Skill must contain all required sections',
check(content, label) {
const lines = content.split(/\r?\n/);

return REQUIRED_SECTIONS.flatMap((section) => {
const escapedSection = section.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const headingPattern = new RegExp(`^#{1,3}\\s*${escapedSection}\\s*$`, 'i');
if (lines.some((line) => headingPattern.test(line.trim()))) return [];

return [{
label,
line: 1,
severity: 'error',
message: `Missing required section: "${section}"`,
hint: `Add a level 2 heading "## ${section}" with content below it`,
}];
});
},
},
{
name: 'section-depth',
description: 'Each required section must have meaningful content (200+ chars)',
check(content, label, isStrict) {
if (!isStrict) return [];

const extractSectionBody = (markdown, sectionTitle) => {
const escapedTitle = sectionTitle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const headingPattern = new RegExp(`^#{1,3}\\s*${escapedTitle}\\s*$`, 'i');
const sectionHeadings = new Set(REQUIRED_SECTIONS.map((title) => title.toLowerCase()));
const lines = markdown.split(/\r?\n/);
let inTargetSection = false;
let sectionStartLine = -1;
let bodyLines = [];

for (let index = 0; index < lines.length; index += 1) {
const trimmed = lines[index].trim();
if (!inTargetSection) {
if (headingPattern.test(trimmed)) {
inTargetSection = true;
sectionStartLine = index;
}
continue;
}

const nextHeading = trimmed.match(/^#{1,3}\s*(.+?)\s*$/);
if (nextHeading && sectionHeadings.has(nextHeading[1].trim().toLowerCase())) break;
bodyLines = [...bodyLines, lines[index]];
}

return { body: bodyLines.join('\n').trim(), startLine: sectionStartLine };
};

return REQUIRED_SECTIONS.flatMap((section) => {
const { body, startLine } = extractSectionBody(content, section);
const normalized = body.replace(/[`*_~>#\-\s]/g, '').toLowerCase();
const isEmpty = !normalized || ['todo', 'tbd', 'n/a', 'na', 'placeholder'].includes(normalized);
if (!isEmpty && body.length >= 200) return [];

return [{
label,
line: startLine + 2,
severity: 'error',
message: `Section "${section}" is ${isEmpty ? 'empty or placeholder-only' : 'too short'} (${body.length} chars)`,
hint: `Expand "${section}" with meaningful content (aim for 200+ characters describing practical use and patterns)`,
}];
});
},
},
{
name: 'secret-patterns',
description: 'Detect hardcoded API keys, tokens, and credentials',
check(content, label) {
return content.split(/\r?\n/).flatMap((line, index) => {
const matchCount = SECRET_PATTERNS.reduce((count, { regex, accept }) => {
const matches = [...line.matchAll(regex)];
return count + matches.filter((match) => !accept || accept(match)).length;
}, 0);
if (matchCount === 0) return [];

return [{
label,
line: index + 1,
severity: 'error',
message: `Detected ${matchCount} secret-like pattern(s) (API key, token, etc.)`,
hint: `Replace credentials with a placeholder such as '<YOUR_API_KEY>'`,
}];
});
},
},
];

function checkQualityRules(content, label, isStrict) {
return QUALITY_RULES.flatMap((rule) => rule.check(content, label, isStrict));
}

module.exports = { QUALITY_RULES, checkQualityRules };
Loading