author-rust-test
ALWAYS invoke this skill when writing or fixing tests for Rust. NEVER write or fix Rust tests without this skill.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 1
- Forks
- 1
01 前言 Front Matter
- name
- author-rust-test
- description
- ALWAYS invoke this skill when writing or fixing tests for Rust. NEVER write or fix Rust tests without this skill.
- allowed-tools
- Read, Glob, Grep, Write, Edit, {{! tool('use_skill') !}}, Bash(cargo test:*), Bash(cargo check:*), Bash(cargo clippy:*), Bash(cargo fmt --check:*), Bash(cargo llvm-cov:*), Bash(spx validation:*), Bash(just test:*), Bash(just check:*), Bash(just verify:*), Bash(just validate:*)
03 SKILL.md 正文
{!% require_skill 'rust:rust-code-standards' %!}
{!% require_skill 'rust:rust-test-standards' %!}
{!% require_skill 'product-tree:test' %!}
<objective>
Rust tests for what the /test router selected, at the chosen level.
</objective>
<prerequisites>
The /test router, /rust-code-standards, and /rust-test-standards are pre-loaded above.
Before writing or revising tests, also check:
spx/local/rust.mdat the repository root, if presentspx/local/rust-tests.mdat the repository root, if present
</prerequisites>
<workflow>
- Load the governing spec context before editing any co-located
spx/.../tests/file. - Map each assertion to the assertion type and level chosen by
/test. - Apply the
/testsource-contract-first gate: read the assertion, the existing or planned test, and the Rust code under test; state the production contract the evidence exercises. - If the source does not expose the enum, constructor, trait boundary, parser entry point, registry, schema, or observable behavior the assertion needs, fix the source contract before writing test predicates.
- Use the
<router_mapping>and examples in/rust-test-standardsto choose the Rust implementation shape. - Keep every predicate and assertion macro in the linked test function or callback. Permit
const,static,let, framework fixture parameters, and property-generated parameters that only receive actual results, source contracts, generated values, harness observations, callback inputs, resource handles, or fixture paths; reject bindings that choose data, expectations, configuration, setup policy, generator domains, fixture contents, or verdict rules. - Keep test infrastructure — harnesses, generators, and inert fixtures — in the canonical
<product>-testinglocation prescribed by/rust-test-standards. A repo-local overlay may route to a governing product spec or decision that explicitly amends this contract; the overlay does not redefine the location itself. - Run the repository's Rust validation commands before reporting the tests complete.
</workflow>
<router_mapping>
After running through /test, use the canonical mapping in /rust-test-standards:
| Router Decision | Rust implementation summary |
|---|---|
| Stage 2 -> Level 1 | pure functions, temp dirs, hand-written trait impls |
| Stage 2 -> Level 2 | real binaries, local adapters, async runtimes, local services |
| Stage 2 -> Level 3 | remote APIs, deployed workflows, browser automation, shared environments |
| Stage 3A | direct pure-function tests |
| Stage 3B | extracted pure function plus outer boundary evidence |
| Stage 5 exceptions | controlled implementations that preserve the real seam |
| compile-time contract | compile-fail evidence |
| universal invariant | property-based evidence |
</router_mapping>
<reference_guides>
All Rust test examples are owned by /rust-test-standards:
/rust-test-standards<level_1_patterns>/rust-test-standards<property_and_compile_time_patterns>/rust-test-standards<level_2_patterns>/rust-test-standards<level_3_patterns>/rust-test-standardsreferences/level-1.md/rust-test-standardsreferences/level-2.md/rust-test-standardsreferences/level-3.md
</reference_guides>
<success_criteria> Rust test work is complete when:
/testchose the assertion type and target level first- the source-contract-first gate was applied before test predicates were written or repaired
/rust-code-standardsand/rust-test-standardswere loaded before test code was written- the test shape follows the canonical Rust test standard and repo-local overlays
- executed test functions and callbacks own every predicate and assertion macro
- test-file bindings introduce no case data, expectation, configuration, setup policy, generator domain, fixture content, or verdict rule
- controlled implementations preserve coupling to the real seam
- property claims use property-based testing
- compile-time claims use compile-fail evidence
- repository validation passes or any unavailable validation tool is reported explicitly
</success_criteria>
04 同仓库更多 Skills
plugin
暂无简介
sanitize-powerpoint
ALWAYS invoke this skill when sanitizing, cleaning up, auditing, or aligning a PowerPoint (.pptx) deck — slide-master and layout structure, layout type attributes, stray fonts, non-theme colors, or layout naming. NEVER hand-edit pptx XML without this skill.
draw-excalidraw
ALWAYS invoke this skill when creating Excalidraw diagrams, visualizing workflows, architectures, or concepts. NEVER generate Excalidraw JSON without this skill.
typescript-test-standards
TypeScript test standards enforced across all skills. Loaded by other skills, not invoked directly.
typescript-code-standards
TypeScript code standards enforced across all skills. Loaded by other skills, not invoked directly.
typescript-architecture-standards
TypeScript ADR conventions enforced across architect and auditor skills. Loaded by other skills, not invoked directly.