rust-api-design
Skill4 starsChanged 2 months agoApache-2.0View on GitHub
Design or refactor Rust APIs, ownership, traits, and error boundaries. Use for semantic interface changes, not test-runner configuration or speculative optimization.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- adxptived/Rust-Skillstheir own version, first seen Oct 17, 2026
- takurot/rust-skills-comprehensivetheir own version, first seen Oct 15, 2026
- full-stack-skills/rust-skillstheir own version, first seen Oct 15, 2026
- Lu1sDV/skillsmdtheir own version, first seen Oct 13, 2026
- rcore-os/tgoskitstheir own version, first seen Oct 8, 2026
- botirkhaltaev/botir-skillstheir own version, first seen Jul 24, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- rcore-os/tgoskits★ 76same name
- full-stack-skills/rust-skills★ 8same name
- botirkhaltaev/botir-skills★ 4same name
- Lu1sDV/skillsmd★ 2same name
- adxptived/Rust-Skills★ 1same name
- takurot/rust-skills-comprehensive★ 0same 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 repository81 other files it gives its agents.
- agent-cli-designSkill
- agent-tool-boundariesSkill
- behavior-first-implementationSkill
- bounded-prototypeSkill
- bounded-pr-sliceSkill
- building-fdd-validationSkill
- context-efficiencySkill
- cross-language-contractsSkill
- cross-platform-agent-instructionsSkill
- design-interviewSkill
- diagnosis-loopSkill
- domain-languageSkill
- edge-cloud-syncSkill
- handoff-continuitySkill
- immutable-pr-reviewSkill
- memory-context-hygieneSkill
- module-designSkill
- orchestrateSkill
- owner-decision-gateSkill
- parallel-portfolioSkill
- pr-gate-loopSkill
- pyo3-async-lifecycleSkill
- pyo3-buffer-performanceSkill
- pyo3-free-threadingSkill
- pyo3-ownership-errorsSkill
- pyo3-wheel-releaseSkill
- python-api-typingSkill
- python-async-concurrencySkill
- python-ci-releaseSkill
- python-data-boundariesSkill
- python-packaging-environmentsSkill
- python-performanceSkill
- python-pytestSkill
- python-reviewSkill
- python-test-designSkill
- python-threading-workersSkill
- python-workflowSkill
- react-components-stateSkill
- react-performanceSkill
- repository-groundingSkill
- rust-async-concurrencySkill
- rust-build-diagnosticsSkill
- rust-ci-releaseSkill
- rust-memory-layoutSkill
- rust-nextestSkill
- rust-numerics-simdSkill
- rust-performanceSkill
- rust-protocol-codecsSkill
- rust-python-bindingsSkill
- rust-reviewSkill
- rust-storage-durabilitySkill
- rust-test-designSkill
- rust-unsafe-ffiSkill
- rust-workflowSkill
- rust-workspace-dependenciesSkill
- shadcn-react-componentsSkill
- shadcn-svelte-componentsSkill
- simplify-existing-codeSkill
- source-verificationSkill
- svelte-components-runesSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
4
Distinctive
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 9
Start from the call sites and the invariant the API should make easy to preserve.
- Distinctive: line 13
Read the implementation, two representative callers, public documentation, feature gates, and existing error types.
- Distinctive: line 29
Keep the public surface minimal and dependency direction intact.
- Distinctive: line 37
Read design checks for boundary-specific questions.
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Rust API and Ownership
Start from the call sites and the invariant the API should make easy to preserve. Follow repository policy before applying general style preferences; this skill does not authorize a breaking release or a rewrite.
Design from use
Read the implementation, two representative callers, public documentation, feature gates, and existing error types. Identify who owns data, how long a view may live, whether work crosses a thread/task boundary, and whether results must survive mutation or buffer reuse.
Use slices and borrowed views for temporary access, owned values for independent lifetime, and shared ownership where there are real independent owners. Do not clone merely to silence the borrow checker; first shorten a borrow, split a phase, move the owner, or separate fields. Conversely, one bounded copy at an API boundary can be simpler and cheaper than pervasive lifetimes or reference-count churn. Avoid introducing Arc<Mutex<_>> as a universal ownership escape hatch.
Prefer constructors and validated newtypes where invalid values create real failure modes: IDs, lengths, bounded quantities, deadlines, units, or lifecycle capabilities. Avoid a generic typestate framework when a small enum or checked constructor communicates the contract. Make destructive actions and expensive conversions visible in naming and ownership.
Trait and error decisions
Choose generics, enums, or dynamic dispatch from the required extension boundary, code size, compile time, and profiling evidence. Preserve intentional static dispatch in protocol transports. Native async/RPITIT trait methods do not automatically become usable through dyn; inspect current trait constraints and actual consumers before promising that interface. Do not add async_trait just to follow an old recipe.
Keep expected input, I/O, and domain failures typed where callers act on them. Preserve source errors and useful context at boundaries, without erasing actionable variants into strings throughout a library. Reserve panics for genuinely internal violated assumptions under repository policy; do not hide malformed-input failures behind unwrap or default values. An explicit expect with an established invariant can be more honest than a fabricated fallback.
Preserve trait laws and semantic contracts: Eq/Hash, ordering, iterator behavior, units, absence versus zero, null versus missing, and cancellation effects. Do not derive traits for values whose semantics do not satisfy them.
Make the change
Keep the public surface minimal and dependency direction intact. Write rustdoc examples for the real caller workflow and document relevant errors, panics, safety, allocation, and lifecycle behavior. Use established naming/conversion conventions rather than mechanically enforcing every optional guideline.
Add a regression or compile-time example demonstrating the intended use. Validate affected consumers, feature combinations, and doctests separately. Run rustfmt and the repository's Clippy scope; fix causes before adding a narrowly justified lint allowance. Do not blanket-enable every pedantic/restriction lint or reformat unrelated code.
Return
Explain the ownership or semantic improvement, compatibility impact, affected callers, and evidence. For a hot-path refactor, avoid claiming faster code without measurement. For greenfield code, favor a clean contract rather than preserving accidental internal APIs.
Read design checks for boundary-specific questions.
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.

