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(tier1): make author and metadata.id requirements profile-controlled (#499)
Narendran Raghavanbe88fa81db55
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8807e85c..bbfb8107 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -81,6 +81,32 @@ All notable changes to SkillEvaluator are documented in this file.### Changed+- The `default` policy no longer blocks a skill for its author attribution,+ because the Agent Skills baseline requires only `name` and `description`+ (#43). A missing `metadata.author` is now a LOW advisory, and a person, team,+ or organization name without an email (such as `NVIDIA cuOpt Team` or+ `Jane Doe (@jdoe)`) passes as an INFO `SCHEMA.author_without_email` finding.+ A malformed or unsafe value still fails `SCHEMA.author_format` at HIGH: a bare+ email or an email outside `Name <email@host>`, stray angle brackets, control+ or invisible formatting characters, no letters or digits, or more than 256+ characters. A policy with an `author_email_regex` still needs an email in+ that domain. Overlays on `default` that relied on the old HIGH author+ severities should set `SCHEMA.author_missing: high` and+ `SCHEMA.author_without_email: high`, or use `--profile registry`. The policy+ digest changes for every profile because it now includes+ `metadata_id_requirement`.+- Add the bundled `registry` profile (`--profile registry`) for registries with+ a publication contract. It requires `metadata.author` in+ `Name <email@host>` form and a valid `metadata.id`.+- Validate an optional `metadata.id` as an exact 1-64 character lowercase+ ASCII slug. A policy sets `identity.metadata_id_requirement` to `ignore`+ (the default), `recommend`, or `require`; an unknown value is an error. A+ collection run reports an ID declared by more than one skill, and `validate`+ on a catalog lists these in `catalog-summary.json` under+ `metadata_id_conflicts` (each sharing skill fails under `require`). Invalid and+ duplicate IDs are MEDIUM advisories unless the requirement is `require`, and+ the ID does not change local catalog identity. JSON reports include the+ active requirement under `policy.metadata_id_requirement`.- Install Bandit with the base package, so `pip install skillevaluator` or`uv tool install skillevaluator` runs every default Tier 1 check without anextra. pip-audit, used only by the opt-in dependency audit@@ -120,6 +146,10 @@ All notable changes to SkillEvaluator are documented in this file.### Fixed+- Folder validation preserves author and metadata ID advisories from passing+ skills. Catalog summaries include duplicate ID severity counts and consistent+ member verdicts, while explicitly labeling linked reports as single-skill+ results and retaining their independent verdicts.- Behavior checks no longer score a final answer that the evidence limitsshortened. The final-response allowance rises from 800 to 8,000 characters,with the total behavior evidence budget reconciled to 12,000, so an ordinarydiff --git a/docs/cli-reference.mdx b/docs/cli-reference.mdxindex 1bc9142d..819f405b 100644--- a/docs/cli-reference.mdx+++ b/docs/cli-reference.mdx@@ -152,7 +152,7 @@ errors, such as an option the workflow does not accept, exit `2`.| `--min-score INTEGER` | `70` | Minimum passing quality and rubric score, from 0 to 100; quality severity overrides cannot waive the minimum || `--quality-config PATH` | packaged `quality-default.yaml` | YAML file that adjusts the quality check's expected headings and error-handling rules; settings it omits keep their packaged values. See [Tier 1: Validation](/skills/skillevaluator/tier1-validation#the-checks). || `--pii-waivers PATH` | none | Reviewed, expiring PII waivers applied by the `pii` check. See [PII waivers](/skills/skillevaluator/tier1-validation#pii-waivers). |-| `--profile TEXT` | `SKILLEVALUATOR_PROFILE`, then `default` | Validation policy; `external` is a compatibility alias |+| `--profile TEXT` | `SKILLEVALUATOR_PROFILE`, then `default` | Validation policy: `default` or `registry`. `external` is a compatibility alias for `default`. || `--policy FILE` | none | Explicit policy overlay, including reviewed ownership-contact severity. See [Tier 1 policies](tier1-validation.mdx#validation-profiles-and-policies). || `--previous-version TEXT` | `SKILLEVALUATOR_PREVIOUS_VERSION`, else unset | Previous version for version checks || `--skillspector-baseline FILE` | unset | Audited SkillSpector suppression baseline; never discovered from the skill. See [Audited SkillSpector baselines](/skills/skillevaluator/tier1-validation#audited-skillspector-baselines). |@@ -277,7 +277,7 @@ Applies to the whole run: target typing, policy profile, reports, tier selection| `--tiers TEXT` | all three for skills | Explicit tier selection, e.g. `--tiers 1,2` skips live evaluation and `--tiers 1,3` skips dedup. Tier 1 always runs. || `--full` | unnecessary for skills | Compatibility flag for all three tiers with autopilot. Explicit tier selection and disable flags still apply. || `--verbose` | off | Print the full per-check detail stream instead of the compact pipeline view. |-| `--profile TEXT` | `$SKILLEVALUATOR_PROFILE`, then `default` | Bundled validation policy. `external` is a compatibility alias for `default`. |+| `--profile TEXT` | `$SKILLEVALUATOR_PROFILE`, then `default` | Bundled validation policy: `default` or `registry`. `external` is a compatibility alias for `default`. || `--external` | — | Compatibility alias for `--profile default`; does not change repository visibility. || `--policy FILE` | none | Custom policy YAML overlaid on top of `--profile`. || `--workers INTEGER RANGE` | `1` | Concurrent skill jobs when validating a folder of skills (`x>=1`). Values above 1 run skills in parallel processes and disable the per-skill pipeline view. |diff --git a/docs/environment-variables.mdx b/docs/environment-variables.mdxindex f8078965..277645e4 100644--- a/docs/environment-variables.mdx+++ b/docs/environment-variables.mdx@@ -131,7 +131,7 @@ These variables tune the static and security checks. The check-by-check guide is| Variable | Default | Effect || --- | --- | --- |-| `SKILLEVALUATOR_PROFILE` | `default` | Validation policy when no `--profile` flag is passed. `external` remains a compatibility alias. The CLI flag always wins. |+| `SKILLEVALUATOR_PROFILE` | `default` | Validation policy when no `--profile` flag is passed: `default` or `registry`. `external` remains a compatibility alias for `default`. The CLI flag always wins. || `SKILLEVALUATOR_BANDIT_PATH` | auto-discovered | Absolute path to the Bandit executable. || `SKILLEVALUATOR_SEMGREP_PATH` | auto-discovered | Absolute path to the Semgrep executable. || `SKILLEVALUATOR_SKILLSPECTOR_PATH` | auto-discovered | Absolute path to the SkillSpector executable. |diff --git a/docs/github-actions.mdx b/docs/github-actions.mdxindex f1769671..4796fe58 100644--- a/docs/github-actions.mdx+++ b/docs/github-actions.mdx@@ -108,10 +108,10 @@ required security or schema check.with existing images.</Accordion><Accordion title="Why is an author email reported as PII?">- The required `metadata.author` attribution is accepted. Extra copies in- contact fields, body text, or reference documents are checked separately.- Keep the author field and use a handle or contact-directory link for extra- contact information. See [author attribution and approved exceptions](/skills/skillevaluator/tier1-validation#author-attribution-and-contact-emails).+ The `metadata.author` attribution is accepted. Extra copies in contact+ fields, body text, or reference documents are checked separately. Keep the+ author field and use a handle or contact-directory link for extra contact+ information. See [author attribution and approved exceptions](/skills/skillevaluator/tier1-validation#author-attribution-and-contact-emails).</Accordion><Accordion title="Use reviewed security baselines">This requires a workflow and image version that include baseline support;diff --git a/docs/gitlab-ci.mdx b/docs/gitlab-ci.mdxindex 89bb9d18..ce3745ac 100644--- a/docs/gitlab-ci.mdx+++ b/docs/gitlab-ci.mdx@@ -105,7 +105,7 @@ Skill result: "skills/glossary-builder" — FAILED<AccordionGroup><Accordion title="Author emails and reviewed security exceptions">- Keep the required `metadata.author` attribution. Extra email copies in+ Keep the `metadata.author` attribution. Extra email copies incontact fields or documents are checked separately; use a handle or acontact-directory link instead. See [author attribution](/skills/skillevaluator/tier1-validation#author-attribution-and-contact-emails).diff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdxindex c250ab6c..f8a241b8 100644--- a/docs/tier1-validation.mdx+++ b/docs/tier1-validation.mdx@@ -144,36 +144,63 @@ skillevaluator validate ./skills --type skill --continue-on-failure## Validation profiles and policies-The bundled `default` policy applies to both public and private repositories.-It requires a well-formed `metadata.author` value but does not restrict the email-domain. Missing or malformed author attribution is HIGH severity. Blocked license-findings are CRITICAL; missing or unknown licenses are reported for review.-The policy controls validation rules, not repository visibility or report hosting.-The old `external` name and `--external` flag remain compatibility aliases for-this same policy; there is no separate bundled `internal` policy.+Two policies are bundled. Both report malformed or unsafe author values and+blocked licenses (CRITICAL); they differ in which governance metadata a skill must carry.++| | `default` | `registry` |+| --- | --- | --- |+| Use it for | Public and private repositories | Registries with a documented publication contract |+| `metadata.author` missing | LOW (advisory) | HIGH (blocks) |+| Author is a name without an email, such as `NVIDIA cuOpt Team` | INFO | HIGH |+| Author is malformed or unsafe | HIGH | HIGH |+| `metadata.id` missing | Not reported | HIGH |+| `metadata.id` invalid, or duplicated in a collection | MEDIUM (advisory) | HIGH |++The Agent Skills baseline requires only `name` and `description`, so the+`default` policy treats author attribution and a stable ID as recommendations.+Neither policy restricts the author email domain. A policy controls validation+rules, not repository visibility or report hosting. The old `external` name and+`--external` flag remain compatibility aliases for `default`; there is no+separate bundled `internal` policy.```bash title="Profile selection"skillevaluator validate ./my-skill # default policyskillevaluator validate ./my-skill --profile default # explicit default policy-skillevaluator validate ./my-skill --external # compatibility alias-skillevaluator validate ./my-skill --policy ./policy.yaml # custom overlay-SKILLEVALUATOR_PROFILE=default skillevaluator validate ./my-skill+skillevaluator validate ./my-skill --profile registry # registry publication contract+skillevaluator validate ./my-skill --external # compatibility alias for default+skillevaluator validate ./my-skill --policy ./policy.yaml # custom overlay on default+SKILLEVALUATOR_PROFILE=registry skillevaluator validate ./my-skill```Precedence, highest to lowest: `--policy` overlay, `--profile` flag, `SKILLEVALUATOR_PROFILE` environment variable, then the bundled `default` policy.<Accordion title="Write a custom policy overlay">- A custom policy overlays the default rules. It can narrow the accepted author domain and change severities by `CATEGORY.check_name` or `CATEGORY.*`:+ A custom policy overlays the `--profile` rules (`default` unless you choose+ another). It can narrow the accepted author domain, set the `metadata.id`+ requirement, and change severities by `CATEGORY.check_name` or `CATEGORY.*`:```yaml title="policy.yaml"profile: community-strictidentity:author_email_regex: '<[^>]+@example\.org>'+ metadata_id_requirement: recommend # ignore | recommend | requireseverity_overrides:SCHEMA.author_missing: criticalLICENSE.*: critical```+ An `author_email_regex` needs an email address in that domain, so under it a+ name without an email fails `SCHEMA.author_format`. An overlay that omits an+ `identity` key keeps the base profile's value. An unrecognized+ `metadata_id_requirement` value is an error, not a silent fallback.++ The author checks are `SCHEMA.author_missing`, `SCHEMA.author_without_email`,+ and `SCHEMA.author_format`. The ID checks are `SCHEMA.metadata_id_missing`,+ `SCHEMA.metadata_id_format`, and `SCHEMA.metadata_id_duplicate`. Their default+ severities follow `metadata_id_requirement`: a missing ID is LOW under+ `recommend` and HIGH under `require`; an invalid or duplicate ID is MEDIUM+ unless the requirement is `require`.+Severity overrides change how findings gate a run; they do not change thequality score or waive its `--min-score` requirement. Even an override of`QUALITY.*: info` leaves a below-minimum quality score failing.@@ -230,7 +257,8 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice- The standard hierarchy is `skills/<skill-name>/` or `team-skills/<team>/<skill-name>/`. A nonstandard standalone location is reported as an advisory finding.- Recognized skill-root subdirectories are `agents/`, `references/`, `scripts/`, `assets/`, `evals/`, `tests/`, `tools/`, and `config/`; anything else gets a LOW advisory finding. Extend the set per repository with `SKILLEVALUATOR_SCHEMA_ALLOWED_DIRS` (comma-separated names are added to the defaults, never replace them).- `SKILL.md` should stay at or below 500 lines; larger files receive an advisory finding.- - The default profile expects `metadata.author` in `Name <email@host>` form but does not require a particular email domain.+ - `metadata.author` is optional under the `default` profile. Use `Name <email@host>` to include a contact address, or a person, team, or organization name such as `NVIDIA cuOpt Team` or `Jane Doe (@jdoe)`. A value that is malformed or unsafe is a HIGH `author_format` finding: a bare email or an email outside `Name <email@host>`, stray angle brackets, control or invisible formatting characters, no letters or digits, or more than 256 characters. The `registry` profile requires the `Name <email@host>` form.+ - `metadata.id` is an optional stable skill ID. When present it must be an exact 1–64 character lowercase ASCII slug (`^[a-z0-9]+(-[a-z0-9]+)*$`, no surrounding whitespace); it may differ from `name`. A collection run reports an ID that more than one discovered skill declares; `validate` on a catalog also lists these in `catalog-summary.json` under `metadata_id_conflicts`, and under `registry` each skill that shares an ID fails. Uniqueness is checked only across the skills validated together, never against a registry, and a single-skill run does not claim it. The ID does not change local catalog identity, which stays keyed by content type and relative path.- `metadata.domain` accepts one category string or a list of them, such as `domain: [backend, ai-ml]`. Values are trimmed and deduplicated in order; a blank or null scalar means no domain. A list with more than 16 entries, or a non-string, blank, or over-128-character entry, is a HIGH `Field 'metadata.domain'` finding. The 128-character limit also applies to a single string.**To fix common findings:** rename the directory to match `name`, remove forbidden fields, and move the skill under `skills/`.@@ -621,10 +649,11 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice## Author attribution and contact emails-Keep the required `metadata.author: Name <email>` attribution in `SKILL.md`.-The PII check accepts that recognized author line. The same address in another-field, body text, or a reference document is a separate occurrence and can still-fail the check.+When `metadata.author` carries a contact, write it as `Name <email>` in+`SKILL.md`. The PII check accepts that recognized author line. The same address+in another field, body text, or a reference document is a separate occurrence+and can still fail the check. A team or organization name without an email is+also valid attribution under the `default` profile.Use a name, team handle, or contact-directory link for additional contactinformation. If a real address must remain, record a reviewed, time-limiteddiff --git a/src/skillevaluator/cli.py b/src/skillevaluator/cli.pyindex eaf804b5..4f92d98d 100644--- a/src/skillevaluator/cli.py+++ b/src/skillevaluator/cli.py@@ -62,6 +62,7 @@ from skillevaluator.tier1.commands import (run_rubric_eval,run_security_scan,run_validation,+ runs_schema_check,)from skillevaluator.tier3_environments import all_env_modesfrom skillevaluator.tier_group import TierGroup@@ -84,6 +85,7 @@ if TYPE_CHECKING:from collections.abc import Callablefrom skillevaluator.reporting.presentation import FinalRenderContext+ from skillevaluator.validators.policy import ValidationPolicyCONTEXT_SETTINGS = {"help_option_names": ["-h", "--help"]}@@ -1556,6 +1558,7 @@ def _catalog_skill_entry(return entryentry["json_report"] = json_report.name+ entry["report_scope"] = "single_skill"try:payload = json.loads(json_report.read_text(encoding="utf-8"))except (json.JSONDecodeError, OSError):@@ -1566,13 +1569,43 @@ def _catalog_skill_entry(for key in ("overall_passed", "overall_status", "incomplete_scans", "severity_counts"):if key in payload:entry[key] = payload[key]+ entry["report_verdict"] = {key: payload[key] for key in ("overall_passed", "overall_status") if key in payload}return entry-def _write_catalog_summary(output_dir: Path, skills: list[dict[str, object]]) -> Path:- """Write a machine-readable fleet rollup for catalog validation."""+def _catalog_entry_with_metadata_id_conflicts(+ skill: dict[str, object], conflicts: list[dict[str, object]]+) -> dict[str, object]:+ """Project catalog findings onto a member, retaining its independent report verdict."""+ entry = dict(skill)+ for conflict in conflicts:+ members = conflict.get("skills")+ if not isinstance(members, list) or entry.get("name") not in members:+ continue+ severity = conflict.get("severity")+ if severity in ("critical", "high", "medium", "low"):+ raw_counts = entry.get("severity_counts")+ counts = dict(raw_counts) if isinstance(raw_counts, dict) else {}+ previous = counts.get(severity, 0)+ counts[severity] = (previous if isinstance(previous, int) else 0) + 1+ entry["severity_counts"] = counts+ if conflict.get("blocking"):+ entry["passed"] = False+ entry["overall_passed"] = False+ entry["overall_status"] = "failed"+ return entry+++def _write_catalog_summary(+ output_dir: Path,+ skills: list[dict[str, object]],+ *,+ metadata_id_conflicts: list[dict[str, object]] | None = None,+) -> Path:+ """Write catalog-context verdicts and counts; linked leaf reports retain single-skill scope."""from skillevaluator.reporting.base import _write_report_atomically+ skills = [_catalog_entry_with_metadata_id_conflicts(skill, metadata_id_conflicts or []) for skill in skills]total = len(skills)passed = sum(1 for skill in skills if skill.get("passed"))failed = total - passed@@ -1600,6 +1633,7 @@ def _write_catalog_summary(output_dir: Path, skills: list[dict[str, object]]) ->"summary_path": CATALOG_SUMMARY_FILENAME,"severity_totals": severity_totals,"skills": skills,+ "metadata_id_conflicts": metadata_id_conflicts or [],"generated_at": datetime.now(tz=UTC).isoformat(),}output_path = output_dir / CATALOG_SUMMARY_FILENAME@@ -1608,6 +1642,82 @@ def _write_catalog_summary(output_dir: Path, skills: list[dict[str, object]]) ->return output_path+def _catalog_metadata_id_conflicts(+ policy: ValidationPolicy | None,+ skill_dirs: list[Path],+ catalog_root: Path,+ discovery_problems: dict[Path, str],+ *,+ schema_enabled: bool = True,+) -> tuple[list[dict[str, object]], list[tuple[str, str]]]:+ """Find ``metadata.id`` values shared by catalog skills.++ Catalog runs validate each skill on its own, so uniqueness across the+ catalog is checked here. Returns the conflicts for the catalog summary and,+ when the policy makes a duplicate blocking, one failure per affected skill.++ This is part of the schema check, so it runs only when that check is+ selected: ``--checks`` and ``--skip`` run exactly the checks they name.+ """+ from skillevaluator.validators.policy import default_policy++ if not schema_enabled:+ return [], []+ from skillevaluator.validators.schema import (+ declared_metadata_id,+ duplicate_metadata_ids,+ metadata_id_duplicate_severity,+ )++ policy = policy or default_policy()+ declared: dict[str, list[Path]] = {}+ for skill_dir in skill_dirs:+ if skill_dir in discovery_problems:+ continue+ metadata_id = declared_metadata_id(skill_dir)+ if metadata_id is not None:+ declared.setdefault(metadata_id, []).append(skill_dir)+ duplicates = duplicate_metadata_ids(declared, catalog_root)+ if not duplicates:+ return [], []+ severity = metadata_id_duplicate_severity(policy)+ blocking = severity.is_error()+ conflicts: list[dict[str, object]] = [+ {"metadata_id": value, "skills": skills, "severity": severity.value, "blocking": blocking}+ for value, skills in duplicates.items()+ ]+ failures: list[tuple[str, str]] = []+ if blocking:+ for value, skills in duplicates.items():+ for skill in skills:+ others = ", ".join(other for other in skills if other != skill)+ failures.append((skill, f"metadata.id '{value}' is also declared by {others}"))+ return conflicts, failures+++def _print_metadata_id_conflicts(conflicts: list[dict[str, object]]) -> None:+ """Show advisory (non-blocking) catalog ID conflicts under the scoreboard."""+ from rich.text import Text++ from skillevaluator.reporting.console_ui import MUTED, make_view_console++ console_ = make_view_console()+ for conflict in conflicts:+ skills = conflict.get("skills")+ if conflict.get("blocking") or not isinstance(skills, list):+ continue+ line = f"metadata.id '{conflict['metadata_id']}' is declared by {', '.join(map(str, skills))} (advisory)"+ console_.print(Text.assemble((" warning ", MUTED), (strip_terminal_controls(line), MUTED)))+++def _record_metadata_id_failures(+ failures: list[tuple[str, str]], id_failures: list[tuple[str, str]]+) -> list[tuple[str, str]]:+ """Add blocking ID conflicts to *failures*, keeping a skill's own failure reason first."""+ failed = {name for name, _reason in failures}+ return [*failures, *((name, reason) for name, reason in id_failures if name not in failed)]++def _validate_catalog(ctx: click.Context,*,@@ -1616,6 +1726,7 @@ def _validate_catalog(output_dir: Path,workers: int = 1,discovery_problems: dict[Path, str] | None = None,+ policy: ValidationPolicy | None = None,) -> None:"""Run the full validate pipeline once per skill in the catalog.@@ -1639,6 +1750,7 @@ def _validate_catalog(output_dir=output_dir,workers=workers,discovery_problems=discovery_problems,+ policy=policy,)return@@ -1677,6 +1789,14 @@ def _validate_catalog(ctx.meta.pop(meta_key, None)else:ctx.meta[meta_key] = previous_catalog_root+ id_conflicts, id_failures = _catalog_metadata_id_conflicts(+ policy,+ skill_dirs,+ resolved_target,+ discovery_problems,+ schema_enabled=runs_schema_check(ctx.params.get("checks"), ctx.params.get("skip")),+ )+ failures = _record_metadata_id_failures(failures, id_failures)failure_map = dict(failures)skill_entries = [_catalog_skill_entry(@@ -1688,8 +1808,9 @@ def _validate_catalog()for skill_name in (skill_dir.relative_to(resolved_target).as_posix() for skill_dir in skill_dirs)]- _write_catalog_summary(output_dir, skill_entries)+ _write_catalog_summary(output_dir, skill_entries, metadata_id_conflicts=id_conflicts)_print_catalog_summary(len(skill_dirs), failures, output_dir)+ _print_metadata_id_conflicts(id_conflicts)if failures:raise click.ClickException(f"{len(failures)}/{len(skill_dirs)} skills failed validation: "@@ -1705,6 +1826,7 @@ def _validate_catalog_parallel(output_dir: Path,workers: int,discovery_problems: dict[Path, str] | None = None,+ policy: ValidationPolicy | None = None,) -> None:"""Validate catalog skills concurrently in isolated child processes."""from skillevaluator.reporting.console_ui import make_view_console@@ -1742,6 +1864,14 @@ def _validate_catalog_parallel(if not passed:failures.append((skill_name, reason))+ id_conflicts, id_failures = _catalog_metadata_id_conflicts(+ policy,+ skill_dirs,+ catalog_root,+ discovery_problems,+ schema_enabled=runs_schema_check(ctx.params.get("checks"), ctx.params.get("skip")),+ )+ failures = _record_metadata_id_failures(failures, id_failures)failures.sort(key=lambda item: item[0])failure_map = dict(failures)skill_entries = [@@ -1754,8 +1884,9 @@ def _validate_catalog_parallel()for skill_name in (skill_dir.relative_to(catalog_root).as_posix() for skill_dir in skill_dirs)]- _write_catalog_summary(output_dir, skill_entries)+ _write_catalog_summary(output_dir, skill_entries, metadata_id_conflicts=id_conflicts)_print_catalog_summary(len(skill_dirs), failures, output_dir)+ _print_metadata_id_conflicts(id_conflicts)if failures:raise click.ClickException(f"{len(failures)}/{len(skill_dirs)} skills failed validation: "@@ -2029,7 +2160,10 @@ def _print_run_banner(target_path: Path, content_type: str, profile: str | None)default=None,cls=GroupedOption,help_group=_RUN_GROUP,- help="Validation policy: default (external is a compatibility alias). Default: $SKILLEVALUATOR_PROFILE, then default.",+ help=(+ "Validation policy: default or registry (external is a compatibility alias for default). "+ "Default: $SKILLEVALUATOR_PROFILE, then default."+ ),)@click.option("--external",@@ -2492,6 +2626,7 @@ def validate(output_dir=output_dir,workers=workers,discovery_problems=discovery_problems,+ policy=policy,)return@@ -3208,10 +3343,15 @@ def _workflow_report_options(func):)@click.option("--pii-waivers", type=PII_WAIVERS_PATH, default=None, help=_PII_WAIVERS_HELP)@click.option(- "--profile", default=None, help="Validation policy [default: default; external is a compatibility alias]."+ "--profile",+ default=None,+ help="Validation policy: default or registry [default: default; external is a compatibility alias].",)@click.option(- "--policy", "policy_path", type=click.Path(exists=True, dir_okay=False, path_type=Path), default=None,+ "--policy",+ "policy_path",+ type=click.Path(exists=True, dir_okay=False, path_type=Path),+ default=None,help="Custom policy YAML overlaid on top of --profile.",)@click.option("--previous-version", default=None, help="Previous version for version checks.")diff --git a/src/skillevaluator/config/pii_patterns.yaml b/src/skillevaluator/config/pii_patterns.yamlindex b4b24699..9258cac9 100644--- a/src/skillevaluator/config/pii_patterns.yaml+++ b/src/skillevaluator/config/pii_patterns.yaml@@ -58,7 +58,7 @@ emails:- pattern: '(?<![A-Za-z0-9._%+-])[A-Za-z0-9._%+-]+@(?!(?:[a-z0-9-]+\.)*(?:example\.(?:com|net|org)|test\.com|test|example|invalid|localhost)\.*(?![a-z0-9.-])|odata\.)[A-Za-z0-9.-]+\.[A-Za-z]{2,}'severity: highdescription: Non-placeholder email address- suggestion: "Keep required metadata.author attribution. Replace other contact addresses with a handle, a contact-directory link, or [email protected]; use a reviewed --pii-waivers entry if the address is required."+ suggestion: "Keep the metadata.author attribution. Replace other contact addresses with a handle, a contact-directory link, or [email protected]; use a reviewed --pii-waivers entry if the address is required."exceptions:# Third-party license attributions (copyright notices are legitimate)- "Copyright"diff --git a/src/skillevaluator/config/profiles/default.yaml b/src/skillevaluator/config/profiles/default.yamlindex adf140cb..5b3160e6 100644--- a/src/skillevaluator/config/profiles/default.yaml+++ b/src/skillevaluator/config/profiles/default.yaml@@ -6,17 +6,27 @@# Shared by public and private repositories. This policy governs finding# severity and author validation, not repository visibility or report hosting.# The CLI accepts "external" as a compatibility alias for this same policy.+#+# The Agent Skills baseline requires only `name` and `description`, so author+# attribution and a stable `metadata.id` are advisory here. Registries with a+# publication contract can use the bundled `registry` profile or an overlay.profile: defaultidentity:- # Disable domain restriction. The author shape (Name <email@host>) is- # still validated by the schema validator, independent of this regex.+ # Disable domain restriction. A present author value is still checked for a+ # well-formed shape, independent of this regex.author_email_regex: null+ # ignore | recommend | require. A present metadata.id is validated in every+ # mode; invalid or duplicate IDs block only under `require`.+ metadata_id_requirement: ignoreseverity_overrides:- # Schema / repository governance- SCHEMA.author_missing: high+ # Schema / repository governance. A missing author, or a person, team, or+ # organization name without an email address, is advisory. A malformed or+ # unsafe value (for example a bare email or stray angle brackets) blocks.+ SCHEMA.author_missing: low+ SCHEMA.author_without_email: infoSCHEMA.author_format: high# Workflowsdiff --git a/src/skillevaluator/config/profiles/registry.yaml b/src/skillevaluator/config/profiles/registry.yamlnew file mode 100644index 00000000..bfb1ffd7--- /dev/null+++ b/src/skillevaluator/config/profiles/registry.yaml@@ -0,0 +1,27 @@+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.+# SPDX-License-Identifier: Apache-2.0++# SkillEvaluator registry validation policy+#+# For registries with a documented publication contract: every skill needs a+# contact author in `Name <email@host>` form and a stable `metadata.id`.+# Select it with `--profile registry`, or overlay a custom policy on it with+# `--profile registry --policy PATH` (for example to restrict the email domain).++profile: registry++identity:+ author_email_regex: null+ # Missing, invalid, or duplicate metadata.id values block.+ metadata_id_requirement: require++severity_overrides:+ SCHEMA.author_missing: high+ SCHEMA.author_without_email: high+ SCHEMA.author_format: high++ # Workflows+ WORKFLOWS.author_format: high++ # License issues block publication.+ LICENSE.*: criticaldiff --git a/src/skillevaluator/models/skill.py b/src/skillevaluator/models/skill.pyindex f2b95ed7..5bc8ad5d 100644--- a/src/skillevaluator/models/skill.py+++ b/src/skillevaluator/models/skill.py@@ -43,10 +43,11 @@ class SkillMetadata(BaseModel):model_config = ConfigDict(extra="allow", str_strip_whitespace=True)- # Author field uses the portable Name <[email protected]> shape.+ # Optional attribution: 'Name <[email protected]>' or a person, team, or+ # organization name. The active validation policy decides whether it is required.author: str | None = Field(default=None,- description="Author name and email (e.g., 'Your Name <[email protected]>')",+ description="Author attribution (e.g., 'Your Name <[email protected]>' or 'Example Team')",)# Categorization fieldsdiff --git a/src/skillevaluator/tier1/commands.py b/src/skillevaluator/tier1/commands.pyindex 920450eb..3eb7658e 100644--- a/src/skillevaluator/tier1/commands.py+++ b/src/skillevaluator/tier1/commands.py@@ -248,6 +248,11 @@ def skipped_checks(skip: str | None) -> set[str]:return _parse_checks(skip)+def runs_schema_check(checks: str | None, skip: str | None) -> bool:+ """True when a run with these ``--checks``/``--skip`` values runs the schema check."""+ return "schema" in _enabled_checks(checks) and "schema" not in skipped_checks(skip)++def runs_secrets_scan(checks: str | None, skip: str | None) -> bool:"""True when a run with these ``--checks``/``--skip`` values executes the Gitleaks scan."""return "code-integrity" in _enabled_checks(checks) and not {"code-integrity", "secrets"} & skipped_checks(skip)diff --git a/src/skillevaluator/validators/policy.py b/src/skillevaluator/validators/policy.pyindex 4ff8d725..b6202576 100644--- a/src/skillevaluator/validators/policy.py+++ b/src/skillevaluator/validators/policy.py@@ -45,7 +45,12 @@ DEFAULT_PROFILE_NAME = "default"PROFILE_ENV_VAR = "SKILLEVALUATOR_PROFILE"# Stable, profile-agnostic email-shape pattern: "Name <local@domain>".-_AUTHOR_SHAPE_PATTERN = re.compile(r"\S[^<>\n]* <[^<>@\s]+@[^<>\s]+>")+AUTHOR_SHAPE_PATTERN = re.compile(r"\S[^<>\n]* <[^<>@\s]+@[^<>\s]+>")++#: Whether a profile ignores, recommends, or requires ``metadata.id``. A present+#: ID is validated in every mode; the mode decides only how absence is reported.+METADATA_ID_REQUIREMENTS = ("ignore", "recommend", "require")+DEFAULT_METADATA_ID_REQUIREMENT = "ignore"@dataclass(frozen=True)@@ -61,6 +66,10 @@ class ValidationPolicy:severity_overrides: Mapping ``"CATEGORY.check_name"`` or``"CATEGORY.*"`` -> :class:`Severity`. Overrides the defaultseverity that the validator would otherwise emit.+ metadata_id_requirement: ``ignore``, ``recommend`` or ``require``.+ Decides how a missing ``metadata.id`` is reported and the default+ severity of invalid or duplicate IDs (blocking only under+ ``require``).source: Path to the YAML file the policy was loaded from (fordiagnostics). ``None`` for programmatically constructed policies."""@@ -69,6 +78,7 @@ class ValidationPolicy:audience: str = "all"author_email_regex: re.Pattern[str] | None = Noneseverity_overrides: dict[str, Severity] = field(default_factory=dict)+ metadata_id_requirement: str = DEFAULT_METADATA_ID_REQUIREMENTsource: Path | None = None@property@@ -79,6 +89,7 @@ class ValidationPolicy:"audience": self.audience,"author_email_regex": self.author_email_regex.pattern if self.author_email_regex else None,"severity_overrides": {key: value.value for key, value in sorted(self.severity_overrides.items())},+ "metadata_id_requirement": self.metadata_id_requirement,}canonical = json.dumps(payload, sort_keys=True, separators=(",", ":")).encode()return f"sha256:{hashlib.sha256(canonical).hexdigest()}"@@ -86,7 +97,7 @@ class ValidationPolicy:@propertydef author_shape_regex(self) -> re.Pattern[str]:"""Profile-agnostic ``Name <email>`` shape pattern."""- return _AUTHOR_SHAPE_PATTERN+ return AUTHOR_SHAPE_PATTERNdef severity_for(self,@@ -120,6 +131,7 @@ class ValidationPolicy:"digest": self.digest,"author_email_regex": (self.author_email_regex.pattern if self.author_email_regex else None),"severity_overrides": {k: v.value for k, v in self.severity_overrides.items()},+ "metadata_id_requirement": self.metadata_id_requirement,"source": str(self.source) if self.source else None,}@@ -158,7 +170,23 @@ def _coerce_email_regex(value: Any, source: str) -> re.Pattern[str] | None:_KNOWN_TOP_LEVEL_KEYS = {"profile", "identity", "severity_overrides"}-_KNOWN_IDENTITY_KEYS = {"author_email_regex"}+_KNOWN_IDENTITY_KEYS = {"author_email_regex", "metadata_id_requirement"}+++def _coerce_metadata_id_requirement(value: Any, source: str) -> str:+ """Return a supported ``metadata_id_requirement``; reject anything else.++ Unlike an unknown severity, a misspelled requirement is an error: silently+ ignoring ``requre`` would let a registry believe it requires IDs.+ """+ if value is None:+ return DEFAULT_METADATA_ID_REQUIREMENT+ if not isinstance(value, str) or value not in METADATA_ID_REQUIREMENTS:+ raise ValueError(+ f"Invalid identity.metadata_id_requirement {value!r} in {source} "+ f"(expected one of: {', '.join(METADATA_ID_REQUIREMENTS)})"+ )+ return valuedef _load_policy_yaml(path: Path) -> Any:@@ -202,6 +230,7 @@ def _policy_from_data(_warn_unknown_keys(identity, _KNOWN_IDENTITY_KEYS, "identity", source_str)author_email_regex = _coerce_email_regex(identity.get("author_email_regex"), source_str)+ metadata_id_requirement = _coerce_metadata_id_requirement(identity.get("metadata_id_requirement"), source_str)overrides_raw = data.get("severity_overrides") or {}severity_overrides: dict[str, Severity] = {}@@ -225,12 +254,15 @@ def _policy_from_data(audience="all",author_email_regex=author_email_regex,severity_overrides=severity_overrides,+ metadata_id_requirement=metadata_id_requirement,source=source,)def load_profile(name: str = DEFAULT_PROFILE_NAME) -> ValidationPolicy:- """Load a bundled policy; ``external`` is a compatibility alias for ``default``.+ """Load a bundled policy (``default`` or ``registry``).++ ``external`` is a compatibility alias for ``default``.Raises:FileNotFoundError: when no YAML exists for the requested profile.@@ -275,12 +307,16 @@ def load_policy_file(if not isinstance(identity_block, dict):identity_block = {}overlay_sets_email_regex = "author_email_regex" in identity_block+ overlay_sets_id_requirement = "metadata_id_requirement" in identity_blockreturn ValidationPolicy(profile=custom.profile,audience=base.audience,author_email_regex=(custom.author_email_regex if overlay_sets_email_regex else base.author_email_regex),severity_overrides=merged_overrides,+ metadata_id_requirement=(+ custom.metadata_id_requirement if overlay_sets_id_requirement else base.metadata_id_requirement+ ),source=path,)@@ -295,8 +331,10 @@ def default_policy() -> ValidationPolicy:profile=DEFAULT_PROFILE_NAME,author_email_regex=None,severity_overrides={- "SCHEMA.author_missing": Severity.HIGH,+ "SCHEMA.author_missing": Severity.LOW,+ "SCHEMA.author_without_email": Severity.INFO,"SCHEMA.author_format": Severity.HIGH,+ "WORKFLOWS.author_format": Severity.HIGH,"LICENSE.*": Severity.CRITICAL,"LICENSE.frontmatter_license_mismatch": Severity.CRITICAL,},diff --git a/src/skillevaluator/validators/schema.py b/src/skillevaluator/validators/schema.pyindex b262812d..89bb45f3 100644--- a/src/skillevaluator/validators/schema.py+++ b/src/skillevaluator/validators/schema.py@@ -9,7 +9,9 @@ and naming conventions per SkillEvaluator specification.import osimport re+import unicodedatafrom pathlib import Path+from typing import Anyimport yamlfrom pydantic import ValidationError@@ -30,10 +32,120 @@ from skillevaluator.models.skill import SkillFrontmatter, SkillManifestfrom skillevaluator.utils.path_security import matches_filesystem_namefrom skillevaluator.validators.base import ValidationResult, ValidatorBasefrom skillevaluator.validators.frontmatter_parser import FRONTMATTER_PATTERN, format_validation_location-from skillevaluator.validators.policy import ValidationPolicy, default_policy+from skillevaluator.validators.policy import AUTHOR_SHAPE_PATTERN, ValidationPolicy, default_policylogger = get_logger(__name__)+#: Upper bound for a ``metadata.author`` value; longer values are malformed.+AUTHOR_MAX_LENGTH = 256++#: An email address written outside the ``Name <email@host>`` shape.+_BARE_EMAIL_PATTERN = re.compile(r"[^\s<>@]+@[^\s<>@]+\.[^\s<>@]+")++#: ``metadata.id`` contract: an exact (unnormalized) lowercase ASCII slug.+METADATA_ID_MAX_LENGTH = 64+METADATA_ID_PATTERN = re.compile(r"[a-z0-9]+(?:-[a-z0-9]+)*", re.ASCII)++#: Longest raw ``metadata.id`` text repeated in a finding.+_METADATA_ID_DISPLAY_LIMIT = 80+++def author_value_problem(author: str) -> str | None:+ """Return why *author* is malformed or unsafe, or ``None`` when it is usable.++ A usable value is either the ``Name <email@host>`` shape or plain+ attribution: a person, team, or organization name such as+ ``NVIDIA cuOpt Team`` or ``Jane Doe (@jdoe)``. Plain attribution may not+ contain angle brackets or an email address, because those mean an attempted+ but broken ``Name <email>`` value.+ """+ if len(author) > AUTHOR_MAX_LENGTH:+ return f"is longer than {AUTHOR_MAX_LENGTH} characters"+ if any(unicodedata.category(char).startswith("C") for char in author):+ return "contains control or invisible formatting characters"+ if AUTHOR_SHAPE_PATTERN.fullmatch(author):+ return None+ if "<" in author or ">" in author:+ return "uses angle brackets but is not of the form 'Name <email@host>'"+ if _BARE_EMAIL_PATTERN.search(author):+ return "contains an email address that is not in the form 'Name <email@host>'"+ if not any(char.isalnum() for char in author):+ return "has no letters or digits"+ return None+++def metadata_id_problem(value: Any) -> str | None:+ """Return why *value* breaks the ``metadata.id`` contract, or ``None``."""+ if not isinstance(value, str):+ return f"must be a string (got {type(value).__name__})"+ if not value:+ return "must not be empty"+ if len(value) > METADATA_ID_MAX_LENGTH:+ return f"must be at most {METADATA_ID_MAX_LENGTH} characters (got {len(value)})"+ if not METADATA_ID_PATTERN.fullmatch(value):+ return (+ "must be lowercase ASCII letters and digits, with single hyphens between them "+ "(for example 'my-skill'), and no surrounding whitespace"+ )+ return None+++def _relative_label(skill_dir: Path, root: Path) -> str:+ try:+ return skill_dir.relative_to(root).as_posix()+ except ValueError:+ return skill_dir.as_posix()+++def duplicate_metadata_ids(declared_ids: dict[str, list[Path]], root: Path) -> dict[str, list[str]]:+ """Map each ``metadata.id`` declared by more than one skill to sorted skill labels under *root*."""+ return {+ value: sorted(_relative_label(skill_dir, root) for skill_dir in dirs)+ for value, dirs in sorted(declared_ids.items())+ if len(dirs) > 1+ }+++def declared_metadata_id(skill_dir: Path) -> str | None:+ """Return the valid ``metadata.id`` declared in *skill_dir*'s manifest, if any.++ Used by catalog runs that validate each skill separately, so they can+ still check uniqueness across the catalog. Unparseable manifests and+ invalid IDs return ``None``; the per-skill schema check reports those.+ """+ validator = SchemaValidator()+ manifest = validator._find_skill_manifest(skill_dir)+ if manifest is None:+ return None+ frontmatter = validator._validate_frontmatter(manifest).metadata.get("frontmatter")+ if frontmatter is None or frontmatter.metadata is None:+ return None+ value = (frontmatter.metadata.model_extra or {}).get("id")+ return value if metadata_id_problem(value) is None else None+++def metadata_id_duplicate_severity(policy: ValidationPolicy) -> Severity:+ """Severity of a duplicate ``metadata.id`` under *policy* (HIGH only when IDs are required)."""+ default = Severity.HIGH if policy.metadata_id_requirement == "require" else Severity.MEDIUM+ return policy.severity_for("SCHEMA", "metadata_id_duplicate", default=default)+++def _display_metadata_id(value: Any) -> str:+ """Render a bounded preview of a ``metadata.id`` value for a finding.++ A non-string value is described by its type alone and never rendered.+ ``metadata.id`` accepts arbitrary YAML before this check rejects a+ non-string, and ``repr`` expands a YAML alias graph eagerly: a 445-byte+ manifest with 20 doubling aliases builds a 14,680,060-character string,+ and a slightly deeper graph exhausts memory. Truncating afterwards is too+ late, because the whole string is built first.+ """+ if not isinstance(value, str):+ return f"<{type(value).__name__}>"+ if len(value) > _METADATA_ID_DISPLAY_LIMIT:+ return value[:_METADATA_ID_DISPLAY_LIMIT] + "…"+ return value+class SchemaValidator(ValidatorBase):"""Validates skill schema and repository structure per SkillEvaluator spec.@@ -41,9 +153,10 @@ class SchemaValidator(ValidatorBase):Checks: frontmatter schema, folder hierarchy, naming conventions,directory-name consistency, required/forbidden fields.- Author attribution is policy-driven: the ``Name <email>`` *shape* is always- enforced, while an optional email-domain restriction can come from the- active :class:`ValidationPolicy`.+ Author attribution and ``metadata.id`` are policy-driven: the active+ :class:`ValidationPolicy` decides whether a missing author, a name without+ an email, or a missing ID blocks, and may restrict the author email domain.+ Malformed or unsafe author values and invalid IDs are always reported."""def __init__(self, policy: ValidationPolicy | None = None) -> None:@@ -87,8 +200,12 @@ class SchemaValidator(ValidatorBase):)result.merge(self._validate_folder_compliance(skill_path))+ declared_ids: dict[str, list[Path]] = {}for skill_dir in skill_dirs:skill_result = self._validate_single_skill(skill_dir)+ metadata_id = skill_result.metadata.get("metadata_id")+ if isinstance(metadata_id, str):+ declared_ids.setdefault(metadata_id, []).append(skill_dir)if skill_result.passed:# Collect detailed check informationcheck_details = []@@ -108,9 +225,59 @@ class SchemaValidator(ValidatorBase):checks=check_details,total_checks=len(check_details),)+ # A passing child can still carry policy advisories. Keep its+ # findings without merging its successes a second time.+ for finding in skill_result.findings:+ result.add_finding(finding)else:result.merge_with_prefix(skill_result, skill_dir.name)+ # merge_with_prefix copies errors/warnings, but not severity+ # counters. Count findings once in this collection's summary.+ for finding in skill_result.findings:+ result.summary.tally_severity(finding.severity)++ result.merge(self._validate_metadata_id_uniqueness(declared_ids, skill_path))+ return result++ def _validate_metadata_id_uniqueness(self, declared_ids: dict[str, list[Path]], root: Path) -> ValidationResult:+ """Report ``metadata.id`` values declared by more than one skill in this collection.+ Uniqueness is evaluated only across the skills discovered together in+ one run. It does not consult a registry or a saved catalog, whose+ identity stays keyed by content type and relative path.+ """+ result = ValidationResult()+ if not declared_ids:+ return result+ policy = self.policy+ duplicates = duplicate_metadata_ids(declared_ids, root)+ for value, relative in duplicates.items():+ result.add_finding(+ Finding(+ category="SCHEMA",+ severity=metadata_id_duplicate_severity(policy),+ check_name="metadata_id_duplicate",+ message=(+ f"metadata.id '{value}' is declared by {len(relative)} skills in this collection: "+ f"{', '.join(relative)}"+ ),+ file_path=str(root),+ suggestion="Give each skill its own metadata.id.",+ metadata={+ "metadata_id": value,+ "skills": relative,+ "profile": policy.profile,+ "metadata_id_requirement": policy.metadata_id_requirement,+ },+ )+ )+ if not duplicates:+ count = sum(len(dirs) for dirs in declared_ids.values())+ result.add_success(+ check_name="metadata_id_unique",+ message=f"{count} declared metadata.id value(s) are unique within this collection",+ metadata_id_count=count,+ )return resultdef _validate_single_skill(self, skill_path: Path) -> ValidationResult:@@ -171,6 +338,7 @@ class SchemaValidator(ValidatorBase):if frontmatter := result.metadata.get("frontmatter"):result.merge(self._validate_name_matches_directory(skill_path, frontmatter))result.merge(self._validate_author(frontmatter, str(skill_md)))+ result.merge(self._validate_metadata_id(frontmatter, str(skill_md)))return result@@ -583,77 +751,160 @@ class SchemaValidator(ValidatorBase):return resultdef _validate_author(self, frontmatter: SkillFrontmatter, file_path: str = "") -> ValidationResult:- """Require author field with name + email; domain restriction is policy-driven.+ """Classify ``metadata.author`` and apply the active policy.- Splits the historical single-regex check into two orthogonal pieces:+ Four outcomes, each with its own check name so a policy can set its+ severity independently:- 1. *Shape* — every author value must match ``Name <email@host>``,- regardless of profile.- 2. *Domain* — only enforced when the active policy supplies an- ``author_email_regex``. A custom policy can require an organization- domain; the bundled default policy accepts any email domain.+ - ``author_missing``: no author (default policy: LOW, advisory).+ - ``author_without_email``: a person, team, or organization name with+ no email address (default policy: INFO).+ - ``author_format``: a malformed or unsafe value, such as a bare email,+ stray angle brackets, or control characters, or an email outside the+ policy's ``author_email_regex`` domain (HIGH, blocking).+ - success: ``Name <email@host>`` that satisfies any domain restriction.- Severity for both ``author_missing`` and ``author_format`` comes from- the active policy with HIGH defaults.+ A policy with an ``author_email_regex`` needs an email in that domain,+ so a name without an email fails its domain check."""result = ValidationResult()policy = self.policy+ author = (frontmatter.metadata.author or "").strip() if frontmatter.metadata else ""- if frontmatter.metadata and frontmatter.metadata.author:- author = frontmatter.metadata.author.strip()- shape_ok = policy.author_shape_regex.fullmatch(author) is not None- domain_ok = policy.is_author_email_acceptable(author)+ if not author:+ result.add_finding(+ Finding(+ category="SCHEMA",+ severity=policy.severity_for("SCHEMA", "author_missing", default=Severity.LOW),+ check_name="author_missing",+ message="Author not specified in metadata",+ file_path=file_path,+ suggestion=(+ "Add 'metadata.author' with a person, team, or organization name, "+ "or 'Name <[email protected]>' to include a contact address"+ ),+ metadata={"profile": policy.profile},+ )+ )+ return result- if shape_ok and domain_ok:- result.add_success(- check_name="author_format",- message=f"Valid author format: {author}",+ problem = author_value_problem(author)+ shape_ok = problem is None and policy.author_shape_regex.fullmatch(author) is not None+ domain_ok = shape_ok and policy.is_author_email_acceptable(author)+ finding_metadata = {+ "current_author": author[:AUTHOR_MAX_LENGTH],+ "profile": policy.profile,+ "shape_ok": shape_ok,+ "domain_ok": domain_ok,+ }++ if problem is not None:+ message = f"Author {problem}"+ suggestion = "Use a plain name such as 'Example Team', or 'Full Name <[email protected]>'"+ elif shape_ok and domain_ok:+ result.add_success(check_name="author_format", message=f"Valid author format: {author}")+ return result+ elif policy.author_email_regex is not None:+ domain_pattern = policy.author_email_regex.pattern+ subject = "Author email does not match" if shape_ok else "Author has no email address matching"+ message = f"{subject} the required domain (profile '{policy.profile}', pattern: {domain_pattern})"+ suggestion = (+ "Use 'Name <email>' with an email matching the active profile's author_email_regex, "+ "or review whether that domain restriction is appropriate for your repository."+ )+ else:+ result.add_finding(+ Finding(+ category="SCHEMA",+ severity=policy.severity_for("SCHEMA", "author_without_email", default=Severity.INFO),+ check_name="author_without_email",+ message=f"Author has no email address: {author}",+ file_path=file_path,+ line_content=f"author: {author}",+ suggestion=(+ "A name is accepted as attribution unless the profile requires a contact address "+ "(such as 'registry'); then use 'Name <[email protected]>'"+ ),+ metadata=finding_metadata,)- else:- if not shape_ok:- message = "Author must be of the form 'Name <email@host>'"- suggestion = "Use format: 'Full Name <[email protected]>'"- else:- domain_pattern = policy.author_email_regex.pattern if policy.author_email_regex is not None else ""- message = (- f"Author email does not match required domain "- f"(profile '{policy.profile}', pattern: {domain_pattern})"- )- suggestion = (- "Use an email matching the active profile's author_email_regex, "- "or review whether that domain restriction is appropriate for your repository."- )+ )+ return result- result.add_finding(- Finding(- category="SCHEMA",- severity=policy.severity_for("SCHEMA", "author_format", default=Severity.HIGH),- check_name="author_format",- message=message,- file_path=file_path,- line_content=f"author: {author}",- suggestion=suggestion,- metadata={- "current_author": author,- "profile": policy.profile,- "shape_ok": shape_ok,- "domain_ok": domain_ok,- },- )+ result.add_finding(+ Finding(+ category="SCHEMA",+ severity=policy.severity_for("SCHEMA", "author_format", default=Severity.HIGH),+ check_name="author_format",+ message=message,+ file_path=file_path,+ line_content=f"author: {author[:AUTHOR_MAX_LENGTH]}",+ suggestion=suggestion,+ metadata=finding_metadata,+ )+ )+ return result++ def _validate_metadata_id(self, frontmatter: SkillFrontmatter, file_path: str = "") -> ValidationResult:+ """Validate an optional ``metadata.id`` against the stable-ID contract.++ A present ID must be an exact 1-64 character lowercase ASCII slug in+ every policy mode. The policy's ``metadata_id_requirement`` decides+ whether absence is ignored, recommended (LOW), or required (HIGH), and+ whether an invalid ID blocks (``require``) or is advisory (MEDIUM).+ A valid ID is stored in ``result.metadata['metadata_id']`` for the+ collection-level uniqueness check.+ """+ result = ValidationResult()+ policy = self.policy+ requirement = policy.metadata_id_requirement+ extra = frontmatter.metadata.model_extra if frontmatter.metadata is not None else None+ details = {"profile": policy.profile, "metadata_id_requirement": requirement}++ if not extra or "id" not in extra:+ if requirement == "ignore":+ return result+ default = Severity.HIGH if requirement == "require" else Severity.LOW+ verb = "requires" if requirement == "require" else "recommends"+ result.add_finding(+ Finding(+ category="SCHEMA",+ severity=policy.severity_for("SCHEMA", "metadata_id_missing", default=default),+ check_name="metadata_id_missing",+ message=f"metadata.id not specified; profile '{policy.profile}' {verb} a stable skill ID",+ file_path=file_path,+ suggestion="Add 'metadata.id' with a lowercase slug such as 'my-skill' that stays fixed across versions",+ metadata=details,)- else:+ )+ return result++ value = extra["id"]+ problem = metadata_id_problem(value)+ if problem is not None:+ default = Severity.HIGH if requirement == "require" else Severity.MEDIUMresult.add_finding(Finding(category="SCHEMA",- severity=policy.severity_for("SCHEMA", "author_missing", default=Severity.HIGH),- check_name="author_missing",- message="Author not specified in metadata",+ severity=policy.severity_for("SCHEMA", "metadata_id_format", default=default),+ check_name="metadata_id_format",+ message=f"metadata.id {problem}",file_path=file_path,- suggestion="Add 'metadata.author' field with format 'Name <[email protected]>'",- metadata={"profile": policy.profile},+ line_content=f"id: {_display_metadata_id(value)}",+ suggestion="Use a lowercase slug such as 'my-skill' (1-64 characters: a-z, 0-9, single hyphens)",+ metadata=details,))+ return result+ result.add_success(+ check_name="metadata_id_format",+ message=(+ f"Valid metadata.id '{value}'. Uniqueness is checked only across skills validated together "+ "in one collection run"+ ),+ metadata_id=value,+ )+ result.metadata["metadata_id"] = valuereturn resultdef _validate_folder_compliance(self, folder_path: Path) -> ValidationResult:diff --git a/tests/golden/test_policy_behavior.py b/tests/golden/test_policy_behavior.pyindex 67c9e8c4..27a3eff7 100644--- a/tests/golden/test_policy_behavior.py+++ b/tests/golden/test_policy_behavior.py@@ -66,10 +66,17 @@ def test_default_policy_accepts_public_author_metadata(tmp_path: Path) -> None:nvidia = _write_skill(tmp_path, "nvidia-skill", "Dev One <[email protected]>")external = _write_skill(tmp_path, "ext-skill", "Jane Doe <[email protected]>")missing = _write_skill(tmp_path, "no-author-skill", None)+ team = _write_skill(tmp_path, "team-skill", "Example Platform Team")+ malformed = _write_skill(tmp_path, "malformed-skill", "[email protected]")assert _validate(nvidia, out) == 0assert _validate(external, out) == 0- assert _validate(missing, out) == 1+ # The Agent Skills baseline requires only name and description, so a missing+ # author or a team name without an email is advisory under the default policy.+ assert _validate(missing, out) == 0+ assert _validate(team, out) == 0+ # A malformed value (here a bare email) still blocks.+ assert _validate(malformed, out) == 1def test_external_alias_matches_default_public_policy(tmp_path: Path) -> None:@@ -78,7 +85,7 @@ def test_external_alias_matches_default_public_policy(tmp_path: Path) -> None:missing = _write_skill(tmp_path, "no-author-skill", None)assert _validate(external, out, "--external") == 0 # domain check disabled- assert _validate(missing, out, "--external") == 1+ assert _validate(missing, out, "--external") == 0 # author is advisory@pytest.mark.parametrize(@@ -88,11 +95,42 @@ def test_external_alias_matches_default_public_policy(tmp_path: Path) -> None:def test_default_and_legacy_cli_forms_keep_author_validation(tmp_path: Path, options: list[str]) -> None:present = _write_skill(tmp_path, "attributed-skill", "Demo Author <[email protected]>")missing = _write_skill(tmp_path, "unattributed-skill", None)+ malformed = _write_skill(tmp_path, "malformed-skill", "Demo Author <author>")assert _validate(present, tmp_path / "passed", *options) == 0- assert _validate(missing, tmp_path / "failed", *options) == 1+ assert _validate(missing, tmp_path / "advisory", *options) == 0+ assert _validate(malformed, tmp_path / "failed", *options) == 1report = json.loads(next((tmp_path / "passed").glob("skillevaluator-output-*.json")).read_text())assert report["policy"]["profile"] == "default"assert report["policy"]["audience"] == "all"+ assert report["policy"]["metadata_id_requirement"] == "ignore"+++def _write_skill_with_id(root: Path, name: str, author_line: str, metadata_id: str) -> Path:+ skill = _write_skill(root, name, author_line)+ manifest = skill / "SKILL.md"+ manifest.write_text(+ manifest.read_text(encoding="utf-8").replace("metadata:\n", f"metadata:\n id: {metadata_id}\n", 1),+ encoding="utf-8",+ )+ return skill+++def test_registry_profile_requires_contact_author_and_metadata_id(tmp_path: Path) -> None:+ complete = _write_skill_with_id(tmp_path, "complete-skill", "Demo Author <[email protected]>", "complete-skill")+ no_id = _write_skill(tmp_path, "no-id-skill", "Demo Author <[email protected]>")+ team = _write_skill_with_id(tmp_path, "team-skill", "Example Platform Team", "team-skill")+ bad_id = _write_skill_with_id(tmp_path, "bad-id-skill", "Demo Author <[email protected]>", "Bad_ID")++ assert _validate(complete, tmp_path / "complete", "--profile", "registry") == 0+ assert _validate(no_id, tmp_path / "no-id", "--profile", "registry") == 1+ assert _validate(team, tmp_path / "team", "--profile", "registry") == 1+ assert _validate(bad_id, tmp_path / "bad-id", "--profile", "registry") == 1+ # The same invalid ID is advisory under the default policy.+ assert _validate(bad_id, tmp_path / "bad-id-default") == 0++ report = json.loads(next((tmp_path / "complete").glob("skillevaluator-output-*.json")).read_text())+ assert report["policy"]["profile"] == "registry"+ assert report["policy"]["metadata_id_requirement"] == "require"def test_benchmark_md_generated_for_skill(tmp_path: Path) -> None:@@ -100,3 +138,159 @@ def test_benchmark_md_generated_for_skill(tmp_path: Path) -> None:nvidia = _write_skill(tmp_path, "nvidia-skill", "Dev One <[email protected]>")assert _validate(nvidia, out) == 0assert (out / "BENCHMARK.md").exists()+++def test_catalog_reports_shared_metadata_id_and_blocks_under_registry(tmp_path: Path) -> None:+ catalog = tmp_path / "catalog"+ _write_skill_with_id(catalog, "first-skill", "Demo Author <[email protected]>", "shared-id")+ _write_skill_with_id(catalog, "second-skill", "Demo Author <[email protected]>", "shared-id")+ _write_skill_with_id(catalog, "third-skill", "Demo Author <[email protected]>", "third-skill")++ # Each skill passes on its own; the shared ID is advisory under the default policy.+ assert _validate(catalog, tmp_path / "default") == 0+ summary = json.loads((tmp_path / "default" / "catalog-summary.json").read_text(encoding="utf-8"))+ assert summary["overall_passed"] is True+ assert summary["metadata_id_conflicts"] == [+ {+ "metadata_id": "shared-id",+ "skills": ["first-skill", "second-skill"],+ "severity": "medium",+ "blocking": False,+ }+ ]++ # The registry profile requires unique IDs, so both sharing skills fail.+ assert _validate(catalog, tmp_path / "registry", "--profile", "registry") == 1+ summary = json.loads((tmp_path / "registry" / "catalog-summary.json").read_text(encoding="utf-8"))+ assert summary["metadata_id_conflicts"][0]["blocking"] is True+ failed = {skill["name"]: skill["reason"] for skill in summary["skills"] if not skill["passed"]}+ assert failed == {+ "first-skill": "metadata.id 'shared-id' is also declared by second-skill",+ "second-skill": "metadata.id 'shared-id' is also declared by first-skill",+ }+++def test_catalog_without_shared_ids_records_no_conflicts(tmp_path: Path) -> None:+ catalog = tmp_path / "catalog"+ _write_skill_with_id(catalog, "first-skill", "Demo Author <[email protected]>", "first-skill")+ _write_skill(catalog, "second-skill", "Demo Author <[email protected]>")++ assert _validate(catalog, tmp_path / "out") == 0+ summary = json.loads((tmp_path / "out" / "catalog-summary.json").read_text(encoding="utf-8"))+ assert summary["metadata_id_conflicts"] == []+++def test_parallel_catalog_applies_the_registry_id_conflict(tmp_path: Path) -> None:+ catalog = tmp_path / "catalog"+ _write_skill_with_id(catalog, "first-skill", "Demo Author <[email protected]>", "shared-id")+ _write_skill_with_id(catalog, "second-skill", "Demo Author <[email protected]>", "shared-id")++ assert _validate(catalog, tmp_path / "out", "--profile", "registry", "--workers", "2") == 1+ summary = json.loads((tmp_path / "out" / "catalog-summary.json").read_text(encoding="utf-8"))+ assert [skill["passed"] for skill in summary["skills"]] == [False, False]+ assert summary["metadata_id_conflicts"][0]["skills"] == ["first-skill", "second-skill"]++[email protected]("workers", ["1", "2"])+ "selection",+ [["--checks", "version"], ["--checks", "schema,version", "--skip", "schema"]],+)+def test_catalog_id_check_runs_only_when_the_schema_check_is_selected(+ tmp_path: Path, workers: str, selection: list[str]+) -> None:+ # --checks and --skip run exactly the checks they name: a catalog-wide+ # metadata.id conflict must not fail a run that did not select schema.+ catalog = tmp_path / "catalog"+ _write_skill_with_id(catalog, "first-skill", "Demo Author <[email protected]>", "shared-id")+ _write_skill_with_id(catalog, "second-skill", "Demo Author <[email protected]>", "shared-id")++ result = CliRunner().invoke(+ cli,+ [+ "validate",+ str(catalog),+ "--tiers",+ "1",+ "--no-llm",+ *selection,+ "--profile",+ "registry",+ "--workers",+ workers,+ "-r",+ "json",+ "-o",+ str(tmp_path / "out"),+ ],+ )+ assert result.exit_code == 0, result.output+ summary = json.loads((tmp_path / "out" / "catalog-summary.json").read_text(encoding="utf-8"))+ assert summary["metadata_id_conflicts"] == []+ assert summary["overall_passed"] is True+ assert summary["severity_totals"]["high"] == 0++[email protected]("workers", ["1", "2"])+ ("profile", "override", "severity", "blocking"),+ [+ ("default", None, "medium", False),+ ("registry", None, "high", True),+ ("default", "high", "high", True),+ ("registry", "low", "low", False),+ ("default", "info", "info", False),+ ],+)[email protected]("child_failure", [False, True])+def test_catalog_conflicts_project_consistent_verdicts_counts_and_leaf_scope(+ tmp_path: Path, workers: str, profile: str, override: str | None, severity: str, blocking: bool, child_failure: bool+) -> None:+ catalog = tmp_path / "skills"+ _write_skill_with_id(catalog, "first-skill", "Demo Author <[email protected]>", "shared-id")+ _write_skill_with_id(+ catalog, "second-skill", "[email protected]" if child_failure else "Demo Author <[email protected]>", "shared-id"+ )+ _write_skill_with_id(catalog, "third-skill", "Demo Author <[email protected]>", "third-skill")+ options = ["--profile", profile, "--workers", workers]+ if override:+ policy = tmp_path / "policy.yaml"+ policy.write_text(f"severity_overrides:\n SCHEMA.metadata_id_duplicate: {override}\n", encoding="utf-8")+ options += ["--policy", str(policy)]++ out = tmp_path / "out"+ assert _validate(catalog, out, *options) == int(blocking or child_failure)+ summary = json.loads((out / "catalog-summary.json").read_text(encoding="utf-8"))+ assert summary["metadata_id_conflicts"] == [+ {+ "metadata_id": "shared-id",+ "skills": ["first-skill", "second-skill"],+ "severity": severity,+ "blocking": blocking,+ }+ ]+ assert summary["overall_passed"] is not (blocking or child_failure)+ expected_totals = {"critical": 0, "high": int(child_failure), "medium": 0, "low": 0}+ if severity != "info":+ expected_totals[severity] += 2+ for entry in summary["skills"]:+ own_failure = child_failure and entry["name"] == "second-skill"+ conflict = entry["name"] != "third-skill"+ expected_passed = not (own_failure or (conflict and blocking))+ assert entry["passed"] is entry["overall_passed"] is expected_passed+ assert entry["overall_status"] == ("passed" if expected_passed else "failed")+ assert entry["report_scope"] == "single_skill"+ assert entry["report_verdict"] == {+ "overall_passed": not own_failure,+ "overall_status": "failed" if own_failure else "passed",+ }+ expected_counts = {"critical": 0, "high": int(own_failure), "medium": 0, "low": 0}+ if conflict and severity != "info":+ expected_counts[severity] += 1+ assert entry["severity_counts"] == expected_counts+ leaf = json.loads((out / entry["report_dir"] / entry["json_report"]).read_text(encoding="utf-8"))+ assert leaf["overall_passed"] is not own_failure+ assert leaf["overall_status"] == ("failed" if own_failure else "passed")+ if own_failure:+ assert "metadata.id" not in entry["reason"]+ assert summary["severity_totals"] == expected_totalsdiff --git a/tests/test_commands.py b/tests/test_commands.pyindex b5e2f8c9..0c430797 100644--- a/tests/test_commands.py+++ b/tests/test_commands.py@@ -2287,8 +2287,8 @@ def test_catalog_summary_same_second_rerun_overwrites_json(monkeypatch) -> None:Finding(category="SCHEMA",severity=Severity.HIGH,- check_name="author_missing",- message="missing author",+ check_name="frontmatter_format",+ message="missing frontmatter",file_path="SKILL.md",),is_error=True,@@ -2517,10 +2517,10 @@ def test_validate_quiet_failing_run_renders_verdict_and_fails_cleanly(monkeypatcFinding(category="SCHEMA",severity=Severity.HIGH,- check_name="author_missing",- message="Author not specified in metadata",+ check_name="frontmatter_format",+ message="SKILL.md must have YAML frontmatter between --- markers",file_path="SKILL.md",- suggestion="Add 'metadata.author' with format 'Name <[email protected]>'",+ suggestion="Add frontmatter block: start with '---', add YAML content, end with '---'",),is_error=True,)diff --git a/tests/validators/test_policy.py b/tests/validators/test_policy.pyindex 81696562..033700c9 100644--- a/tests/validators/test_policy.py+++ b/tests/validators/test_policy.py@@ -23,15 +23,19 @@ from skillevaluator.validators.policy import (@pytest.mark.parametrize("name", ["default", "external"])-def test_default_and_legacy_names_resolve_one_policy_without_weakening_rules(name: str) -> None:+def test_default_and_legacy_names_resolve_one_policy(name: str) -> None:policy = resolve_policy(profile=name)assert policy.profile == "default"assert policy.audience == "all"assert policy.is_author_email_acceptable("Author <[email protected]>")assert policy.is_author_email_acceptable("Author <[email protected]>")- assert policy.severity_for("SCHEMA", "author_missing", Severity.LOW) == Severity.HIGH+ # Author attribution is optional in the Agent Skills baseline: advisory here.+ assert policy.severity_for("SCHEMA", "author_missing", Severity.HIGH) == Severity.LOW+ assert policy.severity_for("SCHEMA", "author_without_email", Severity.HIGH) == Severity.INFO+ # Malformed or unsafe author values still block.assert policy.severity_for("SCHEMA", "author_format", Severity.LOW) == Severity.HIGH+ assert policy.metadata_id_requirement == "ignore"assert policy.severity_for("WORKFLOWS", "author_format", Severity.LOW) == Severity.HIGHassert policy.severity_for("LICENSE", "blocked_license", Severity.LOW) == Severity.CRITICALassert policy.severity_for("PII", "email", Severity.HIGH) == Severity.HIGH@@ -57,7 +61,7 @@ def test_default_profile_is_the_public_profile() -> None:assert policy.profile == "default"assert policy.author_email_regex is Noneassert policy.is_author_email_acceptable("Jane Doe <[email protected]>")- assert policy.severity_for("SCHEMA", "author_missing", Severity.LOW) == Severity.HIGH+ assert policy.severity_for("SCHEMA", "author_missing", Severity.HIGH) == Severity.LOWassert policy.severity_for("LICENSE", "missing", Severity.LOW) == Severity.CRITICAL@@ -73,7 +77,54 @@ def test_custom_policy_overlays_the_public_profile(tmp_path: Path) -> None:assert policy.profile == "team-strict"assert policy.author_email_regex is Noneassert policy.severity_for("SCHEMA", "author_format", Severity.LOW) == Severity.CRITICAL- assert policy.severity_for("SCHEMA", "author_missing", Severity.LOW) == Severity.HIGH+ assert policy.severity_for("SCHEMA", "author_missing", Severity.HIGH) == Severity.LOW+ assert policy.metadata_id_requirement == "ignore"+++def test_registry_profile_requires_contact_author_and_metadata_id() -> None:+ policy = load_profile("registry")++ assert policy.profile == "registry"+ assert policy.author_email_regex is None+ assert policy.metadata_id_requirement == "require"+ for check in ("author_missing", "author_without_email", "author_format"):+ assert policy.severity_for("SCHEMA", check, Severity.LOW) == Severity.HIGH+ assert policy.severity_for("WORKFLOWS", "author_format", Severity.LOW) == Severity.HIGH+ assert policy.severity_for("LICENSE", "blocked_license", Severity.LOW) == Severity.CRITICAL+ assert policy.to_dict()["metadata_id_requirement"] == "require"+ assert policy.digest != default_policy().digest+++def test_policy_overlay_sets_or_inherits_metadata_id_requirement(tmp_path: Path) -> None:+ require = tmp_path / "require.yaml"+ require.write_text("profile: my-registry\nidentity:\n metadata_id_requirement: require\n", encoding="utf-8")+ bare_identity = tmp_path / "bare.yaml"+ bare_identity.write_text("profile: team\nidentity:\n author_email_regex: '@example\\.org>'\n", encoding="utf-8")++ assert load_policy_file(require).metadata_id_requirement == "require"+ # An overlay that does not name the key keeps the base profile's mode.+ assert load_policy_file(bare_identity).metadata_id_requirement == "ignore"+ assert load_policy_file(bare_identity, base_profile="registry").metadata_id_requirement == "require"+ assert load_policy_file(require).digest != load_policy_file(bare_identity).digest++[email protected]("value", ["requre", "REQUIRE", "true", "1"])+def test_policy_rejects_unknown_metadata_id_requirement(tmp_path: Path, value: str) -> None:+ custom = tmp_path / "typo.yaml"+ custom.write_text(f"identity:\n metadata_id_requirement: {value}\n", encoding="utf-8")++ with pytest.raises(ValueError, match="metadata_id_requirement"):+ load_policy_file(custom)+++def test_in_memory_default_policy_matches_bundled_author_rules(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:+ bundled = default_policy()+ monkeypatch.setattr(policy_module, "PROFILES_DIR", tmp_path)+ fallback = default_policy()++ assert fallback.metadata_id_requirement == bundled.metadata_id_requirement+ for key in ("SCHEMA.author_missing", "SCHEMA.author_without_email", "SCHEMA.author_format", "LICENSE.*"):+ assert fallback.severity_overrides[key] == bundled.severity_overrides[key]def test_custom_policy_wraps_malformed_yaml(tmp_path: Path) -> None:diff --git a/tests/validators/test_schema.py b/tests/validators/test_schema.pyindex e038988b..363084e1 100644--- a/tests/validators/test_schema.py+++ b/tests/validators/test_schema.py@@ -239,7 +239,7 @@ description: {long_desc}assert any("1024" in err or "description" in err.lower() for err in result.errors)def test_metadata_author_validation(self, tmp_path: Path):- """Test author format fails for malformed (no email) author under default profile."""+ """A name without an email is advisory attribution under the default profile."""from skillevaluator.models.result import Severityskill_dir = tmp_path / "no-email-author"@@ -267,18 +267,16 @@ Example usage.validator = SchemaValidator()result = validator.validate(skill_dir)- assert not result.passed- author_findings = [f for f in result.findings if f.check_name == "author_format"]+ assert result.passed, result.errors+ assert not [f for f in result.findings if f.check_name == "author_format"]+ author_findings = [f for f in result.findings if f.check_name == "author_without_email"]assert len(author_findings) == 1- # The default public profile keeps malformed author metadata at HIGH severity.- assert author_findings[0].severity == Severity.HIGH- # Message changed to be precise about *which* aspect failed (shape vs. domain).- # "John Doe" fails the shape check (no Name <email> form).- assert "Name <email" in author_findings[0].message+ assert author_findings[0].severity == Severity.INFO+ assert author_findings[0].message == "Author has no email address: John Doe"assert author_findings[0].metadata.get("shape_ok") is False- def test_metadata_author_required(self, tmp_path: Path):- """Test missing metadata.author is a HIGH severity failure under default profile."""+ def test_metadata_author_missing_is_advisory(self, tmp_path: Path):+ """A missing metadata.author is a LOW advisory under the default profile."""from skillevaluator.models.result import Severityskill_dir = tmp_path / "missing-author"@@ -304,10 +302,10 @@ Example usage.validator = SchemaValidator()result = validator.validate(skill_dir)- assert not result.passed+ assert result.passed, result.errorsauthor_findings = [f for f in result.findings if f.check_name == "author_missing"]assert len(author_findings) == 1- assert author_findings[0].severity == Severity.HIGH+ assert author_findings[0].severity == Severity.LOWassert "Author not specified" in author_findings[0].messagedef test_valid_metadata_structure(self, tmp_path: Path):@@ -995,8 +993,8 @@ Example.assert result.passed, f"External profile should accept a well-formed author. Errors: {result.errors}"assert not [f for f in result.findings if f.check_name == "author_format"]- def test_external_profile_requires_author(self, tmp_path: Path):- """Missing author remains a blocking schema error under the public profile."""+ def test_external_profile_reports_missing_author_as_advisory(self, tmp_path: Path):+ """Missing author is reported but does not block under the public profile."""from skillevaluator.models.result import Severityfrom skillevaluator.validators.policy import load_profile@@ -1010,17 +1008,18 @@ Example.author_findings = [f for f in result.findings if f.check_name == "author_missing"]assert len(author_findings) == 1- assert author_findings[0].severity == Severity.HIGH- assert not result.passed+ assert author_findings[0].severity == Severity.LOW+ assert result.passed, result.errorsdef test_external_profile_rejects_malformed_author_shape(self, tmp_path: Path):- """Bare 'John Doe' fails the shape check under the external profile."""+ """A bare email fails the shape check under the external profile."""+ from skillevaluator.models.result import Severityfrom skillevaluator.validators.policy import load_profileskill_dir = self._write_skill(tmp_path,name="external-malformed-author",- author_line="John Doe",+ author_line="[email protected]",)result = SchemaValidator(policy=load_profile("external")).validate(skill_dir)@@ -1028,7 +1027,103 @@ Example.assert len(author_findings) == 1, (f"Expected exactly one author_format finding for malformed shape, got {len(author_findings)}")+ assert author_findings[0].severity == Severity.HIGHassert author_findings[0].metadata.get("shape_ok") is False+ assert not result.passed++ @pytest.mark.parametrize(+ "author",+ [+ "NVIDIA cuOpt Team",+ "Example Corporation and Affiliates",+ "Jane Doe (@jdoe)",+ "Équipe Données",+ ],+ )+ def test_default_profile_accepts_name_only_attribution(self, tmp_path: Path, author: str):+ """Person, team, and organization names without an email are advisory, not blocking."""+ from skillevaluator.models.result import Severity+ from skillevaluator.validators.policy import load_profile++ skill_dir = self._write_skill(tmp_path, name="team-author", author_line=f'"{author}"')++ result = SchemaValidator(policy=load_profile("default")).validate(skill_dir)++ assert result.passed, result.errors+ findings = [f for f in result.findings if f.check_name.startswith("author")]+ assert [(f.check_name, f.severity) for f in findings] == [("author_without_email", Severity.INFO)]++ @pytest.mark.parametrize(+ ("author", "reason"),+ [+ ("[email protected]", "contains an email address"),+ ("Jane Doe [email protected]", "contains an email address"),+ ("Jane Doe <jane>", "angle brackets"),+ ("Jane Doe <[email protected]> and team", "angle brackets"),+ ("Jane\u202eDoe", "control or invisible formatting"),+ ("Jane\tDoe", "control or invisible formatting"),+ ("---", "no letters or digits"),+ ("J" * 257, "longer than 256 characters"),+ ],+ )+ def test_malformed_or_unsafe_author_blocks_in_every_profile(self, tmp_path: Path, author: str, reason: str):+ """Malformed or unsafe values stay HIGH under both bundled profiles."""+ from skillevaluator.models.result import Severity+ from skillevaluator.validators.policy import load_profile++ skill_dir = self._write_skill(tmp_path, name="bad-author", author_line=f'"{author}"')++ for profile in ("default", "registry"):+ result = SchemaValidator(policy=load_profile(profile)).validate(skill_dir)+ findings = [f for f in result.findings if f.check_name == "author_format"]+ assert len(findings) == 1, (profile, [f.check_name for f in result.findings])+ assert findings[0].severity == Severity.HIGH+ assert reason in findings[0].message+ assert len(findings[0].line_content) <= len("author: ") + 256+ assert not result.passed++ def test_registry_profile_requires_contact_author(self, tmp_path: Path):+ """The registry profile blocks a missing author and a name without an email."""+ from skillevaluator.models.result import Severity+ from skillevaluator.validators.policy import load_profile++ policy = load_profile("registry")+ missing = self._write_skill(tmp_path, name="registry-missing", author_line=None)+ team = self._write_skill(tmp_path, name="registry-team", author_line="Example Team")++ missing_result = SchemaValidator(policy=policy).validate(missing)+ team_result = SchemaValidator(policy=policy).validate(team)++ assert not missing_result.passed+ assert not team_result.passed+ assert {(f.check_name, f.severity) for f in missing_result.findings if f.check_name.startswith("author")} == {+ ("author_missing", Severity.HIGH)+ }+ assert {(f.check_name, f.severity) for f in team_result.findings if f.check_name.startswith("author")} == {+ ("author_without_email", Severity.HIGH)+ }++ def test_domain_restriction_rejects_name_without_email(self, tmp_path: Path):+ """An author_email_regex needs an email in that domain, so a bare name fails it."""+ import re++ from skillevaluator.models.result import Severity+ from skillevaluator.validators.policy import ValidationPolicy, default_policy++ policy = ValidationPolicy(+ profile="org",+ author_email_regex=re.compile(r"@example\.org>$"),+ severity_overrides=dict(default_policy().severity_overrides),+ )+ team = self._write_skill(tmp_path, name="org-team", author_line="Example Team")+ member = self._write_skill(tmp_path, name="org-member", author_line="Jane Doe <[email protected]>")++ team_result = SchemaValidator(policy=policy).validate(team)+ findings = [f for f in team_result.findings if f.check_name == "author_format"]+ assert len(findings) == 1+ assert findings[0].severity == Severity.HIGH+ assert "has no email address matching the required domain" in findings[0].message+ assert SchemaValidator(policy=policy).validate(member).passeddef test_default_validator_uses_public_profile(self, tmp_path: Path):"""Constructing SchemaValidator() without a policy accepts public domains."""@@ -1042,3 +1137,252 @@ Example.result = SchemaValidator().validate(skill_dir)assert result.passed+++class TestMetadataIdContract:+ """Optional ``metadata.id``: validated when present, required only by policy."""++ @staticmethod+ def _write_skill(root: Path, name: str, id_line: str | None) -> Path:+ skill_dir = root / name+ skill_dir.mkdir(parents=True)+ id_block = f" id: {id_line}\n" if id_line is not None else ""+ (skill_dir / "SKILL.md").write_text(+ f"""---+name: {name}+description: A skill used by the test suite to check the metadata.id contract+metadata:+ author: Jane Doe <[email protected]>+{id_block}---++# {name}++## Instructions++1. Run.++## Examples++Example.+""",+ encoding="utf-8",+ )+ return skill_dir++ @staticmethod+ def _id_findings(result) -> list[tuple[str, str]]:+ return [(f.check_name, f.severity.value) for f in result.findings if f.check_name.startswith("metadata_id")]++ def test_valid_id_passes_and_does_not_claim_uniqueness(self, tmp_path: Path):+ from skillevaluator.validators.policy import load_profile++ skill_dir = self._write_skill(tmp_path, "id-ok", "id-ok-2")++ for profile in ("default", "registry"):+ result = SchemaValidator(policy=load_profile(profile)).validate(skill_dir)+ assert result.passed, result.errors+ assert self._id_findings(result) == []+ detail = next(d for d in result.success_details if d.check_name == "metadata_id_format")+ assert "Uniqueness is checked only across skills validated together" in detail.message+ assert result.metadata["metadata_id"] == "id-ok-2"++ def test_missing_id_follows_the_profile_requirement(self, tmp_path: Path):+ from skillevaluator.validators.policy import ValidationPolicy, load_profile++ skill_dir = self._write_skill(tmp_path, "no-id", None)++ default_result = SchemaValidator(policy=load_profile("default")).validate(skill_dir)+ recommend_result = SchemaValidator(policy=ValidationPolicy(metadata_id_requirement="recommend")).validate(+ skill_dir+ )+ registry_result = SchemaValidator(policy=load_profile("registry")).validate(skill_dir)++ assert default_result.passed+ assert self._id_findings(default_result) == []+ assert recommend_result.passed+ assert self._id_findings(recommend_result) == [("metadata_id_missing", "low")]+ assert not registry_result.passed+ assert self._id_findings(registry_result) == [("metadata_id_missing", "high")]+ assert "profile 'registry' requires" in registry_result.findings[-1].message++ @pytest.mark.parametrize(+ ("id_line", "reason"),+ [+ ('"My-Skill"', "lowercase ASCII"),+ ("my_skill", "lowercase ASCII"),+ ("-my-skill", "lowercase ASCII"),+ ("my--skill", "lowercase ASCII"),+ ('" my-skill"', "no surrounding whitespace"),+ ('"skill-é"', "lowercase ASCII"),+ ('"' + "a" * 65 + '"', "at most 64 characters (got 65)"),+ ('""', "must not be empty"),+ ("123", "must be a string (got int)"),+ ("true", "must be a string (got bool)"),+ ("null", "must be a string (got NoneType)"),+ ("[a, b]", "must be a string (got list)"),+ ],+ )+ def test_invalid_id_is_advisory_by_default_and_blocks_in_registry(self, tmp_path: Path, id_line: str, reason: str):+ from skillevaluator.validators.policy import load_profile++ skill_dir = self._write_skill(tmp_path, "bad-id", id_line)++ default_result = SchemaValidator(policy=load_profile("default")).validate(skill_dir)+ registry_result = SchemaValidator(policy=load_profile("registry")).validate(skill_dir)++ assert default_result.passed, default_result.errors+ assert self._id_findings(default_result) == [("metadata_id_format", "medium")]+ assert not registry_result.passed+ assert self._id_findings(registry_result) == [("metadata_id_format", "high")]+ finding = next(f for f in registry_result.findings if f.check_name == "metadata_id_format")+ assert reason in finding.message+ assert len(finding.line_content) <= len("id: ") + 81+ assert "metadata_id" not in registry_result.metadata++ def test_collection_reports_duplicate_ids(self, tmp_path: Path):+ from skillevaluator.validators.policy import load_profile++ skills = tmp_path / "skills"+ self._write_skill(skills, "first-skill", "shared-id")+ self._write_skill(skills, "second-skill", "shared-id")+ self._write_skill(skills, "third-skill", "third-skill")+ self._write_skill(skills, "fourth-skill", None)++ default_result = SchemaValidator(policy=load_profile("default")).validate(tmp_path)+ registry_result = SchemaValidator(policy=load_profile("registry")).validate(tmp_path)++ duplicates = [f for f in default_result.findings if f.check_name == "metadata_id_duplicate"]+ assert [(f.severity.value, f.metadata["skills"]) for f in duplicates] == [+ ("medium", ["skills/first-skill", "skills/second-skill"])+ ]+ assert "metadata.id 'shared-id' is declared by 2 skills" in duplicates[0].message+ assert ("metadata_id_duplicate", "high") in [(f.check_name, f.severity.value) for f in registry_result.findings]+ assert not registry_result.passed++ def test_collection_with_unique_ids_reports_scope(self, tmp_path: Path):+ skills = tmp_path / "skills"+ self._write_skill(skills, "first-skill", "first-skill")+ self._write_skill(skills, "second-skill", "second-skill")++ result = SchemaValidator().validate(tmp_path)++ assert result.passed, result.errors+ assert not [f for f in result.findings if f.check_name == "metadata_id_duplicate"]+ detail = next(d for d in result.success_details if d.check_name == "metadata_id_unique")+ assert detail.message == "2 declared metadata.id value(s) are unique within this collection"++ @pytest.mark.parametrize("include_failure", [False, True])+ def test_folder_api_preserves_child_advisories_once(self, tmp_path: Path, include_failure: bool):+ from skillevaluator import tier1++ skills = tmp_path / "skills"+ team = self._write_skill(skills, "team-skill", "INVALID_ID")+ manifest = team / "SKILL.md"+ manifest.write_text(manifest.read_text().replace("Jane Doe <[email protected]>", "Example Team"))+ missing = self._write_skill(skills, "missing-author", "missing-author")+ manifest = missing / "SKILL.md"+ manifest.write_text(manifest.read_text().replace(" author: Jane Doe <[email protected]>\n", ""))+ if include_failure:+ broken = self._write_skill(skills, "broken-author", "INVALID_ID")+ manifest = broken / "SKILL.md"+ manifest.write_text(manifest.read_text().replace("Jane Doe <[email protected]>", "[email protected]"))++ (result,) = tier1.run_validation(tmp_path, checks="schema")++ expected = [+ ("author_missing", "low"),+ ("author_without_email", "info"),+ ("metadata_id_format", "medium"),+ ]+ if include_failure:+ expected += [("author_format", "high"), ("metadata_id_format", "medium")]+ assert sorted((finding.check_name, finding.severity.value) for finding in result.findings) == sorted(expected)+ assert result.passed is not include_failure+ assert result.summary.warnings == len(result.warnings) == (4 if include_failure else 3)+ assert result.summary.errors == len(result.errors) == int(include_failure)+ assert result.summary.low_count == 1+ assert result.summary.medium_count == (2 if include_failure else 1)+ assert result.summary.high_count == int(include_failure)+ for name in ("team-skill", "missing-author"):+ summaries = [detail for detail in result.success_details if detail.check_name == name]+ assert len(summaries) == 1+ checks = summaries[0].metadata["checks"]+ assert len(checks) == summaries[0].metadata["total_checks"]+ assert len({(check["name"], check["description"]) for check in checks}) == len(checks)+ assert not any(detail.check_name.startswith(f"[{name}]") for detail in result.success_details)++ def test_folder_api_preserves_recommended_id_advisory(self, tmp_path: Path):+ from skillevaluator import tier1+ from skillevaluator.validators.policy import ValidationPolicy++ self._write_skill(tmp_path / "skills", "no-id", None)++ (result,) = tier1.run_validation(+ tmp_path, checks="schema", policy=ValidationPolicy(metadata_id_requirement="recommend")+ )++ assert result.passed+ assert self._id_findings(result) == [("metadata_id_missing", "low")]+ assert result.summary.warnings == len(result.warnings) == 1+ assert result.summary.low_count == 1+++class TestMetadataIdPreviewBounds:+ """A rejected ``metadata.id`` must never be rendered by expanding its value."""++ @staticmethod+ def _alias_bomb(levels: int) -> str:+ lines = ["a0: &a0 [x, x]"]+ lines += [f"a{i}: &a{i} [*a{i - 1}, *a{i - 1}]" for i in range(1, levels + 1)]+ lines.append(f"id: *a{levels}")+ return "\n".join(lines)++ def test_non_string_id_is_described_by_type_not_rendered(self):+ from skillevaluator.validators.schema import _display_metadata_id++ assert _display_metadata_id([1, 2, 3]) == "<list>"+ assert _display_metadata_id(123) == "<int>"+ assert _display_metadata_id(None) == "<NoneType>"+ assert _display_metadata_id(True) == "<bool>"++ def test_yaml_alias_graph_does_not_expand_into_the_finding(self):+ import yaml++ from skillevaluator.validators.schema import _display_metadata_id++ # 30 doubling aliases: repr() of this value is ~2**30 elements, which+ # would exhaust memory. The preview must not build it.+ value = yaml.safe_load(self._alias_bomb(30))["id"]++ preview = _display_metadata_id(value)++ assert preview == "<list>"+ assert len(preview) <= 16++ def test_alias_graph_id_is_rejected_with_a_bounded_finding(self, tmp_path: Path):+ skill_dir = tmp_path / "alias-id"+ skill_dir.mkdir()+ (skill_dir / "SKILL.md").write_text(+ "---\nname: alias-id\ndescription: A skill whose metadata.id is a YAML alias graph\nmetadata:\n"+ + "\n".join(f" {line}" for line in self._alias_bomb(20).splitlines())+ + "\n---\n\n# Alias\n\n## Instructions\n\n1. Run.\n",+ encoding="utf-8",+ )++ result = SchemaValidator().validate(skill_dir)++ findings = [f for f in result.findings if f.check_name == "metadata_id_format"]+ assert len(findings) == 1+ assert "must be a string (got list)" in findings[0].message+ assert len(findings[0].line_content) <= 32++ @pytest.mark.parametrize("id_value", ["&recursive [*recursive]", "&recursive {self: *recursive}"])+ def test_recursive_id_is_rejected_with_bounded_evidence(self, tmp_path: Path, id_value: str):+ skill = TestMetadataIdContract._write_skill(tmp_path, "recursive-id", id_value)++ result = SchemaValidator().validate(skill)++ assert result.passed+ (finding,) = [finding for finding in result.findings if finding.check_name == "metadata_id_format"]+ assert "must be a string" in finding.message+ assert len(finding.line_content) <= 32