unsafe-rust
Skill2.6k starsChanged 3 months agoApache-2.0View on GitHub
Author, document, review, or audit unsafe Rust with proof-grade rigor. Use for unsafe blocks and functions, unsafe traits and impls, raw pointers, FFI, inline assembly, intrinsics, layout or validity reasoning, concurrency and atomics, SIMD and target features, allocators, invariant-bearing fields, safety comments or `# Safety` documentation, soundness reviews, TCB audits, generated unsafe code, and changes to safety or behavioral contracts.
1 other project uses a version of this.
Trending
Quiet since October.about the whole repository
Most recently taken up by
- rewrite-rs/skillstheir own version, first seen Aug 16, 2026
Who's talking about google/zerocopy
- rust-lang/rust“Tracking Issue for `f16` and `f128` float types”GitHub · Oct 18, 2023 · 132 reactions
- rust-lang/rust“Expose the `Freeze` trait again (unstably) and forbid implementing it manually”GitHub · Feb 23, 2024 · 11 reactions
- rust-random/rand“Tracker: rand 0.9”GitHub · Aug 24, 2021 · 8 reactions
- rust-lang/rust“Expose the Freeze trait again (unstably) and forbid implementing it manually”GitHub · Mar 1, 2024 · 6 reactions
- @rusttrending.bsky.social“google / zerocopy: Zerocopy makes zero-cost memory manipulation effortless. We write `unsafe` so you don’t …”Bluesky · Jul 4, 2026 · 2 likes
The biggest 5 of 26 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 26
Talked about on GitHub, Bluesky and Hacker News (26 times).
On GitHub · 23
- Oct 18, 2023Tracking Issue for `f16` and `f128` float types — rust-lang/rust132 reactions · 47 comments
- Feb 23, 2024Expose the `Freeze` trait again (unstably) and forbid implementing it manually — rust-lang/rust11 reactions · 20 comments
- Aug 24, 2021Tracker: rand 0.9 — rust-random/rand8 reactions · 47 comments
- Mar 1, 2024Expose the Freeze trait again (unstably) and forbid implementing it manually — rust-lang/rust6 reactions · 5 comments
- Jan 12, 2026Allow derives to `allow(non_ascii_idents)` at the non-crate level — rust-lang/rust2 reactions · 5 comments
18 more on GitHub
- Oct 11, 2024Add support for zerocopy trait impls — tokio-rs/bytes2 reactions · 13 comments
- Oct 3, 2026chore(deps): bump the cargo group across 1 directory with 3 updates — splotlabs/splot1 reaction
- Sep 28, 2026chore(deps): bump the cargo group across 1 directory with 10 updates — oxidezap/whatsapp-rust1 reaction · 3 comments
- Sep 19, 2026chore(deps): bump the cargo group across 1 directory with 2 updates — splotlabs/splot1 reaction
- Sep 14, 2026chore(deps): bump the cargo group with 8 updates — oxidezap/whatsapp-rust1 reaction · 3 comments
- Aug 11, 2026build(deps): bump zerocopy from 0.8.55 to 0.8.56 — oxidezap/whatsapp-rust1 reaction · 1 comment
- Aug 7, 2026chore(deps): bump zerocopy from 0.7.35 to 0.8.55 — duketopceo/kurultai1 reaction · 2 comments
- Aug 1, 2026build(deps): bump the cargo group with 4 updates — splotlabs/splot1 reaction
- Jul 21, 2026chore(deps): bump zerocopy from 0.8.54 to 0.8.55 — oxidezap/whatsapp-rust1 reaction · 2 comments
- Jul 18, 2026build(deps): bump the cargo group with 2 updates — splotlabs/splot1 reaction
- Jun 20, 2026build(deps): bump zerocopy from 0.8.50 to 0.8.52 in the cargo group — splotlabs/splot1 reaction
- Jun 13, 2026build(deps): bump the rust-dependencies group across 1 directory with 3 updates — ness-e/Vantadb1 reaction · 1 comment
- Jun 6, 2026chore(deps): bump the patches group across 1 directory with 16 updates — vectordotdev/vrl1 reaction
- Jun 1, 2026chore(deps): bump the patches group with 11 updates — vectordotdev/vrl1 reaction · 1 comment
- Mar 12, 2026Feature request: Publish pre-builts on GitHub — AeneasVerif/aeneas1 reaction · 5 comments
- Nov 5, 2025`undocumented_unsafe_blocks` false positive despite `accept-comment-above-attributes = true` — rust-lang/rust-clippy1 reaction · 2 comments
- Oct 20, 2024Derive macros are unsound — Lokathor/bytemuck1 reaction · 9 comments
- May 6, 2024`unexpected_cfgs` lint doesn't recognize some standard `cfg`s — rust-lang/rust1 reaction · 2 comments
On Bluesky · 2
- Jul 4, 2026google / zerocopy: Zerocopy makes zero-cost memory manipulation effortless. We write `unsafe` so you don’t have to. ★2472… — @rusttrending.bsky.social2 likes and reposts
- Sep 30, 2024google / zerocopy: ★1288 https://github.com/google/zerocopy — @rusttrending.bsky.social1 likes and repost
On Hacker News · 1
- Oct 9, 2024Zerocopy 0.81 point · 1 comment
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- rewrite-rs/skills★ 5same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository13 other files it gives its agents.
- anneal/AGENTS.mdAGENTS.md
- anneal/v1/AGENTS.mdAGENTS.md
- zerocopy/AGENTS.mdAGENTS.md
- anneal/v1/llms-full.txtllms.txt
- anneal/v1/llms.txtllms.txt
- unsafe-rustSkill
- unsafe-rustSkill
- unsafe-rustSkill
- unsafe-rustSkill
- unsafe-rustSkill
- unsafe-rustSkill
- zerocopy-developmentSkill
- zerocopy-reviewSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 13 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Treat each safety contract as an English-language theorem and each safety comment as its proof.
- Distinctive: line 58
Do not promote this skill, the Rustonomicon, Unsafe Code Guidelines, RFCs, blogs, issue discussions, implementation behavior, Miri, or …
- Distinctive: line 69
When no admissible direct or derived proof can be completed because authoritative documentation is ambiguous or insufficient, identify the …
- Distinctive: line 79
Read the controlling contract according to its actual text.
- Distinctive: line 115
Close composition: Ensure every literal contract clause and safe surface has a disposition, every premise consumed by unsafe code has an …
- Distinctive: line 120
Report exactly: Keep unresolved obligations visible and state the smallest missing implication.
- Very specific: line 125
Do not require a concrete UB counterexample to reject an incomplete proof.
- Very specific: line 131
Read proof-obligations.md before authoring or reviewing an unsafe contract, invariant, SAFETY comment, or local proof.
- Distinctive: line 134
Keep each proof adjacent to the smallest cohesive unsafe operation or assertion.
- Distinctive: line 139
When existing code can be validated only by reconstructing a material derivation absent from its safety comment, do not accept it silently.
- Distinctive: line 160
Treat caller-provided safe code as adversarial within the behaviors permitted by safe Rust and its types.
- Distinctive: line 168
Every supported combination of compilation options that can ship downstream must be sound.
- Distinctive: line 174
Read tcb-and-evidence.md for every full audit and whenever a proof uses dependencies, external specifications, tools, testing, formal …
- Distinctive: line 185
Read audit-reporting.md before delivering a persistent or full audit.
- Distinctive: line 188
PROVED: Every obligation for the exact named claim is discharged over its complete applicability, relative to the stated TCB.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Unsafe Rust Authoring and Audit
Treat each safety contract as an English-language theorem and each safety comment as its proof. Reject hand-waving, folklore, hidden assumptions, and proof by testing.
Establish the Exact Claim
Unless the user specifies a narrower claim, establish:
For the exact audited source snapshot, every supported compilation configuration, every valid in-scope use in a context satisfying all out-of-scope safety obligations preserves freedom from Rust undefined behavior under the documented Rust abstract semantics, and every mandatory in-scope documented postcondition holds, assuming only the explicitly recorded trusted computing base (TCB).
Interpret valid use as follows:
- For a safe API, quantify over every well-typed safe use. Impose no hidden safety precondition.
- For an unsafe API, quantify over every use satisfying all documented initial, ongoing, and terminal safety obligations.
- For a binary or other entrypoint, quantify over executions satisfying the explicitly recorded deployment assumptions. Do not transfer those assumptions silently to a safe library API.
Prove every documented postcondition of each unsafe API in scope and every documented guarantee consumed by an in-scope soundness proof. Include broader safe-API robustness only when the user or audit scope requests it.
Prove source-level Rust soundness first. State claims about a particular compiler backend, binary, platform, security property, probability, or deployment separately with their additional premises.
Use Only Applicable Premises
- Bottom out Rust-language and standard-library facts in exact applicable text from versioned Rust Reference or standard-library documentation.
- Quote and link the smallest sufficient set of passages whose propositions, together with justified inference steps, entail the fact. Open each citation and verify its wording, qualifications, version, and scope.
- Attach an applicability domain to every claim and premise, whether stated locally or inherited from an identified project policy or canonical entry. A derivation proves only the cases covered by all premises it consumes.
- Apply a guarantee documented for an older Rust release to a later stable release only when an exact applicable Rust backwards-compatibility commitment preserves that exact proposition throughout the later release's relevant domain. An API's stability badge does not by itself preserve every behavioral statement in its current documentation. Record a non-authoritative compatibility premise explicitly in the TCB. Never infer an earlier-version guarantee merely from later documentation.
- Do not promote this skill, the Rustonomicon, Unsafe Code Guidelines, RFCs, blogs, issue discussions, implementation behavior, Miri, or common practice to Rust axioms. Use them to discover risks and authoritative text, or record the exact additional proposition as a TCB assumption.
- Trust a deliberately selected safe dependency API to behave as documented only when that exact trust is explicit in the TCB. Do not extend this exception to caller-controlled safe code, callbacks, values, or safe trait implementations.
- Audit a third-party unsafe API through to admissible premises or record its exact implementation and contract as an additional TCB assumption.
When no admissible direct or derived proof can be completed because authoritative documentation is ambiguous or insufficient, identify the smallest missing proposition. Do not repair it with intuition. Report a documentation gap and suggest an upstream improvement when appropriate.
Compose Proofs Locally and Literally
- Identify the controlling contract independently of the existing safety comment. Distinguish normative contract text from examples, rationale, implementation comments, and inferred design intent.
- Read the controlling contract according to its actual text. Decompose every applicable conjunction, implication, quantifier, temporal clause, precondition, and postcondition into separately reviewable obligations. Do not replace a literal requirement with an operationally similar property. Give every normative clause a disposition even when no known consumer uses it.
- Reify every fact used nonlocally as a named contract or invariant carried by a type, field, function boundary, guard, typestate, lock, token, or other locally checkable mechanism. A function contract about global state is an acceptable degenerate case.
- Prove that each state transition establishes, preserves, transfers, deliberately suspends under an explicit obligation, or discharges every applicable invariant. At each consumer, prove that the current invariant entails the exact needed precondition.
- Trace dataflow across calls and time rather than limiting review to lexical unsafe blocks. Account for every producer, transition, and consumer.
- For new code, place invariant-bearing representation in the smallest practical leaf module, keep safely accessible representation fields private to it, and treat safe code outside that module—including the rest of the same crate—as untrusted.
Follow the Proof Workflow
- Frame the claim. Record the artifact identity, exact scope, valid uses or executions, Rust and dependency versions, supported configuration set, mandatory postconditions, TCB, and exclusions.
- Inventory the surface. Enumerate every in-scope safe and unsafe API surface, obligation site, invariant producer/transition/consumer, and generated or expanded artifact across the supported set.
- State every obligation. Obtain each controlling contract, decompose it literally, and state the exact proposition and applicability to prove.
- Construct the derivation. Derive every conjunct from checked local facts, named invariants, applicable authoritative axioms, tool-derived theorems, or explicit TCB entries. Unfold definitions and seek indirect multi-premise derivations; absence of one direct sentence is not itself a documentation gap. Justify every intermediate inference.
- Close composition. Ensure every literal contract clause and safe surface
has a disposition, every premise consumed by unsafe code has an admissible
source, and every supported configuration region is proved by an abstract
argument or exhaustive partition. Try to falsify the contract reading,
inference chain, and coverage before concluding
PROVED. - Report exactly. Keep unresolved obligations visible and state the smallest missing implication. Record proofs, TCB, coverage, findings, postcondition failures, documentation gaps, and residual scope without optimism.
Do not require a concrete UB counterexample to reject an incomplete proof. A
missing, ambiguous, circular, or inapplicable derivation is sufficient for
UNPROVED.
Write and Review Proof-Grade Documentation
Read proof-obligations.md before authoring or
reviewing an unsafe contract, invariant, SAFETY comment, or local proof.
Keep each proof adjacent to the smallest cohesive unsafe operation or assertion. State the exact operation and its preconditions, cite checked facts and named invariants, show the derivation, and prove resulting postconditions and invariant state on every applicable exit.
When existing code can be validated only by reconstructing a material derivation absent from its safety comment, do not accept it silently. Include the reconstructed derivation—or the smallest missing portion—in the review, with its citations and applicability. Classify implementation correctness separately from proof-documentation quality. If changes are authorized, improve the adjacent proof; otherwise provide proposed wording. Do not use a reconstructed implementation proof to invent or strengthen a caller-facing contract retroactively.
Close API and Configuration Boundaries
Read api-boundaries-and-evolution.md for fields, constructors, methods, traits, sealing, macros, public or hidden APIs, robustness, or contract evolution.
Apply this mandatory safe-surface checklist: public fields, constructors, safe
methods, safe trait methods, and macro-generated APIs all count as safe API
surfaces. Include language-reachable #[doc(hidden)] safe items for soundness
even when excluded from documentation or compatibility promises.
Treat caller-provided safe code as adversarial within the behaviors permitted by safe Rust and its types. Seal a trait or make it unsafe when soundness requires an unenforced implementer behavior.
Read configurations-and-generated-code.md for every full audit and whenever conditional compilation, targets, generated code, FFI, assembly, SIMD, allocators, linking, or build tooling is relevant. Every supported combination of compilation options that can ship downstream must be sound. Use parametric proofs or exhaustive partitions when literal enumeration would explode; do not substitute a tested sample.
Evaluate Trust and Evidence
Read tcb-and-evidence.md for every full audit and whenever a proof uses dependencies, external specifications, tools, testing, formal verification, environmental restrictions, or cryptographic or probabilistic assumptions.
Judge evidence by the exact proposition it establishes, its artifact and model, its quantified domain and bounds, its premises, and its residual trust—not by a label such as testing, static analysis, model checking, or formal verification.
Use Exact Verdicts
Read audit-reporting.md before delivering a persistent or full audit.
- PROVED: Every obligation for the exact named claim is discharged over its complete applicability, relative to the stated TCB.
- UNPROVED: At least one required derivation, premise, applicability or coverage argument, postcondition proof, or citation is missing, ambiguous, circular, or unverifiable.
- UNSOUND: A valid use or in-scope execution is proved to reach undefined behavior.
- CONTRACT-BROKEN: A documented postcondition is proved false even though undefined behavior need not occur.
Apply verdicts separately to soundness, documented postconditions, and conditional application claims. State exact scope, applicability, and TCB beside every verdict. Never substitute “looks sound,” “probably sound,” or test success.
For a persistent audit, complete:
- tcb-audit-log-template.md
- unsafe-code-audit-report-template.md
For an inline review, provide the equivalent material compactly. Reuse an existing canonical project log rather than creating a competing trust model.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

