# Modernize Rust Async Patterns

Rust async APIs can be hard to design when traits, closures, and dispatch choices interact. This skill gives practical guidance for modern native async patterns and async-trait migration.

## Install

```bash
npx skillstore add emillindfors/async-patterns-guide
```

## Metadata

- Status: approved
- Slug: emillindfors-async-patterns-guide
- Version: 1.0.0
- Author version: 1.0.0
- Skillstore revision: r1
- Version status: valid
- Tree hash: b0a74e930cd0d69d5b35835ec837f80c1caa18883f7378c76b2b74f471d02dfd
- Author: EmilLindfors
- GitHub username: EmilLindfors
- License: MIT
- Repository: https://github.com/EmilLindfors/claude-marketplace/tree/main/plugins/rust-modern-patterns/skills/async-patterns-guide
- Ref: a06681402992ceae98ba04d54cfd4ab004862696
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands
- Quality score: 80
- Quality tier: silver
- Public page: https://skillstore.pages.dev/skills/emillindfors-async-patterns-guide
- Manifest: https://skillstore.pages.dev/api/skills/emillindfors-async-patterns-guide/manifest

## Capabilities

- Explains when native async functions in traits are appropriate.
- Identifies cases where async-trait is still useful for dyn Trait usage.
- Shows migration guidance from async-trait to native Rust async traits.
- Covers modern async closure patterns for Rust 1.85 and later.
- Compares static dispatch and dynamic dispatch tradeoffs.

## Use Cases

- Review Async Trait Design: Check whether a Rust trait can use native async functions without async-trait.
- Plan Dependency Migration: Assess where async-trait can be removed while preserving behavior and compatibility.
- Compare Dispatch Strategies: Decide between generic static dispatch and dynamic trait objects for async APIs.

## Prompt Templates

### Check Trait Choice

```
Review this Rust async trait design. Tell me if native async functions in traits are enough, or if async-trait is needed.
```

### Plan Async-Trait Migration

```
Find places where this crate can move from async-trait to native async traits. Explain the required Rust version and compatibility risks.
```

### Compare Dispatch Options

```
Compare static dispatch and dynamic dispatch for this async Rust API. Recommend the design with the clearest tradeoffs.
```

### Design Plugin Async APIs

```
Design an async plugin interface for this Rust project. Explain when dyn Trait support justifies async-trait and where native traits fit.
```

## Limitations

- Does not run Rust compilers, tests, or benchmarks.
- Does not inspect files beyond Read and Grep access.
- Assumes users can confirm their project MSRV and dependency policy.
- Does not replace expert review for complex async runtime behavior.

## Best Practices

- Confirm the project MSRV before recommending native async trait features.
- Use native async traits when static dispatch satisfies the API requirements.
- Keep async-trait when object safety and dyn Trait usage are required.

## Anti Patterns

- Removing async-trait from APIs that still require trait objects.
- Ignoring MSRV constraints when suggesting Rust 1.75 or 1.85 features.
- Treating static dispatch and dynamic dispatch as interchangeable.

## Security Audit

- Audited at: 2026-07-06T14:28:11.825\+00:00
- Summary: All static findings are false positives from Markdown Rust examples or normal skill guidance. No executable commands, sensitive file access, prompt injection, or malicious intent were found in SKILL.md.

## Stats

- Views: 140
- Downloads: 9
- Favorites: 0
- Popularity score: 0
