AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The vally-tests skill provides a structured workflow for authoring conformance tests for various AI artifacts, including prompts, instructions, agents, and skills. It operates by mapping artifact behaviors to specific Vally grader types, ensuring that tests are both relevant and robust. The skill includes a safety refusal taxonomy to prevent the generation of adversarial or harmful stimuli, and it supports both individual artifact processing and batch processing via corpus imports.
What it does
- Authors conformance test stimuli for prompts, instructions, agents, and skills.
- Routes test stimuli to appropriate Vally evaluation files based on artifact kind.
- Enforces a safety refusal taxonomy to block adversarial or policy-violating content.
- Performs deduplication of stimuli using SHA-256 hashing of normalized prompt text.
- Supports batch processing of test stimuli via CSV or XLSX corpus imports.
- Generates JSON run reports detailing the outcome of the authoring process.
When to use it
- When you need to create conformance tests for a new prompt, instruction, agent, or skill.
- When you have a batch of behaviors that require standardized formatting and deduplication.
- When you need to ensure that authored test stimuli comply with predefined safety and refusal policies.
- When you are working within a Vally-based evaluation environment.
Advantages
- Automates the creation of consistent and structured test stimuli.
- Prevents the accidental inclusion of harmful or prohibited content through a built-in safety taxonomy.
- Ensures test uniqueness through automated deduplication.
- Provides clear routing to the correct evaluation suites for different artifact types.
Usage examples
- “vally-tests mode=from-artifact files=my-agent.agent.md”
- The skill analyzes my-agent.agent.md, selects appropriate conformance checks, and appends the generated stimuli to the corresponding Vally eval file.
- “vally-tests mode=corpus-import path=tests.csv”
- The skill processes each row in the provided CSV, generates the corresponding stimulus blocks, and appends them to the routed eval file after deduplication.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/microsoft/vally-tests/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip vally-tests.zip -d .agents/skills
Documentation by Microsoft
<!-- cspell:ignore roleplay doxxing scaffolder -->
Vally Tests Skill
Purpose
This skill authors Vally conformance tests for the four supported artifact kinds in this repository: prompts, instructions, agents, and skills. Each test exercises a documented behavior the artifact already claims and routes the result through an appropriate Vally grader so failures are explainable. Test authoring is bounded by a refusal taxonomy that keeps the skill out of adversarial, harmful, or policy-evasion territory.
Follow the shared content-policy public-output guard for eval stimuli and any public summaries derived from this skill. Vally tests are not a venue for terms-of-service boundary mapping, payload generation, refusal-text scoring, hidden-instruction disclosure, PII extraction, or secret extraction.
The skill ships:
A canonical authoring workflow that runs directly through
/vally-testsor through theVally Test Authorsubagent.Per-kind reference files that enumerate every conformance check the skill knows how to express.
A grader catalog that maps Vally CLI grader types to the checks they fit, and robustness rules that keep an emitted grader from asserting the impossible or failing correct behavior.
A safety refusal taxonomy with regex patterns the safety lint script consumes.
Helper scripts and asset templates for stimulus emission, corpus import, and dedupe.
When to Invoke
Invoke this skill in one of two modes:
From-artifact mode. The caller points at one or more artifact files (a
.prompt.md,.instructions.md,.agent.md, orSKILL.md) throughfiles, or at the open or attached file whenfilesis omitted, and asks for conformance test stimuli that verify each artifact's stated behaviors. The skill detects the artifact kind from the filename unlesskindoverrides it, looks up the matching per-kind reference, picks graders, and appends stimulus blocks to the routed Vally eval file.Corpus-import mode. The caller supplies a CSV or XLSX corpus through
paththat follows the shipped template, and the skill turns each row into a stimulus block in the routed eval file. Before reading, confirm thatpathexists and ends in.csvor.xlsx; otherwise name the bad path and stop. Every imported row carriestags.advisory: true, and corpus content cannot override it. Used when a large batch of behaviors needs identical formatting and dedupe handling.
After either mode, report the target eval file, stimuli appended, duplicates skipped, refusals triggered, and the JSON run report path.
Do not invoke this skill to:
Generate adversarial probes, jailbreak attempts, prompt-injection payloads, or red-team stimuli.
Test refusal quality on harmful, illegal, or policy-violating prompts.
Author stimuli that elicit PII, secrets, hidden instructions, or model self-disclosure.
Store payload examples, paraphrased prohibited requests, or quoted flagged content in Vally eval specs, corpus rows, PR summaries, issue bodies, or comments.
Replace Responsible AI threat modeling. RAI work lives in the RAI Planner agent.
Authoring Workflow
Each invocation follows the same six-step pipeline:
Artifact-kind detection. Resolve the kind from the artifact path or the corpus row's
kindcolumn. Supported kinds:prompt,instructions,agent,skill. Reject unknown kinds with a refusal block.Reference lookup. Load the matching reference file from
references/and select the check or checks the stimulus exercises. Stage the artifact under test in the stimulus'sagent_environmentso the agent can read what the prompt names.Grader selection. Use
references/grader-catalog.mdas the authoritative selection surface. Pick the registered Vally grader family that directly observes the expected behavior and follow its stimulus-shape guidance.Robustness check. Apply
references/grader-robustness.md. Confirm the stimulus stages every file whose wording the grader asserts, that the pattern constrains order and proximity only where those are the behavior under test, that a compliant agent phrasing the behavior differently still passes, and that no positive grader passes on the prompt text alone. Verify the pattern offline against answers that must pass and answers that must still fail before appending.Safety self-check. Run a safety self-check against the refusal taxonomy regex set. Refusing here is the correct outcome for any stimulus that matches a refusal category.
Dedupe and append. Compute a SHA-256 hash of the normalized prompt text, compare against existing stimuli in the target eval file, and append only when novel.
The pipeline is identical for both invocation modes. Corpus-import mode runs steps 2 through 6 once per row.
Safety Refusal Taxonomy
Authoring is bounded by seven refusal categories. Any stimulus that matches a category's regex set is refused before it reaches the dedupe step. The categories and their normative source are listed below. The full regex set lives in references/refusal-taxonomy.md and is consumed by the safety lint script.
| Category | Definition | Normative Source |
|---|---|---|
| jailbreak | Attempts to bypass model safety policies through persona switching, hypothetical framing, or roleplay coercion. | Project Code of Conduct |
| prompt-injection | Attempts to override system or developer instructions through embedded or external content. | Project Code of Conduct |
| harmful-elicitation | Requests for content that causes physical, financial, psychological, or reputational harm. | Project Code of Conduct |
| tos-violation | Stimuli that solicit content prohibited by GitHub, Microsoft, or model-provider terms of service. | Project Code of Conduct |
| coc-violation | Stimuli that violate this repository's Code of Conduct, including harassment, discrimination, or doxxing. | Project Code of Conduct |
| model-refusal-elicitation | Attempts to provoke a model refusal so the refusal text itself can be scored, graded, or used to map provider boundaries. | RAI Planner guidance |
| pii-extraction | Attempts to elicit personally identifiable information, secrets, credentials, or proprietary training data. | RAI Planner guidance |
When a request triggers a refusal, emit the canonical refusal block:
This skill authors conformance tests only. The request appears to fall under <category>. Please consult <Project Code of Conduct | RAI Planner agent> for the appropriate process.Substitute the matched <category> and the most relevant normative source. Do not negotiate, rephrase, or partially fulfill the request.
Helper Script Index
Helper scripts ship as parity pairs (.ps1 and .sh) where the workflow does not require Python. The safety lint is the exception: it ships only as Lint-VallyTestSafety.ps1, which import_corpus.py invokes, so a single regex engine evaluates the refusal taxonomy. Python is used only for the corpus-import path because the source-of-truth interchange format is CSV with an XLSX mirror.
| Script | Purpose | Language | Delivery |
|---|---|---|---|
scripts/New-Stimulus.ps1 | Scaffolds a single stimulus YAML block from an artifact path and appends to the routed eval file. | PowerShell 7+ | Phase 2 |
scripts/new-stimulus.sh | Parity counterpart for the PowerShell stimulus scaffolder. | bash | Phase 2 |
scripts/import_corpus.py | Reads the CSV or XLSX corpus template and emits dedupe-checked stimulus blocks per kind. | Python 3.11+ | Phase 2 |
scripts/Lint-VallyTestSafety.ps1 | Runs the refusal taxonomy regex set against a candidate stimulus and exits non-zero on match. | PowerShell 7+ | Phase 3 |
All helpers honour a shared dedupe contract: SHA-256 of the prompt text after Unicode NFC normalization and whitespace collapse.
The helpers emit a JSON run report to logs/vally-test-author-<timestamp>.json, where <timestamp> is YYYYMMDD-HHMMSS (UTC). The report captures, at minimum: mode; inputs (the resolved files/path and kind); target_eval_file; stimuli_appended (count and per-row hash); dedupe_results (count and per-row hash for skipped duplicates); refusal_check (per-row category match, if any); safety_lint_exit_code; blockers (any ambiguous safety-lint outcomes surfaced for review); and written_paths.
Reference Index
References capture the conformance taxonomy, grader selection rules, eval-suite routing, and the regex source of truth for the refusal taxonomy. Each file targets a specific decision point in the authoring workflow.
| Reference | Covers |
|---|---|
| prompts.md | The 12 conformance checks emitted for .prompt.md artifacts. |
| instructions.md | The 8 conformance checks emitted for .instructions.md artifacts. |
| agents.md | The 9 conformance checks emitted for .agent.md artifacts. |
| skills.md | The 9 conformance checks emitted for SKILL.md artifacts. |
| grader-catalog.md | Vally CLI grader types, selection rules, and gotchas. |
| grader-robustness.md | Mounting, order and proximity limits, negation guards, prompt-echo checks, and the pre-commit probe. |
| refusal-taxonomy.md | Regex source of truth for the 7 refusal categories and worked examples. |
| eval-suite-routing.md | Maps artifact kind to the canonical Vally eval file under evals/. |
Asset Index
Assets supply the interchange formats the corpus-import path consumes. The CSV is the source of truth. The XLSX mirror is regenerated from the CSV by import_corpus.py and is never edited directly.
| Asset | Purpose |
|---|---|
assets/corpus-import-template.csv | Canonical CSV template with header prompt,kind,target_artifact,grader,tags,expected_refusal_category,notes. |
assets/corpus-import-template.xlsx | Excel mirror of the CSV regenerated by the import script. |
Output Targets per Kind
Authored stimuli always land in one of the routed Vally eval files. The router is encoded in references/eval-suite-routing.md and mirrored here for quick lookup.
| Kind | Target Eval File | Vally Suite Name |
|---|---|---|
| prompt | evals/behavior-conformance/prompts.eval.yaml | behavior-conformance |
| instructions | evals/behavior-conformance/instructions.eval.yaml | behavior-conformance |
| agent | evals/agent-behavior/eval.yaml | agent-behavior |
| skill | evals/behavior-conformance/skill-behavior.eval.yaml | behavior-conformance |
The prompt target is created on first use when a repository has no prompt stimuli yet.
Never write to evals/baseline-equivalence/, evals/script-validation/, or evals/results/ from this skill. Those targets serve baseline equivalence, script validation, and historical comparison flows that are out of scope for conformance authoring.
Contributing
Follow these conventions when extending this skill:
New per-kind checks belong in the matching
references/{kind}.mdfile. Bump the check count in this SKILL.md when the reference adds or removes checks.New grader types belong in
references/grader-catalog.mdand only after the matching Vally CLI version is pinned inpackage.jsondevDependencies.New refusal categories require updates to
references/refusal-taxonomy.md, the regex set the safety lint script consumes, the Safety Refusal Taxonomy table above, and the canonical refusal block.Helper scripts must ship in parity pairs (
.ps1and.sh) unless the workflow has a hard Python dependency. The safety lint is the one exception and ships only asLint-VallyTestSafety.ps1; do not add a bash mirror. Python helpers live underscripts/and are configured by the skill'spyproject.toml.
Files
- ATTRIBUTION.mdAdded by AutoGineer827 B
- LICENSELicence file added by AutoGineer1.1 KiB
- SKILL.md14.2 KiB
- assets/.gitkeep0 B
- assets/corpus-import-template.csv923 B
- assets/corpus-import-template.xlsx136.0 KiB
- assets/grader-template.yml1.9 KiB
- assets/stimulus-template.yml2.0 KiB
- pyproject.toml577 B
- references/agents.md16.3 KiB
- references/eval-suite-routing.md6.9 KiB
- references/grader-catalog.md30.5 KiB
- references/grader-robustness.md8.6 KiB
- references/instructions.md8.9 KiB
- references/prompts.md11.8 KiB
- references/refusal-taxonomy.md12.5 KiB
- references/skills.md10.9 KiB
- scripts/Lint-VallyTestSafety.ps1Script4.1 KiB
- scripts/New-Stimulus.ps1Script6.3 KiB
- scripts/Select-Grader.ps1Script3.1 KiB
- scripts/import_corpus.pyScript14.9 KiB
- scripts/new-stimulus.shScript5.3 KiB
- scripts/select-grader.shScript2.8 KiB
- tests/Lint-VallyTestSafety.Tests.ps1Script4.0 KiB
- tests/New-Stimulus.Tests.ps1Script11.3 KiB
- tests/Select-Grader.Tests.ps1Script2.6 KiB
- tests/__init__.pyScript139 B
- tests/corpus/0_normalize_prompt19 B
- tests/corpus/1_hash_prompt24 B
- tests/corpus/2_validate_row77 B
- tests/corpus/3_build_patch_entry63 B
- tests/corpus/4_load_existing_hashes75 B
- tests/corpus/README.md1.3 KiB
- tests/fuzz_harness.pyScript6.9 KiB
- tests/test_import_corpus.pyScript12.3 KiB
- tests/test_lint_safety.pyScript3.6 KiB
- uv.lock73.5 KiB
scripts/import_corpus.py
#!/usr/bin/env python3
# Copyright (c) 2026 Microsoft Corporation. All rights reserved.
# SPDX-License-Identifier: MIT
"""Vally corpus importer.
Reads a CSV or XLSX file matching the canonical column contract, validates each
row, runs the skill-local safety lint as a per-row subprocess, normalizes prompts
(trim + lowercase + collapse-whitespace), hashes them with SHA-256, dedupes
against an optional target eval YAML, and emits both an append-only YAML patch
and a JSON report. Every accepted row is forced to ``tags.advisory: true``.
"""
from __future__ import annotations
import argparse
import csv
import hashlib
import json
import re
import subprocess
import sys
import tempfile
import unicodedata
from collections.abc import Iterable, Iterator
from dataclasses import dataclass, field
from datetime import datetime, timezone
from pathlib import Path
import yaml.reader
REQUIRED_COLUMNS: tuple[str, ...] = (
"prompt",
"kind",
"target_artifact",
"grader",
"tags",
"expected_refusal_category",
"notes",
)
ALLOWED_KINDS: frozenset[str] = frozenset({"agent", "prompt", "instructions", "skill"})
EXISTING_HASH_RE = re.compile(r"#\s*sha256:([0-9a-f]{64})", re.IGNORECASE)
SAFETY_CATEGORY_RE = re.compile(r"category=(\S+)")
class CorpusImportError(RuntimeError):
"""Raised on irrecoverable corpus-import errors (caller exits non-zero)."""
@dataclass
class ImportReport:
source: str
target: str | None
patch_path: str
timestamp: str
accepted: list[dict[str, object]] = field(default_factory=list)
rejected: list[dict[str, object]] = field(default_factory=list)
flagged: list[dict[str, object]] = field(default_factory=list)
duplicates: list[dict[str, object]] = field(default_factory=list)
def totals(self) -> dict[str, int]:
return {
"accepted": len(self.accepted),
"rejected": len(self.rejected),
"flagged": len(self.flagged),
"duplicates": len(self.duplicates),
}
def to_dict(self) -> dict[str, object]:
return {
"source": self.source,
"target": self.target,
"patch_path": self.patch_path,
"timestamp": self.timestamp,
"totals": self.totals(),
"accepted": self.accepted,
"rejected": self.rejected,
"flagged": self.flagged,
"duplicates": self.duplicates,
}
def normalize_prompt(value: str) -> str:
"""Apply NFC + trim + lowercase + whitespace-collapse for dedupe hashing."""
if value is None:
return ""
nfc = unicodedata.normalize("NFC", str(value))
return re.sub(r"\s+", " ", nfc.strip().lower())
def hash_prompt(normalized: str) -> str:
return hashlib.sha256(normalized.encode("utf-8")).hexdigest()
def _strip(value: object) -> str:
if value is None:
return ""
return str(value).strip()
def read_csv_rows(path: Path) -> Iterator[dict[str, str]]:
with path.open("r", encoding="utf-8-sig", newline="") as handle:
reader = csv.DictReader(handle)
if reader.fieldnames is None:
raise CorpusImportError(f"{path}: no header row")
missing = [c for c in REQUIRED_COLUMNS if c not in reader.fieldnames]
if missing:
raise CorpusImportError(
f"{path}: missing required columns: {', '.join(missing)}"
)
for row in reader:
yield {k: _strip(v) for k, v in row.items()}
def read_xlsx_rows(path: Path) -> Iterator[dict[str, str]]:
try:
from openpyxl import load_workbook # noqa: PLC0415
except ImportError as exc: # pragma: no cover
raise CorpusImportError("openpyxl is required to import .xlsx files") from exc
workbook = load_workbook(filename=str(path), read_only=True, data_only=True)
sheet = workbook.active
if sheet is None:
raise CorpusImportError(f"{path}: workbook has no active sheet")
header_iter = sheet.iter_rows(min_row=1, max_row=1, values_only=True)
header_row = next(header_iter, None)
if header_row is None:
raise CorpusImportError(f"{path}: no header row")
headers = [_strip(cell) for cell in header_row]
missing = [c for c in REQUIRED_COLUMNS if c not in headers]
if missing:
raise CorpusImportError(
f"{path}: missing required columns: {', '.join(missing)}"
)
for row in sheet.iter_rows(min_row=2, values_only=True):
if not any(cell is not None and str(cell).strip() != "" for cell in row):
continue
yield {
headers[index]: _strip(cell)
for index, cell in enumerate(row)
if index < len(headers) and headers[index]
}
def read_rows(path: Path) -> Iterator[dict[str, str]]:
suffix = path.suffix.lower()
if suffix == ".csv":
return read_csv_rows(path)
if suffix in {".xlsx", ".xlsm"}:
return read_xlsx_rows(path)
raise CorpusImportError(f"{path}: unsupported suffix '{suffix}'; use .csv or .xlsx")
def validate_row(row: dict[str, str], line_no: int) -> str | None:
if not row.get("prompt"):
return f"row {line_no}: empty prompt"
if not row.get("target_artifact"):
return f"row {line_no}: empty target_artifact"
kind = row.get("kind", "")
if kind not in ALLOWED_KINDS:
return f"row {line_no}: kind '{kind}' not in {sorted(ALLOWED_KINDS)}"
return None
def safety_check(
prompt: str,
lint_script: Path,
*,
pwsh: str = "pwsh",
timeout_seconds: float = 60.0,
) -> dict[str, object]:
"""Run the skill-local safety lint against a single prompt string."""
if not lint_script.exists():
return {
"exit_code": -1,
"output": f"safety lint not found: {lint_script}",
"category": None,
}
tmp = tempfile.NamedTemporaryFile(
"w", suffix=".txt", delete=False, encoding="utf-8"
)
try:
tmp.write(prompt)
tmp.close()
tmp_path = Path(tmp.name)
try:
result = subprocess.run(
[pwsh, "-NoProfile", "-File", str(lint_script), str(tmp_path)],
capture_output=True,
text=True,
timeout=timeout_seconds,
check=False,
)
except FileNotFoundError:
return {
"exit_code": -1,
"output": f"executable not found: {pwsh}",
"category": None,
}
except subprocess.TimeoutExpired as exc:
return {
"exit_code": -1,
"output": f"safety lint timed out after {exc.timeout}s",
"category": None,
}
finally:
try:
Path(tmp.name).unlink(missing_ok=True)
except OSError:
# Temp file already removed or inaccessible; nothing to clean up.
pass
output = ((result.stdout or "") + (result.stderr or "")).strip()
match = SAFETY_CATEGORY_RE.search(output)
return {
"exit_code": result.returncode,
"output": output,
"category": match.group(1) if match else None,
}
def load_existing_hashes(target_path: Path | None) -> set[str]:
if target_path is None or not target_path.exists():
return set()
text = target_path.read_text(encoding="utf-8")
return {match.group(1).lower() for match in EXISTING_HASH_RE.finditer(text)}
def _indent_block(text: str, prefix: str) -> str:
lines = text.splitlines() or [""]
return "".join(f"{prefix}{line}\n" for line in lines)
# Characters PyYAML rejects when reading a stream. Reuse the reader's own
# NON_PRINTABLE pattern so this matches PyYAML exactly: a prompt containing any
# of these bytes cannot ride in a literal block scalar and must be emitted as a
# double-quoted scalar instead.
_YAML_NON_PRINTABLE = yaml.reader.Reader.NON_PRINTABLE
def _yaml_scalar(value: str) -> str:
"""Render a string as a safely-quoted YAML scalar.
``json.dumps`` emits a double-quoted form whose quoting and escaping are
valid YAML, so YAML-significant characters (``:``, ``#``, leading ``-``,
quotes, embedded newlines) cannot corrupt the surrounding document.
"""
return json.dumps(value)
def _comment_value(value: str) -> str:
"""Collapse line breaks so an interpolated value stays on one comment line.
A bare newline in a YAML comment terminates the comment, so unsanitized
values could inject document content. Replacing line breaks with spaces
keeps the comment single-line and inert.
"""
return value.replace("\r\n", " ").replace("\r", " ").replace("\n", " ")
def _block_scalar_safe(prompt: str) -> bool:
"""Return True when ``prompt`` can ride safely in a literal block scalar.
A literal block scalar auto-detects its content indentation from the first
non-empty line. A leading empty line, or a first line carrying leading
whitespace, makes that detection ambiguous: a later, less-indented line
de-indents below the detected level, terminates the scalar early, and
corrupts the surrounding block mapping. Control characters cannot survive a
literal block scalar at all. Such prompts must use a double-quoted scalar.
"""
if _YAML_NON_PRINTABLE.search(prompt):
return False
lines = prompt.splitlines()
if not lines:
return False
first = lines[0]
return first != "" and first[0] not in " \t"
def build_patch_entry(row: dict[str, str], digest: str) -> str:
prompt = row["prompt"]
if _block_scalar_safe(prompt):
prompt_lines = ["- prompt: |\n", _indent_block(prompt, " ")]
else:
# Fall back to a double-quoted scalar so the patch round-trips through
# yaml.safe_load even when a literal block scalar would be ambiguous.
prompt_lines = [f"- prompt: {_yaml_scalar(prompt)}\n"]
parts: list[str] = [
f"# sha256:{digest}\n",
f"# kind:{_comment_value(row['kind'])}\n",
f"# target:{_comment_value(row['target_artifact'])}\n",
*prompt_lines,
f" grader: {_yaml_scalar(row['grader'] or '<unset>')}\n",
" tags:\n",
]
raw_tags = row.get("tags", "")
if raw_tags:
parts.append(f" raw: {_yaml_scalar(raw_tags)}\n")
parts.append(" advisory: true\n")
expected = row.get("expected_refusal_category", "")
if expected:
parts.append(f" expected_refusal_category: {_yaml_scalar(expected)}\n")
notes = row.get("notes", "")
if notes:
parts.append(f" notes: {_yaml_scalar(notes)}\n")
return "".join(parts)
def import_corpus(
source: Path,
*,
target: Path | None = None,
report_dir: Path,
lint_script: Path,
skip_safety: bool = False,
pwsh: str = "pwsh",
now: datetime | None = None,
) -> tuple[ImportReport, Path, Path]:
if not source.exists():
raise CorpusImportError(f"source file not found: {source}")
report_dir.mkdir(parents=True, exist_ok=True)
timestamp = (now or datetime.now(timezone.utc)).strftime("%Y%m%dT%H%M%SZ")
report_path = report_dir / f"vally-test-author-import-{timestamp}.json"
patch_path = report_dir / f"vally-test-author-import-{timestamp}.patch.yml"
report = ImportReport(
source=str(source),
target=str(target) if target else None,
patch_path=str(patch_path),
timestamp=timestamp,
)
existing_hashes = load_existing_hashes(target)
accepted_blocks: list[str] = []
rows: Iterable[dict[str, str]] = read_rows(source)
for index, row in enumerate(rows, start=2): # header is line 1
error = validate_row(row, index)
if error:
report.rejected.append({"line": index, "reason": error, "row": row})
continue
if not skip_safety:
safety = safety_check(row["prompt"], lint_script, pwsh=pwsh)
if safety["exit_code"] != 0:
report.flagged.append({"line": index, "safety": safety, "row": row})
continue
normalized = normalize_prompt(row["prompt"])
digest = hash_prompt(normalized)
if digest in existing_hashes:
report.duplicates.append({"line": index, "sha256": digest, "row": row})
continue
existing_hashes.add(digest)
accepted_blocks.append(build_patch_entry(row, digest))
report.accepted.append({"line": index, "sha256": digest, "row": row})
patch_path.write_text("\n".join(accepted_blocks), encoding="utf-8")
report_path.write_text(
json.dumps(report.to_dict(), indent=2, sort_keys=False) + "\n",
encoding="utf-8",
)
return report, report_path, patch_path
def _default_lint_script() -> Path:
return Path(__file__).resolve().parent / "Lint-VallyTestSafety.ps1"
def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
prog="import_corpus",
description=(
"Import a Vally corpus CSV/XLSX into an append-only patch "
"with safety + dedupe gating."
),
)
parser.add_argument(
"source",
help="CSV or XLSX source file matching the canonical column contract.",
)
parser.add_argument(
"--target",
default=None,
help="Existing eval YAML for dedupe comparison (optional).",
)
parser.add_argument(
"--report-dir",
default="logs",
help="Directory for JSON report + patch output. Default: logs/.",
)
parser.add_argument(
"--lint-script",
default=None,
help=(
"Override path to the skill-local Lint-VallyTestSafety.ps1. "
"Default: sibling script next to import_corpus.py."
),
)
parser.add_argument(
"--pwsh",
default="pwsh",
help="Executable to invoke for the safety lint. Default: pwsh.",
)
parser.add_argument(
"--skip-safety",
action="store_true",
help=(
"Skip the per-row safety lint subprocess (for offline test environments)."
),
)
return parser
def main(argv: list[str] | None = None) -> int:
parser = build_parser()
args = parser.parse_args(argv)
source = Path(args.source).resolve()
target = Path(args.target).resolve() if args.target else None
report_dir = Path(args.report_dir).resolve()
lint_script = (
Path(args.lint_script).resolve() if args.lint_script else _default_lint_script()
)
try:
report, report_path, patch_path = import_corpus(
source,
target=target,
report_dir=report_dir,
lint_script=lint_script,
skip_safety=args.skip_safety,
pwsh=args.pwsh,
)
except CorpusImportError as exc:
print(f"error: {exc}", file=sys.stderr)
return 2
totals = report.totals()
print(f"report: {report_path}")
print(f"patch: {patch_path}")
print(" ".join(f"{key}={value}" for key, value in totals.items()))
return 0 if (totals["rejected"] == 0 and totals["flagged"] == 0) else 1
if __name__ == "__main__":
sys.exit(main())
Requirements and compatibility
Written for: GitHub Copilot, Claude Code
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Claude Code frontmatter, Needs Python
The author says: Requires Vally CLI 0.15.0+, PowerShell 7+, bash, and Python 3.11+ with uv for corpus-import workflows
Security
What our scanner noticed· Low risk
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Microsoft
- Publisher
- Microsoft (Official)
- Source
- microsoft/hve-core · .github/skills/hve-core/vally-tests · commit f425e94
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Microsoft or Microsoft.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download vally-tests.zip