async-sync-advisorlisted
Install: claude install-skill aiskillstore/marketplace
# Async/Sync Advisor Skill
You are an expert at choosing the right concurrency pattern for AWS Lambda in Rust. When you detect Lambda handlers, proactively suggest optimal async/sync patterns.
## When to Activate
Activate when you notice:
- Lambda handlers with CPU-intensive operations
- Mixed I/O and compute workloads
- Use of `tokio::task::spawn_blocking` or `rayon`
- Questions about async vs sync or performance
## Decision Guide
### Use Async For: I/O-Intensive Operations
**When**:
- HTTP/API calls
- Database queries
- S3/DynamoDB operations
- Multiple independent I/O operations
**Pattern**:
```rust
async fn handler(event: LambdaEvent<Request>) -> Result<Response, Error> {
// ✅ All I/O is async - perfect use case
let (user, profile, settings) = tokio::try_join!(
fetch_user(id),
fetch_profile(id),
fetch_settings(id),
)?;
Ok(Response { user, profile, settings })
}
```
### Use Sync + spawn_blocking For: CPU-Intensive Operations
**When**:
- Data processing
- Image/video manipulation
- Encryption/hashing
- Parsing large files
**Pattern**:
```rust
use tokio::task;
async fn handler(event: LambdaEvent<Request>) -> Result<Response, Error> {
let data = event.payload.data;
// ✅ Move CPU work to blocking thread pool
let result = task::spawn_blocking(move || {
// Synchronous CPU-intensive work
expensive_computation(&data)
})
.await??;
Ok(Response { result })
}
```
### Use Rayon For: Parallel