Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.
Python agent-evaluationagent-pluginsagent-securityagent-skillsagentic-aibenchmarkci-templatesclaude-codecodexevaluateevaluationharnesspluginplugin-evaluationsecurity-scannerskill-evalskill-evaluationskill-evaluatorskill-gap-analysisskills
fix(cli): validate the folder of a SKILL.md or workflow-rules.mdc argument (#556)
Narendran Raghavan602cbc090b05
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex bd0329c1..b8a635b7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1041,6 +1041,17 @@ All notable changes to SkillEvaluator are documented in this file.rejecting a symlink (even a broken one), a hard link, a FIFO, a file over4 MiB or a symlinked `evals/` directory, and a YAML error no longer repeatsthe source line.+- `validate path/to/SKILL.md` and `validate path/to/workflow-rules.mdc` now+ validate the folder that holds the file, as passing the folder does, so a+ file inside a symlinked folder is now refused unless `--no-dedup` is passed,+ as that folder is. Before, Tier 1 and Tier 2 received the file itself:+ `schema`, `version` and `quality` failed with `No skills found` for a skill,+ and `schema` with `No workflow directories found` for a workflow; a run+ narrowed with `--checks` could pass without scanning the skill's other files;+ and a run from inside the skill wrote its reports into it. Tier 3 also+ received a `workflow-rules.mdc` file itself; it now receives the workflow+ folder, as it already did for a `SKILL.md`. With `--no-dedup`, this also holds+ when the file is a symlink to a file with another name.## 0.9.0 - 2026-11-13diff --git a/src/skillevaluator/cli.py b/src/skillevaluator/cli.pyindex ddb19d70..442ec06d 100644--- a/src/skillevaluator/cli.py+++ b/src/skillevaluator/cli.py@@ -2582,6 +2582,7 @@ def validate(skill-only and skipped for plugins."""_record_validate_json_report(None)+ requested_path = target_pathif harness:from skillevaluator.harness import load_profiles@@ -2610,6 +2611,8 @@ def validate(CONTENT_TYPE_RULES,CONTENT_TYPE_SKILL,CONTENT_TYPE_WORKFLOWS,+ SKILL_MANIFEST_FILE,+ WORKFLOWS_MANIFEST_FILE,)from skillevaluator.reporting import CLIReporterfrom skillevaluator.reporting.naming import REPORT_PREFIX@@ -2627,10 +2630,29 @@ def validate(block_on_dedup_effective = True if block_on_dedup is None else block_on_dedupblock_on_agent_eval_effective = False if block_on_agent_eval is None else block_on_agent_eval- resolved_type = content_type if content_type != "auto" else detect_content_type(target_path)+ # A file passed as SKILL.md or workflow-rules.mdc is a manifest by the name it was passed+ # under. Auto-detection must not read the file a link points to: SKILL.md may be a link+ # to shared/guide.md, which names no content type.+ manifest_type = None+ if target_path.is_file():+ if requested_path.name.upper() == SKILL_MANIFEST_FILE.upper():+ manifest_type = CONTENT_TYPE_SKILL+ elif requested_path.name == WORKFLOWS_MANIFEST_FILE:+ manifest_type = CONTENT_TYPE_WORKFLOWS+ resolved_type = content_type if content_type != "auto" else manifest_type or detect_content_type(target_path)# Only skills own an evals/ task source. Plugins, rules, and workflows can# still run Tier 3, but must bypass the skill-directory source preflight.preflight_tier3_source = resolved_type == CONTENT_TYPE_SKILL+ # A SKILL.md or workflow-rules.mdc argument stands for its folder, as a SKILL.md already+ # does for Tier 3, so every tier, the report names, and the default report location+ # match the directory form. Take the folder from the path as given: resolving first+ # would move a linked manifest to the folder its link points into. That folder is+ # now the Tier 2 root, so refuse a linked one as the directory form does.+ if manifest_type is not None and resolved_type == manifest_type:+ if dedup:+ _reject_linked_tier2_root(requested_path.absolute().parent)+ target_path = requested_path.absolute().parent.resolve()+ publication_name = publication_target_name(target_path) or target_path.name# Skill validation is the complete workflow. Keep the old flags as aliases,# while explicit disable flags and the authoritative --tiers selector stilldiff --git a/tests/cli/test_validate_defaults.py b/tests/cli/test_validate_defaults.pyindex d953691f..6ed0809a 100644--- a/tests/cli/test_validate_defaults.py+++ b/tests/cli/test_validate_defaults.py@@ -92,8 +92,9 @@ def test_default_autopilot_receives_skill_directory_for_file_input(monkeypatch,marker = skill / "SKILL.md"marker.write_text("---\nname: file-input\ndescription: Test skill\n---\n")calls = []- monkeypatch.setattr(cli_module, "run_validation", lambda *_a, **_kw: [])- monkeypatch.setattr(cli_module, "_run_dedup_or_skip", lambda *_a, **_kw: [])+ # Every tier receives the skill directory, not the SKILL.md argument.+ monkeypatch.setattr(cli_module, "run_validation", lambda path, **_kw: calls.append(path) or [])+ monkeypatch.setattr(cli_module, "_run_dedup_or_skip", lambda path: calls.append(path) or [])monkeypatch.setattr(cli_module, "_ensure_autopilot_dataset", lambda path, **_kw: calls.append(path))def evaluate(path, **kwargs):@@ -113,7 +114,7 @@ def test_default_autopilot_receives_skill_directory_for_file_input(monkeypatch,cli_module.cli, ["validate", str(marker), "-r", "json", "-o", str(tmp_path / "reports")])assert result.exit_code == 0, result.output- assert calls == [skill, skill]+ assert calls == [skill, skill, skill, skill]report = json.loads(next((tmp_path / "reports").glob("*.json")).read_text())assert report["tier3_applicability"]["source_kind"] == "native_harbor"diff --git a/tests/cli/test_validate_manifest_file.py b/tests/cli/test_validate_manifest_file.pynew file mode 100644index 00000000..a8b4369d--- /dev/null+++ b/tests/cli/test_validate_manifest_file.py@@ -0,0 +1,296 @@+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.+# SPDX-License-Identifier: Apache-2.0++"""``validate`` treats a SKILL.md or workflow-rules.mdc argument as the folder that holds it."""++from __future__ import annotations++import json+import shutil+from pathlib import Path++import pytest+from click.testing import CliRunner++from skillevaluator import cli as cli_module+from skillevaluator.models.result import ValidationResult++FIXTURE = Path(__file__).parents[1] / "fixtures" / "skills" / "simple"++[email protected](autouse=True)+def _default_policy(monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.delenv("SKILLEVALUATOR_PROFILE", raising=False)+ monkeypatch.delenv("SKILLEVALUATOR_PREVIOUS_VERSION", raising=False)+++def _validate(target: Path, output: Path, *args: str) -> tuple[int, dict]:+ result = CliRunner().invoke(+ cli_module.cli,+ ["validate", str(target), "--tiers", "1", "--no-llm", "-r", "json", "-o", str(output), *args],+ )+ report = json.loads(next(output.glob("*.json")).read_text(encoding="utf-8"))+ report.pop("generated_at")+ return result.exit_code, report+++def _skill_names(report: dict) -> list[str]:+ return [skill["name"] for skill in report["skills"]]+++def test_skill_manifest_file_validates_like_its_folder(tmp_path: Path) -> None:+ skill = tmp_path / "simple"+ shutil.copytree(FIXTURE, skill)+ checks = ("--checks", "schema,version,quality")++ folder = _validate(skill, tmp_path / "folder-reports", *checks)+ manifest = _validate(skill / "SKILL.md", tmp_path / "manifest-reports", *checks)++ assert folder[0] == 0+ assert manifest == folder+ assert _skill_names(manifest[1]) == ["simple"]+ assert {result["publication_target"]["skill_name"] for result in manifest[1]["results"]} == {"simple"}+++def test_lowercase_skill_manifest_file_validates_like_its_folder(tmp_path: Path) -> None:+ # Rename the manifest itself, so the lowercase name is what the folder holds on any filesystem.+ skill = tmp_path / "simple"+ shutil.copytree(FIXTURE, skill)+ (skill / "SKILL.md").rename(skill / "skill.md")+ checks = ("--checks", "schema,version,quality")++ folder = _validate(skill, tmp_path / "folder-reports", *checks)+ manifest = _validate(skill / "skill.md", tmp_path / "manifest-reports", *checks)++ assert manifest == folder+ assert _skill_names(manifest[1]) == ["simple"]+++def test_skill_manifest_file_scans_the_whole_skill(tmp_path: Path) -> None:+ # Only the bundled script carries hidden characters, so a scan of SKILL.md alone would pass.+ skill = tmp_path / "simple"+ shutil.copytree(FIXTURE, skill)+ script = skill / "scripts" / "summarize.py"+ hidden = "".join(chr(0xE0000 + ord(char)) for char in "hidden")+ script.write_text(script.read_text(encoding="utf-8") + f"# note{hidden}\n", encoding="utf-8")++ folder = _validate(skill, tmp_path / "folder-reports", "--checks", "unicode")+ manifest = _validate(skill / "SKILL.md", tmp_path / "manifest-reports", "--checks", "unicode")++ assert folder[0] == 1+ assert manifest == folder+++def test_workflow_manifest_file_validates_like_its_folder(tmp_path: Path, sample_workflow_dir: Path) -> None:+ folder = _validate(sample_workflow_dir, tmp_path / "folder-reports", "--checks", "schema")+ manifest = _validate(+ sample_workflow_dir / "workflow-rules.mdc", tmp_path / "manifest-reports", "--checks", "schema"+ )++ assert folder[0] == 0+ assert manifest == folder+++def test_workflow_manifest_file_sends_its_folder_to_tier3(+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path, sample_workflow_dir: Path+) -> None:+ seen = []+ monkeypatch.setattr(cli_module, "run_validation", lambda path, **_kw: seen.append(("tier1", path)) or [])++ def evaluate(path, **_kwargs):+ seen.append(("tier3", path))+ result = ValidationResult(validator_name="AGENT_EVAL")+ result.metadata["agent_eval"] = {"agents": {}}+ return result++ monkeypatch.setattr(cli_module, "_run_agent_eval_or_skip", evaluate)++ manifest = sample_workflow_dir / "workflow-rules.mdc"+ result = CliRunner().invoke(+ cli_module.cli, ["validate", str(manifest), "--tiers", "1,3", "-o", str(tmp_path / "reports")]+ )++ assert result.exit_code == 0, result.output+ assert seen == [("tier1", sample_workflow_dir.resolve()), ("tier3", sample_workflow_dir.resolve())]+++def test_linked_skill_manifest_validates_the_folder_holding_the_link(tmp_path: Path) -> None:+ skill = tmp_path / "simple"+ shutil.copytree(FIXTURE, skill)+ linked = tmp_path / "linked"+ linked.mkdir()+ try:+ (linked / "SKILL.md").symlink_to(skill / "SKILL.md")+ except (OSError, NotImplementedError) as exc:+ pytest.skip(f"symlinks are unavailable: {exc}")+ # The Tier 2 guard refuses a linked argument before any mapping, so leave Tier 2 out.+ args = ("--no-dedup", "--checks", "schema")++ folder = _validate(linked, tmp_path / "folder-reports", *args)+ manifest = _validate(linked / "SKILL.md", tmp_path / "manifest-reports", *args)++ assert manifest == folder+ assert _skill_names(manifest[1]) == ["linked"]+++def _link_manifest_to_another_name(manifest: Path, shared: Path, name: str) -> None:+ """Move *manifest*'s content to ``shared/name`` and leave a link under the manifest's own name."""+ shared.mkdir()+ manifest.replace(shared / name)+ try:+ manifest.symlink_to(shared / name)+ except (OSError, NotImplementedError) as exc:+ pytest.skip(f"symlinks are unavailable: {exc}")++[email protected]("manifest_name", ["SKILL.md", "skill.md"])[email protected]("type_args", [(), ("--type", "skill")], ids=["auto-type", "skill-type"])+def test_skill_manifest_linked_to_a_file_with_another_name_scans_the_whole_skill(+ tmp_path: Path, manifest_name: str, type_args: tuple[str, ...]+) -> None:+ # The link points at shared/guide.md, so the content type cannot be read from the file it resolves to.+ skill = tmp_path / "simple"+ shutil.copytree(FIXTURE, skill)+ _link_manifest_to_another_name(skill / "SKILL.md", tmp_path / "shared", "guide.md")+ if manifest_name != "SKILL.md":+ (skill / "SKILL.md").rename(skill / manifest_name)+ script = skill / "scripts" / "summarize.py"+ hidden = "".join(chr(0xE0000 + ord(char)) for char in "hidden")+ script.write_text(script.read_text(encoding="utf-8") + f"# note{hidden}\n", encoding="utf-8")+ args = ("--no-dedup", "--checks", "unicode", *type_args)++ folder = _validate(skill, tmp_path / "folder-reports", *args)+ manifest = _validate(skill / manifest_name, tmp_path / "manifest-reports", *args)++ assert folder[0] == 1+ assert manifest == folder+++def test_skill_manifest_linked_to_a_file_with_another_name_is_refused_without_no_dedup(+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path+) -> None:+ skill = tmp_path / "simple"+ shutil.copytree(FIXTURE, skill)+ _link_manifest_to_another_name(skill / "SKILL.md", tmp_path / "shared", "guide.md")++ def must_not_run(*_args, **_kwargs):+ raise AssertionError("Validation must not receive a linked manifest unless --no-dedup is passed")++ monkeypatch.setattr(cli_module, "run_validation", must_not_run)++ result = CliRunner().invoke(cli_module.cli, ["validate", str(skill / "SKILL.md"), "--tiers", "1"])++ assert result.exit_code == 2, result.output+ assert "symlink or reparse point: SKILL.md" in result.output+++def test_workflow_manifest_linked_to_a_file_with_another_name_validates_the_folder(+ tmp_path: Path, sample_workflow_dir: Path+) -> None:+ # The link points at shared/rules.mdc, which reads as a rules file, not as a workflow manifest.+ _link_manifest_to_another_name(sample_workflow_dir / "workflow-rules.mdc", tmp_path / "shared", "rules.mdc")+ args = ("--no-dedup", "--checks", "schema")++ folder = _validate(sample_workflow_dir, tmp_path / "folder-reports", *args)+ manifest = _validate(sample_workflow_dir / "workflow-rules.mdc", tmp_path / "manifest-reports", *args)++ assert folder[0] == 0+ assert manifest == folder++[email protected]("tiers", [(), ("--tiers", "1")], ids=["default-tiers", "tier1-only"])+def test_manifest_in_linked_skill_folder_is_refused_like_the_folder(+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path, tiers: tuple[str, ...]+) -> None:+ target = tmp_path / "real-skill"+ target.mkdir()+ (target / "SKILL.md").write_text("---\nname: sample\ndescription: Sample skill\n---\n", encoding="utf-8")+ linked_target = tmp_path / "linked-skill"+ try:+ linked_target.symlink_to(target, target_is_directory=True)+ except (OSError, NotImplementedError) as exc:+ pytest.skip(f"Directory symlinks are unavailable: {exc}")++ def must_not_run(*_args, **_kwargs):+ raise AssertionError("Validation must not receive a linked root unless --no-dedup is passed")++ monkeypatch.setattr(cli_module, "run_validation", must_not_run)++ # The guard runs before --tiers narrows the run, so --tiers 1 alone does not skip it.+ for argument in (linked_target, linked_target / "SKILL.md"):+ result = CliRunner().invoke(cli_module.cli, ["validate", str(argument), *tiers])++ assert result.exit_code == 2, result.output+ assert "symlink or reparse point: linked-skill" in result.output+ assert str(target) not in result.output+++def test_manifest_in_linked_skill_folder_validates_like_the_folder_with_no_dedup(tmp_path: Path) -> None:+ skill = tmp_path / "simple"+ shutil.copytree(FIXTURE, skill)+ linked = tmp_path / "linked"+ try:+ linked.symlink_to(skill, target_is_directory=True)+ except (OSError, NotImplementedError) as exc:+ pytest.skip(f"Directory symlinks are unavailable: {exc}")+ args = ("--no-dedup", "--checks", "schema")++ folder = _validate(linked, tmp_path / "folder-reports", *args)+ manifest = _validate(linked / "SKILL.md", tmp_path / "manifest-reports", *args)++ assert folder[0] == 0+ assert manifest == folder+++def test_skill_manifest_file_keeps_default_reports_outside_the_skill(+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path+) -> None:+ skill = tmp_path / "simple"+ shutil.copytree(FIXTURE, skill)+ monkeypatch.chdir(skill)++ result = CliRunner().invoke(+ cli_module.cli, ["validate", "SKILL.md", "--tiers", "1", "--no-llm", "--checks", "schema", "-r", "json"]+ )++ assert result.exit_code == 0, result.output+ assert (tmp_path / "simple-reports" / "BENCHMARK.md").is_file()+ assert not (skill / "reports").exists()+++def test_skill_manifest_file_refuses_an_output_dir_inside_the_skill(+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path+) -> None:+ skill = tmp_path / "simple"+ shutil.copytree(FIXTURE, skill)+ monkeypatch.chdir(skill)+ args = ("--tiers", "1", "--no-llm", "--checks", "schema", "-r", "json", "-o", "out")+ message = "Report output must be outside the publication target; use an external --output-dir: out"++ folder = CliRunner().invoke(cli_module.cli, ["validate", ".", *args])+ manifest = CliRunner().invoke(cli_module.cli, ["validate", "SKILL.md", *args])++ assert folder.exit_code == 1, folder.output+ assert message in folder.output+ assert manifest.exit_code == folder.exit_code, manifest.output+ assert message in manifest.output+ assert not (skill / "out").exists()+++def test_other_file_in_a_skill_is_validated_as_given(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:+ skill = tmp_path / "skills" / "demo"+ script = skill / "scripts" / "run.py"+ script.parent.mkdir(parents=True)+ script.write_text("print('ok')\n", encoding="utf-8")+ (skill / "SKILL.md").write_text("---\nname: demo\ndescription: Demo skill\n---\n", encoding="utf-8")+ seen = []+ monkeypatch.setattr(+ cli_module, "run_validation", lambda path, **kwargs: seen.append((path, kwargs["content_type"])) or []+ )++ result = CliRunner().invoke(+ cli_module.cli, ["validate", str(script), "--tiers", "1", "-o", str(tmp_path / "reports")]+ )++ assert result.exit_code == 0, result.output+ assert seen == [(script.resolve(), "skill")]