Skills / unsafe-checker
AGENTS.md1 starsChanged 4 months agoMITView on GitHub
Auto-generated from rules/
We split this AGENTS.md into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 122
Before every unsafe block:
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md 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 Checker - Quick Reference
Auto-generated from rules/
Rule Summary by Section
General Principles (3 rules)
| ID | Level | Title |
| general-01 | P | Do Not Abuse Unsafe to Escape Compiler Safety Checks |
| general-02 | P | Do Not Blindly Use Unsafe for Performance |
| general-03 | G | Do Not Create Aliases for Types/Methods Named "Unsafe" |
Safety Abstraction (11 rules)
| ID | Level | Title |
| safety-01 | P | Be Aware of Memory Safety Issues from Panics |
| safety-02 | P | Unsafe Code Authors Must Verify Safety Invariants |
| safety-03 | P | Do Not Expose Uninitialized Memory in Public APIs |
| safety-04 | P | Avoid Double-Free from Panic Safety Issues |
| safety-05 | P | Consider Safety When Manually Implementing Auto Traits |
| safety-06 | P | Do Not Expose Raw Pointers in Public APIs |
| safety-07 | P | Provide Unsafe Counterparts for Performance Alongside Safe Methods |
| safety-08 | P | Mutable Return from Immutable Parameter is Wrong |
| safety-09 | P | Add SAFETY Comment Before Any Unsafe Block |
| safety-10 | G | Add Safety Section in Docs for Public Unsafe Functions |
| safety-11 | G | Use assert! Instead of debug_assert! in Unsafe Functions |
Raw Pointers (6 rules)
| ID | Level | Title |
| ptr-01 | P | Do Not Share Raw Pointers Across Threads |
| ptr-02 | P | Prefer NonNull<T> Over *mut T |
| ptr-03 | P | Use PhantomData<T> for Variance and Ownership |
| ptr-04 | G | Do Not Dereference Pointers Cast to Misaligned Types |
| ptr-05 | G | Do Not Manually Convert Immutable Pointer to Mutable |
| ptr-06 | G | Prefer pointer::cast Over as for Pointer Casting |
Union (2 rules)
| ID | Level | Title |
| union-01 | P | Avoid Union Except for C Interop |
| union-02 | P | Do Not Use Union Variants Across Different Lifetimes |
Memory Layout (6 rules)
| ID | Level | Title |
| mem-01 | P | Choose Appropriate Data Layout for Struct/Tuple/Enum |
| mem-02 | P | Do Not Modify Memory Variables of Other Processes |
| mem-03 | P | Do Not Let String/Vec Auto-Drop Other Process's Memory |
| mem-04 | P | Prefer Reentrant Versions of C-API or Syscalls |
| mem-05 | P | Use Third-Party Crates for Bitfields |
| mem-06 | G | Use MaybeUninit<T> for Uninitialized Memory |
FFI (18 rules)
| ID | Level | Title |
| ffi-01 | P | Avoid Passing Strings Directly to C |
| ffi-02 | P | Read Documentation Carefully for std::ffi Types |
| ffi-03 | P | Implement Drop for Wrapped C Pointers |
| ffi-04 | P | Handle Panics When Crossing FFI Boundaries |
| ffi-05 | P | Use Portable Type Aliases from std or libc |
| ffi-06 | P | Ensure C-ABI String Compatibility |
| ffi-07 | P | Do Not Implement Drop for Types Passed to External Code |
| ffi-08 | P | Handle Errors Properly in FFI |
| ffi-09 | P | Use References Instead of Raw Pointers in Safe Wrappers |
| ffi-10 | P | Exported Functions Must Be Thread-Safe |
| ffi-11 | P | Be Careful with repr(packed) Field References |
| ffi-12 | P | Document Invariant Assumptions for C Parameters |
| ffi-13 | P | Ensure Consistent Data Layout for Custom Types |
| ffi-14 | P | Types in FFI Should Have Stable Layout |
| ffi-15 | P | Validate Non-Robust External Values |
| ffi-16 | P | Separate Data and Code for Closures to C |
| ffi-17 | P | Use Opaque Types Instead of c_void |
| ffi-18 | P | Avoid Passing Trait Objects to C |
I/O Safety (1 rule)
| ID | Level | Title |
| io-01 | P | Ensure I/O Safety When Using Raw Handles |
Clippy Lint Mapping
| Clippy Lint | Rule | Category |
undocumented_unsafe_blocks | safety-09 | SAFETY comments |
missing_safety_doc | safety-10 | Safety docs |
panic_in_result_fn | safety-01, ffi-04 | Panic safety |
non_send_fields_in_send_ty | safety-05 | Send/Sync |
uninit_assumed_init | safety-03 | Initialization |
uninit_vec | mem-06 | Initialization |
mut_from_ref | safety-08 | Aliasing |
cast_ptr_alignment | ptr-04 | Alignment |
cast_ref_to_mut | ptr-05 | Aliasing |
ptr_as_ptr | ptr-06 | Pointer casting |
unaligned_references | ffi-11 | Packed structs |
debug_assert_with_mut_call | safety-11 | Assertions |
Quick Decision Tree
Writing unsafe code?
│
├─ FFI with C?
│ └─ See ffi-* rules
│
├─ Raw pointers?
│ └─ See ptr-* rules
│
├─ Manual Send/Sync?
│ └─ See safety-05
│
├─ MaybeUninit/uninitialized?
│ └─ See safety-03, mem-06
│
└─ Performance optimization?
└─ See general-02, safety-07Essential Checklist
Before every unsafe block:
- SAFETY comment present
- Invariants documented
- Pointer validity checked
- Aliasing rules followed
- Panic safety considered
- Tested with Miri
Resources
checklists/before-unsafe.md- Pre-writing checklistchecklists/review-unsafe.md- Code review checklistchecklists/common-pitfalls.md- Common bugs and fixesexamples/safe-abstraction.md- Safe wrapper patternsexamples/ffi-patterns.md- FFI best practices
Other versions6 projects use a version of this.
Word for word · 6
- ZhangHanDong/rust-skills★ 1.5k100% same
- actionbook/rust-skills★ 1.5k100% same
- fjrevoredo/mini-diarium★ 317100% same
- moeru-ai/auv★ 198100% same
- TeddyAlbina/skills★ 2100% same
- pocket-veto/pocket-veto★ 1100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
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.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository73 other files it gives its agents.
- activity-tracingSkill
- beadsSkill
- code-analysis-warningsSkill
- coding-guidelinesSkill
- compiler-warningsSkill
- core-actionbookSkill
- core-agent-browserSkill
- core-dynamic-skillsSkill
- core-fix-skill-docsSkill
- csharp-compiler-warningsSkill
- csharp-object-designSkill
- domain-cliSkill
- domain-cloud-nativeSkill
- domain-embeddedSkill
- domain-fintechSkill
- domain-iotSkill
- domain-mlSkill
- domain-webSkill
- dotnet-pinvokeSkill
- dreamSkill
- gitSkill
- ide-warningsSkill
- karpathy-guidelinesSkill
- m01-ownershipSkill
- m02-resourceSkill
- m03-mutabilitySkill
- m04-zero-costSkill
- m05-type-drivenSkill
- m06-error-handlingSkill
- m07-concurrencySkill
- m09-domainSkill
- m10-performanceSkill
- m11-ecosystemSkill
- m12-lifecycleSkill
- m13-domain-errorSkill
- m14-mental-modelSkill
- m15-anti-patternSkill
- mermaidSkill
- meta-cognition-parallelSkill
- modern-csharpSkill
- msbuild-warningsSkill
- mx-creative-keypadSkill
- nuget-warningsSkill
- nullability-warningsSkill
- rcs-warningsSkill
- renpySkill
- rust-call-graphSkill
- rust-code-navigatorSkill
- rust-dailySkill
- rust-deps-visualizerSkill
- rust-google-styleSkill
- rust-learnerSkill
- rust-object-designSkill
- rust-refactor-helperSkill
- rust-routerSkill
- rust-skill-creatorSkill
- rustSkill
- rust-symbol-analyzerSkill
- rust-trait-explorerSkill
- translationsSkill
- The first 60 shown.
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.

