Declarative .mdcCursor/Claude/Windsurf 规则和 n8n 工作流程代理技能零秘密泄漏审计
Rust Tokio + Axum 取消安全系统工程技能
声明性 CLAUDE.md 和 .mdc 技能可防止 HTTP/MCP 处理程序中的 .unwrap() 恐慌,保护 tokio::select!取消安全性和边界通道队列。
声明性代理和 IDE 规则文件
---
description: Zero-panic Axum handlers, bounded Tokio mpsc channels, and cancellation-safe async Rust
globs: **/*.rs,Cargo.toml
alwaysApply: false
---
# Rust Tokio & Axum Production Reliability Skill
- Forbid `.unwrap()` and `.expect()` in request handlers and MCP tool loops; propagate typed errors via `thiserror` implementing `axum::response::IntoResponse`.
- Use bounded `tokio::sync::mpsc::channel(capacity)` exclusively — never `unbounded_channel` — to enforce deterministic backpressure.
- Offload CPU-bound parsing, hashing, or synchronous I/O > 500µs onto `tokio::task::spawn_blocking` so worker reactor threads never stall.
- Audit every `tokio::select!` branch for cancellation safety; avoid partial multi-frame writes inside cancellable futures.
- Instrument async handlers with `#[tracing::instrument(skip_all, fields(req_id))]` without logging secret headers.
## Verification Check
```bash
cargo clippy --all-targets -- -D warnings && cargo test
```社区设置说明和制作评论 (0)
还没有社区笔记。下面分享您的生产配置技巧。
公开的 MCP 工具和资源架构检查器
| 工具/资源标识符 | 输入参数 | 执行行为 |
|---|---|---|
| forbid_handler_unwrap | src/**/*.rs | Enforces typed thiserror/IntoResponse error propagation instead of unwrap()/expect(). |