Rust Harness Policy
Use this skill when onboarding to this repository or when compact harness output
does not give enough context to repair src/ or tests/ Rust code directly.
Do not reread it on every run after the relevant code-level policy and skill
bindings are configured.
Operating Contract
- Treat the native Rust parser as the fact layer. New policy behavior must
consume parser/discovery facts, not raw string scans or ad hoc file lists.
- Do not compete with rustc, rustfmt, or Clippy. Harness policy covers
LLM/Agent structural risk: owner drift, module shape, unclear edit surfaces,
special-file bloat, oversized files, unclear dependency paths, compact repair
output, and verification obligations.
- Keep compact text Agent-facing. Avoid human audit headers such as package
counts, file counts, parsed counts, source-root summaries, empty sections, and
success prose. Clean compact output should stay minimal.
- Keep
src/ and tests/ fully inside harness self-apply. A policy change that
would let cargo test or cargo test --lib escape the harness is a regression.
- Prefer owner-level APIs and
crate::... paths over broad scope imports.
super::super and broad glob imports are structural clarity risks for this
repository even when Rust permits them.
- Keep medium or complex work folder-first. If a file starts collecting several
unrelated responsibilities, split by parser, rule, renderer, profile, fixture,
or snapshot ownership.
- Every new policy shape needs focused tests and, where compact text changes,
an insta snapshot.
Parser-First Checklist
- Add or extend parser facts first.
- Deduplicate facts at the parser/discovery boundary when the policy would
otherwise need local deduplication.
- Preserve line numbers and test-context metadata when diagnostics or policies
depend on them.
- Let rules ask precise questions of the fact model instead of rediscovering
path or syntax relationships.
Validation
Run the repository validation set before committing code changes:
direnv exec . cargo test
direnv exec . cargo fmt --check
direnv exec . cargo clippy --all-targets -- -D warnings
git diff --check
For docs-only skill updates, git diff --check is the minimum. If the update
changes executable examples or validation instructions, run the full set.
GitHub Actions should be checked for Ubuntu and Windows. A pending macOS check
can be ignored while the project account has no macOS Actions quota.
1---2name: rust-harness-policy3description: Use when modifying rust-lang-project-harness Rust source, tests, policy rules, parser facts, renderers, or snapshots.4---56# Rust Harness Policy78Use this skill when onboarding to this repository or when compact harness output9does not give enough context to repair `src/` or `tests/` Rust code directly.10Do not reread it on every run after the relevant code-level policy and skill11bindings are configured.1213## Operating Contract1415- Treat the native Rust parser as the fact layer. New policy behavior must16 consume parser/discovery facts, not raw string scans or ad hoc file lists.17- Do not compete with rustc, rustfmt, or Clippy. Harness policy covers18 LLM/Agent structural risk: owner drift, module shape, unclear edit surfaces,19 special-file bloat, oversized files, unclear dependency paths, compact repair20 output, and verification obligations.21- Keep compact text Agent-facing. Avoid human audit headers such as package22 counts, file counts, parsed counts, source-root summaries, empty sections, and23 success prose. Clean compact output should stay minimal.24- Keep `src/` and `tests/` fully inside harness self-apply. A policy change that25 would let `cargo test` or `cargo test --lib` escape the harness is a regression.26- Prefer owner-level APIs and `crate::...` paths over broad scope imports.27 `super::super` and broad glob imports are structural clarity risks for this28 repository even when Rust permits them.29- Keep medium or complex work folder-first. If a file starts collecting several30 unrelated responsibilities, split by parser, rule, renderer, profile, fixture,31 or snapshot ownership.32- Every new policy shape needs focused tests and, where compact text changes,33 an insta snapshot.3435## Parser-First Checklist3637- Add or extend parser facts first.38- Deduplicate facts at the parser/discovery boundary when the policy would39 otherwise need local deduplication.40- Preserve line numbers and test-context metadata when diagnostics or policies41 depend on them.42- Let rules ask precise questions of the fact model instead of rediscovering43 path or syntax relationships.4445## Validation4647Run the repository validation set before committing code changes:4849```shell50direnv exec . cargo test51direnv exec . cargo fmt --check52direnv exec . cargo clippy --all-targets -- -D warnings53git diff --check54```5556For docs-only skill updates, `git diff --check` is the minimum. If the update57changes executable examples or validation instructions, run the full set.5859GitHub Actions should be checked for Ubuntu and Windows. A pending macOS check60can be ignored while the project account has no macOS Actions quota.