본문으로 건너뛰기
cccskills
무료GitHub에 공개

rust-programming-expert

Expert-level skill for Rust programming (Rust 2024 / v1.85+). Covers memory safety, async, Axum/SQLx, CLI, and optimization in English and Indonesian.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md8.5 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Rust Programming Expert (2024 Edition / v1.88+)

English | Bahasa Indonesia


<a name="english"></a>

English

Orchestration & Integration

Connects and orchestrates with relevant domain skills like brainstorming, zero-to-prod-orchestrator, and session-memory-manager to ensure cohesive execution.

Description

Expert-level Rust development for building memory-safe, high-performance systems, APIs, CLI tools, and WebAssembly. Covers the Rust 2024 edition, async/await with Tokio, Axum 0.8 web framework, SQLx for async database access, and modern Rust idioms.

Trigger Conditions

  • Writing systems-level code requiring memory safety and zero-cost abstractions.
  • Building high-performance HTTP APIs with Axum 0.8.
  • Implementing async services with Tokio runtime.
  • Interacting with databases using SQLx or SeaORM.
  • Building CLI tools with Clap v4.
  • Compiling to WebAssembly (WASM) for browser or edge deployment.
  • Writing Rust for Tauri v2 desktop application backends.

Rust 2024 Edition Highlights

The Rust 2024 edition (stabilized in 1.85) introduces:

  • gen blocks: Generators for lazy sequence production.
  • Lifetime capture rules: More precise lifetime inference in impl Trait.
  • Unsafe extern blocks: Clearer unsafe boundary declarations.
  • if let chains: if let Some(x) = opt && x > 0 now works cleanly.
  • async fn in traits: Now stable — no more async-trait macro needed.

Async fn in Traits (Stable in Rust 2024)

// No longer need #[async_trait] macro!
trait DataStore {
    async fn get(&self, id: &str) -> Result<Data, Error>;
    async fn set(&self, id: &str, data: Data) -> Result<(), Error>;
}

impl DataStore for PostgresStore {
    async fn get(&self, id: &str) -> Result<Data, Error> {
        sqlx::query_as("SELECT * FROM data WHERE id = $1")
            .bind(id)
            .fetch_one(&self.pool)
            .await
            .map_err(Into::into)
    }
    async fn set(&self, id: &str, data: Data) -> Result<(), Error> {
        sqlx::query("INSERT INTO data (id, value) VALUES ($1, $2) ON CONFLICT (id) DO UPDATE SET value = $2")
            .bind(id)
            .bind(&data.value)
            .execute(&self.pool)
            .await?;
        Ok(())
    }
}

Axum 0.8 — HTTP API Framework

use axum::{
    extract::{Path, State},
    response::Json,
    routing::{get, post},
    Router,
};
use sqlx::PgPool;
use serde::{Deserialize, Serialize};

#[derive(Clone)]
struct AppState {
    db: PgPool,
}

#[derive(Serialize, Deserialize)]
struct User {
    id: String,
    name: String,
    email: String,
}

async fn get_user(
    Path(user_id): Path<String>,
    State(state): State<AppState>,
) -> Result<Json<User>, StatusCode> {
    let user = sqlx::query_as!(User, "SELECT * FROM users WHERE id = $1", user_id)
        .fetch_optional(&state.db)
        .await
        .map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?
        .ok_or(StatusCode::NOT_FOUND)?;

    Ok(Json(user))
}

#[tokio::main]
async fn main() {
    let db = PgPool::connect(&std::env::var("DATABASE_URL").unwrap())
        .await
        .expect("Failed to connect to database");

    let state = AppState { db };

    let app = Router::new()
        .route("/users/:id", get(get_user))
        .route("/users", post(create_user))
        .with_state(state);

    let listener = tokio::net::TcpListener::bind("0.0.0.0:8080").await.unwrap();
    println!("Listening on :8080");
    axum::serve(listener, app).await.unwrap();
}

SQLx — Compile-Time Verified SQL

// Compile-time SQL checking (requires DATABASE_URL at build time)
let users = sqlx::query_as!(
    User,
    r#"SELECT id, name, email FROM users WHERE created_at > $1 ORDER BY created_at DESC LIMIT $2"#,
    since,
    limit as i64
)
.fetch_all(&pool)
.await?;

Error Handling — thiserror + anyhow

use thiserror::Error;

// Library errors: use thiserror for typed errors
#[derive(Debug, Error)]
pub enum AppError {
    #[error("User not found: {id}")]
    UserNotFound { id: String },
    #[error("Database error: {0}")]
    Database(#[from] sqlx::Error),
    #[error("Validation failed: {message}")]
    Validation { message: String },
}

// Application code: use anyhow for ergonomic error propagation
use anyhow::{Context, Result};

fn process() -> Result<()> {
    let config = load_config().context("Failed to load configuration")?;
    let db = connect_db(&config).context("Failed to connect to database")?;
    Ok(())
}

CLI Tools with Clap v4

use clap::{Parser, Subcommand};

#[derive(Parser)]
#[command(name = "myapp", version, about = "My CLI tool")]
struct Cli {
    #[command(subcommand)]
    command: Commands,
}

#[derive(Subcommand)]
enum Commands {
    /// Start the server
    Serve {
        #[arg(short, long, default_value = "8080")]
        port: u16,
    },
    /// Run migrations
    Migrate,
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let cli = Cli::parse();
    match cli.command {
        Commands::Serve { port } => serve(port).await,
        Commands::Migrate => run_migrations().await,
    }
}

Performance Best Practices

  • Zero-cost abstractions: Use iterators (map, filter, collect) — compiled to the same code as hand-written loops.
  • Avoid unnecessary cloning: Use references (&T) and lifetimes where possible.
  • Arc<T> for shared state: Use Arc<Mutex<T>> or Arc<RwLock<T>> for shared mutable state across threads.
  • SIMD: Use std::simd (stable in 1.88) for data-parallel operations.
  • Profile before optimizing: Use cargo flamegraph or perf to find actual bottlenecks.

<a name="bahasa-indonesia"></a>

Bahasa Indonesia

Integrasi Orkestrasi

Terhubung dan mengorkestrasi skill domain yang relevan seperti brainstorming, zero-to-prod-orchestrator, dan session-memory-manager untuk memastikan eksekusi yang kohesif.

Deskripsi

Pengembangan Rust tingkat ahli untuk membangun sistem, API, CLI tool, dan WebAssembly yang aman di memori dan berkinerja tinggi. Mencakup edisi Rust 2024, async/await dengan Tokio, framework web Axum 0.8, SQLx untuk akses database async, dan idiom Rust modern.

Kondisi Pemicu

  • Menulis kode sistem yang membutuhkan keamanan memori dan zero-cost abstraction.
  • Membangun HTTP API berkinerja tinggi dengan Axum 0.8.
  • Mengimplementasikan layanan async dengan runtime Tokio.
  • Berinteraksi dengan database menggunakan SQLx atau SeaORM.
  • Membangun CLI tool dengan Clap v4.
  • Mengkompilasi ke WebAssembly (WASM) untuk browser atau edge.
  • Menulis backend Rust untuk aplikasi desktop Tauri v2.

Sorotan Edisi Rust 2024

  • async fn dalam trait: Kini stabil — tidak perlu lagi macro #[async_trait].
  • if let chains: if let Some(x) = opt && x > 0 kini berfungsi secara bersih.
  • gen blocks: Generator untuk produksi urutan yang malas.
  • Aturan lifetime capture: Inferensi lifetime yang lebih presisi di impl Trait.

Axum 0.8 — Framework HTTP API

Gunakan Axum untuk HTTP API yang idiomatis dan berkinerja tinggi dibangun di atas Tokio. Manfaatkan extractor (Path, State, Json, Query) untuk parameter handler yang type-safe.

SQLx — SQL Terverifikasi Waktu Kompilasi

SQLx memverifikasi query SQL Anda terhadap database nyata saat kompilasi — menghilangkan seluruh kelas bug runtime.

Penanganan Error — thiserror + anyhow

  • Gunakan thiserror untuk error bertipe di library code.
  • Gunakan anyhow untuk propagasi error yang ergonomis di application code.

CLI Tool dengan Clap v4

Clap v4 menggunakan derive macro untuk mendefinisikan antarmuka CLI secara deklaratif — perintah, subperintah, argumen, dan flag dengan parsing bawaan.

Praktik Terbaik Performa

  • Gunakan iterator (map, filter, collect) — dikompilasi setara dengan loop manual.
  • Hindari cloning yang tidak perlu — gunakan referensi dan lifetime.
  • Gunakan Arc<Mutex<T>> untuk state bersama yang dapat dimutasi di antara thread.
  • Profiling terlebih dahulu dengan cargo flamegraph sebelum mengoptimalkan.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Expert guide for automated and manual Web Accessibility (a11y) testing — axe-core, Pa11y, Playwright a11y, screen reader testing, and WCAG 2.2 Level AA/AAA compliance / Panduan ahli pengujian aksesibilitas web.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

roedyrustam/vibes-plug772026년 10월 18일 업데이트

Expert guide for intelligent model cascading and routing — complexity-scored task routing from Flash/Haiku to Sonnet/Opus/Astra, dynamic escalation with quality gates, 40-60% token cost reduction while maintaining output quality / Panduan ahli untuk kaskade dan routing model cerdas — routing tugas berbasis skor kompleksitas dari Flash/Haiku ke Sonnet/Opus/Astra, eskalasi dinamis dengan gerbang kualitas, pengurangan biaya token 40-60% dengan kualitas output terjaga.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

roedyrustam/vibes-plug772026년 10월 18일 업데이트

Expert guide for Affective Computing, emotional AI, and real-time sentiment analysis through native multimodal tokens (voice intonation and facial micro-expressions) / Panduan ahli komputasi afektif, AI emosional, dan analisis sentimen real-time melalui token multimodal native.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

roedyrustam/vibes-plug772026년 10월 18일 업데이트

Expert guide for AI-assisted coding workflows — agentic code generation, multi-agent code swarms, self-healing CI/CD, automated PR review, spec-to-code pipelines, codebase knowledge graphs, and human-in-the-loop approval gates / Panduan ahli untuk workflow pengkodean berbasis AI — generasi kode agentic, code swarm multi-agen, CI/CD self-healing, review PR otomatis, pipeline spec-to-code, knowledge graph codebase, dan gate persetujuan human-in-the-loop.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

roedyrustam/vibes-plug772026년 10월 18일 업데이트

Expert guide for autonomous Machine-to-Machine (M2M) agent settlement, dual-rail fiat & stablecoin micro-clearing, dynamic budget envelopes, and cryptographic agent invoicing / Panduan ahli settlement otonom antar-agen (M2M), kliring mikro dual-rail fiat & stablecoin, pagu anggaran dinamis, dan penagihan agen kriptografis.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

roedyrustam/vibes-plug772026년 10월 18일 업데이트

Expert guide for long-term episodic memory integration (Mem0 v2, Letta/MemGPT, Zep v2), memory tier architecture, pgvector HNSW storage, and unified context management for autonomous AI agents / Panduan ahli untuk integrasi memori episodik jangka panjang (Mem0 v2, Letta/MemGPT, Zep v2), arsitektur tier memori, penyimpanan pgvector HNSW, dan manajemen konteks terpadu untuk agen AI otonom.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

roedyrustam/vibes-plug772026년 10월 18일 업데이트

roedyrustam의 스킬 모두 보기

이 스킬의 문제 신고