🎯

domain-cloud-native

🎯Skill

from actionbook/rust-skills

VibeIndex|
What it does

Enables building cloud-native Rust applications with robust microservice design patterns, focusing on containerization, observability, and distributed system best practices.

📦

Part of

actionbook/rust-skills(35 items)

domain-cloud-native

Installation

Quick InstallInstall with npx
npx skills add ZhangHanDong/rust-skills
CargoRun with Cargo (Rust)
cargo install cowork
git cloneClone repository
git clone https://github.com/ZhangHanDong/rust-skills.git
Add MarketplaceAdd marketplace to Claude Code
/plugin marketplace add ZhangHanDong/rust-skills
📖 Extracted from docs: actionbook/rust-skills
10Installs
-
AddedFeb 4, 2026

Skill Details

SKILL.md

"Use when building cloud-native apps. Keywords: kubernetes, k8s, docker, container, grpc, tonic, microservice, service mesh, observability, tracing, metrics, health check, cloud, deployment, 云原生, 微服务, 容器"

Overview

# Cloud-Native Domain

> Layer 3: Domain Constraints

Domain Constraints → Design Implications

| Domain Rule | Design Constraint | Rust Implication |

|-------------|-------------------|------------------|

| 12-Factor | Config from env | Environment-based config |

| Observability | Metrics + traces | tracing + opentelemetry |

| Health checks | Liveness/readiness | Dedicated endpoints |

| Graceful shutdown | Clean termination | Signal handling |

| Horizontal scale | Stateless design | No local state |

| Container-friendly | Small binaries | Release optimization |

---

Critical Constraints

Stateless Design

```

RULE: No local persistent state

WHY: Pods can be killed/rescheduled anytime

RUST: External state (Redis, DB), no static mut

```

Graceful Shutdown

```

RULE: Handle SIGTERM, drain connections

WHY: Zero-downtime deployments

RUST: tokio::signal + graceful shutdown

```

Observability

```

RULE: Every request must be traceable

WHY: Debugging distributed systems

RUST: tracing spans, opentelemetry export

```

---

Trace Down ↓

From constraints to design (Layer 2):

```

"Need distributed tracing"

↓ m12-lifecycle: Span lifecycle

↓ tracing + opentelemetry

"Need graceful shutdown"

↓ m07-concurrency: Signal handling

↓ m12-lifecycle: Connection draining

"Need health checks"

↓ domain-web: HTTP endpoints

↓ m06-error-handling: Health status

```

---

Key Crates

| Purpose | Crate |

|---------|-------|

| gRPC | tonic |

| Kubernetes | kube, kube-runtime |

| Docker | bollard |

| Tracing | tracing, opentelemetry |

| Metrics | prometheus, metrics |

| Config | config, figment |

| Health | HTTP endpoints |

Design Patterns

| Pattern | Purpose | Implementation |

|---------|---------|----------------|

| gRPC services | Service mesh | tonic + tower |

| K8s operators | Custom resources | kube-runtime Controller |

| Observability | Debugging | tracing + OTEL |

| Health checks | Orchestration | /health, /ready |

| Config | 12-factor | Env vars + secrets |

Code Pattern: Graceful Shutdown

```rust

use tokio::signal;

async fn run_server() -> anyhow::Result<()> {

let app = Router::new()

.route("/health", get(health))

.route("/ready", get(ready));

let addr = SocketAddr::from(([0, 0, 0, 0], 8080));

axum::Server::bind(&addr)

.serve(app.into_make_service())

.with_graceful_shutdown(shutdown_signal())

.await?;

Ok(())

}

async fn shutdown_signal() {

signal::ctrl_c().await.expect("failed to listen for ctrl+c");

tracing::info!("shutdown signal received");

}

```

Health Check Pattern

```rust

async fn health() -> StatusCode {

StatusCode::OK

}

async fn ready(State(db): State>) -> StatusCode {

match db.ping().await {

Ok(_) => StatusCode::OK,

Err(_) => StatusCode::SERVICE_UNAVAILABLE,

}

}

```

---

Common Mistakes

| Mistake | Domain Violation | Fix |

|---------|-----------------|-----|

| Local file state | Not stateless | External storage |

| No SIGTERM handling | Hard kills | Graceful shutdown |

| No tracing | Can't debug | tracing spans |

| Static config | Not 12-factor | Env vars |

---

Trace to Layer 1

| Constraint | Layer 2 Pattern | Layer 1 Implementation |

|------------|-----------------|------------------------|

| Stateless | External state | Arc for external |

| Graceful shutdown | Signal handling | tokio::signal |

| Tracing | Span lifecycle | tracing + OTEL |

| Health checks | HTTP endpoints | Dedicated routes |

---

Related Skills

| When | See |

|------|-----|

| Async patterns | m07-concurrency |

| HTTP endpoints | domain-web |

| Error handling | m13-domain-error |

| Resource lifecycle | m12-lifecycle |

More from this repository10

🏪
actionbook-rust-skills🏪Marketplace

Comprehensive Rust development assistant with meta-question routing, coding guidelines, version queries, and ecosystem support

🎯
coding-guidelines🎯Skill

Provides comprehensive Rust coding guidelines covering naming conventions, best practices, error handling, memory management, concurrency, and code style recommendations.

🎯
rust-refactor-helper🎯Skill

Performs safe Rust refactoring by analyzing symbol references, dependencies, and potential impacts using Language Server Protocol (LSP) operations.

🎯
m09-domain🎯Skill

Guides domain modeling in Rust by helping identify entities, value objects, aggregates, and their ownership patterns with domain-driven design principles.

🎯
m05-type-driven🎯Skill

Enforces compile-time type safety by preventing invalid states through type-level design techniques like newtypes, type states, and phantom types.

🎯
rust-learner🎯Skill

Retrieves and provides comprehensive Rust and crate information, including versions, features, documentation, and changelogs from authoritative sources.

🎯
m02-resource🎯Skill

Guides developers in selecting the right smart pointer and resource management strategy based on ownership, thread safety, and design constraints.

🎯
m11-ecosystem🎯Skill

Guides Rust developers in selecting, integrating, and managing ecosystem dependencies with best practices and strategic decision-making.

🎯
rust-trait-explorer🎯Skill

Explores Rust trait implementations, revealing which types implement specific traits and their implementation details using LSP.

🎯
rust-call-graph🎯Skill

Generates and visualizes Rust function call graphs using LSP, revealing function relationships and call hierarchies.