SOC 직업 분류 기준
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/tomevault-io/skills-registry --skill rust-cloud-native명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
| Use when this capability is needed.
> Use when this capability is needed.
Review architecture and API design for the vfs-s3 project. Use when the user mentions @architect, asks to review an issue's design, discuss module boundaries, API shape, or architectural decisions for vfs-s3. Also trigger when the user wants to create an ADR (Architecture Decision Record) or evaluate a technical approach for the project. Intended for dispatch from Codex automation or Claude routines; GitHub trigger phrase: @vfs-s3-bot please prepare design doc Use when this capability is needed.
Best practices for building containerized, observable, and highly reliable microservices in Rust.
Use the tracing ecosystem instead of log or standard prints. Incorporate OpenTelemetry integration for distributed request context propagation.
use tracing::{info, instrument};
#[instrument(skip(db), fields(user_id = %payload.user_id))]
pub async fn process_order(payload: OrderPayload, db: &DbConnection) -> Result<(), AppError> {
info!("Processing new incoming order");
db.save_order(&payload).await?;
info!("Order saved successfully");
Ok(())
}
Use the tonic crate to define strict APIs via Protocol Buffers.
// proto definition (build.rs handles codegen)
// service OrderService { rpc CreateOrder (OrderRequest) returns (OrderResponse); }
use tonic::{Request, Response, Status};
use pb::order_service_server::OrderService;
pub struct MyOrderService;
#[tonic::async_trait]
impl OrderService for MyOrderService {
async fn create_order(
&self,
request: Request<OrderRequest>,
) -> Result<Response<OrderResponse>, Status> {
let req = request.into_inner();
// business logic ...
Ok(Response::new(OrderResponse { success: true }))
}
}
Ensure the server handles orchestration signals (SIGINT, SIGTERM) gracefully to finish flight requests before exiting.
use tokio::signal;
async fn shutdown_signal() {
let ctrl_c = async {
signal::ctrl_c().await.expect("failed to listen for ctrl+c");
};
let terminate = async {
signal::unix::signal(signal::unix::SignalKind::terminate())
.expect("failed to install SIGTERM signal handler")
.recv()
.await;
};
tokio::select! {
_ = ctrl_c => {},
_ = terminate => {},
}
println!("Graceful shutdown signal received. Stopping worker pools...");
}
Expose lightweight health checkpoints for liveness and readiness states.
use axum::{routing::get, Router, http::StatusCode};
async fn liveness() -> StatusCode {
StatusCode::OK
}
async fn readiness() -> Result<StatusCode, StatusCode> {
// Check database connection or dependencies here
if db_pool_is_ok().await {
Ok(StatusCode::OK)
} else {
Err(StatusCode::SERVICE_UNAVAILABLE)
}
}
# Build Stage
FROM rust:1.75-slim AS builder
WORKDIR /app
COPY . .
RUN cargo build --release
# Runner Stage
FROM gcr.io/distroless/cc-debian12
COPY --from=builder /app/target/release/my-service /my-service
USER 10001:10001
ENTRYPOINT ["/my-service"]
use serde::Deserialize;
#[derive(Debug, Deserialize, Clone)]
pub struct Config {
pub database_url: String,
pub redis_url: String,
pub port: u16,
pub log_level: String,
pub feature_flags: FeatureFlags,
}
#[derive(Debug, Deserialize, Clone)]
pub struct FeatureFlags {
pub enable_new_pipeline: bool,
pub max_batch_size: usize,
}
impl Config {
pub fn from_env() -> Result<Self, config::ConfigError> {
config::Config::builder()
.add_source(config::Environment::default().prefix("APP"))
.build()?
.try_deserialize()
}
}
Use environment variables or a config service. Avoid config files in container images — they break twelve-factor principles.
Use REST/JSON for public APIs, browser clients, and human-debuggable integrations. Use gRPC for internal service-to-service APIs where strict schemas, streaming, and generated clients matter.
// REST edge service: axum + serde + tower-http
// Internal RPC: tonic + prost + OpenTelemetry propagation
Start with a modular service unless independent scaling, ownership, or deployment cadence justifies a separate service. Network boundaries add retries, tracing, auth, schema evolution, and failure modes.
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-rust-service
spec:
replicas: 3
selector:
matchLabels:
app: my-rust-service
template:
metadata:
labels:
app: my-rust-service
spec:
terminationGracePeriodSeconds: 30
containers:
- name: app
image: my-registry/my-rust-service:latest
ports:
- containerPort: 3000
- containerPort: 9001 # metrics
env:
- name: APP_PORT
value: "3000"
- name: APP_DATABASE_URL
valueFrom:
secretKeyRef:
name: db-credentials
key: url
livenessProbe:
httpGet:
path:
terminationGracePeriodSeconds to allow in-flight requests to finish.let response = tokio::time::timeout(
Duration::from_secs(2),
client.fetch_user(user_id),
).await??;
Add retries only for idempotent operations or operations protected by idempotency keys with exponential backoff.
use tokio::sync::Semaphore;
pub struct CircuitBreaker {
semaphore: Semaphore,
failures: AtomicUsize,
threshold: usize,
}
impl CircuitBreaker {
pub async fn call<T, F, E>(&self, f: F) -> Result<T, Error>
where
F: Future<Output = Result<T, E>>,
{
if self.failures.load(Ordering::Acquire) >= self.threshold {
return Err(Error::CircuitOpen);
}
let _permit = self.semaphore.acquire().await?;
match f.await {
Ok(val) => {
self.failures.store(0, Ordering::Release);
Ok(val)
}
Err(err) => {
self.failures.fetch_add(1, Ordering::Release);
Err(err.into())
}
}
}
}
pub enum FeatureFlag {
NewBillingPipeline,
OptimizedSearch,
}
pub struct FlagService {
flags: Arc<RwLock<HashMap<FeatureFlag, bool>>>,
}
impl FlagService {
pub fn is_enabled(&self, flag: FeatureFlag) -> bool {
self.flags.read().get(&flag).copied().unwrap_or(false)
}
/// Reload flags from config source without restart.
pub async fn reload(&self) -> Result<(), Error> {
let new_flags = load_flags_from_source().await?;
*self.flags.write() = new_flags;
Ok(())
}
}
cargo build --release --locked in CI.cargo audit and cargo test.mpsc channels in request paths.println! logging in services.When reviewing cloud-native Rust, check shutdown behavior, timeouts, bounded resources, observability coverage, config/secrets handling, and container reproducibility.
Source: adxptived/Rust-Skills — distributed by TomeVault.