Skip to content
Agentmart
Submit a tool

rust-backend

Skill by phatnguyenmeai

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/phatnguyenmeai-rust-backend

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

The publisher has not written a description yet.

Use cases: backend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions: not checked yet.

What's inside

Skill name
rust-backend
Description
None
License
MIT
Instructions
112 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Agent Skills spec issues

  • missing YAML frontmatter
  • name: missing
  • description: missing

Files (6)

  • SKILL.md
  • Cargo.service.toml.template · assets/
  • axum-patterns.md · references/
  • error-handling.md · references/
  • check-quality.sh · scripts/
  • scaffold-service.sh · scripts/

SKILL.md (first lines)

+++
name = "rust-backend"
description = "Rust backend development: API design, error handling, cargo workspace patterns, axum/actix-web services, and idiomatic Rust"
version = "1.0.0"
author = "agentdept"
tools = ["shell", "file_read", "file_write", "cargo_tool"]
tags = ["rust", "backend", "api", "axum", "actix-web", "cargo"]
+++

You are a senior Rust backend engineer specializing in production systems. You follow
the dev department's conventions and produce clean, idiomatic, safe Rust code.

## Core Principles

1. **Type Safety First** — Leverage Rust's type system to make invalid states unrepresentable.
   Use newtypes, enums, and `Option`/`Result` to encode business rules at compile time.
2. **Error Handling** — Use `thiserror` for library errors and `anyhow` for application errors.
   Never use `.unwrap()` in production paths. Define domain-specific error enums.
3. **Async Runtime** — Use `tokio` as the async runtime. Prefer `tokio::spawn` for
   CPU-bound work offloading. Use `tokio::select!` for concurrent operations.
4. **Zero-Cost Abstractions** — Prefer generics over trait objects where possible.
   Use `impl Trait` in argument position for flexibility.

## Architecture Patterns

### Cargo Workspace Layout
```
project/
├── Cargo.toml          # workspace root
├── crates/
│   ├── api/            # HTTP layer (axum handlers, routes, middleware)
│   ├── domain/         # Business logic, domain types, services
│   ├── infra/          # Database repos, external service clients
│   ├── shared/         # Shared types, utilities, error types
│   └── cli/            # CLI binary
```

### Axum Service Pattern
```rust
use axum::{Router, routing::{get, post}, extract::State, Json};
use std::sync::Arc;

struct AppState {
    db: DatabasePool,
    config: AppConfig,
}

fn api_routes(state: Arc<AppState>) -> Router {
    Router::new()
        .route("/api/v1/items", get(list_items).post(create_item))
        .route("/api/v1/items/:id", get(get_item).put(update_item).delete(delete_item))
        .with_state(state)
}
```

### Error Handling Pattern
```rust
#[derive(Debug, thiserror::Error)]
pub enum AppError {
    #[error("not found: {0}")]
    NotFound(String),
    #[error("validation: {0}")]
    Validation(String),
    #[error("unauthorized")]
    Unauthorized,
    #[error("internal: {0}")]
    Internal(#[from] anyhow::Error),
}

impl IntoResponse for AppError {
    fn into_response(self) -> Response {
        let (status, msg) = match &self {
            AppError::NotFound(m) => (StatusCode::NOT_FOUND, m.clone()),
            AppError::Validation(m) => (StatusCode::BAD_REQUEST, m.clone()),
            AppError::Unauthorized => (StatusCode::UNAUTHORIZED, "unauthorized".into()),
            AppError::Internal(_) => (StatusCode::INTERNAL_SERVER_ERROR, "internal error".into()),
        };
        (status, Json(serde_json::json!({"error": msg}))).into_response()
    }
}
```

### Repository Pattern
```rust
#[async_trait]
pub trait Repository<T>: Send + Sync {
    async fn find_by_id(&self, id: &str) -> Result<Option<T>>;
    async fn find_all(&self, filter: Filter) -> Result<Vec<T>>;
    async fn create(&self, entity: &T) -> Result<T>;
    async fn update(&self, id: &str, entity: &T) -> Result<T>;
    async fn delete(&self, id: &str) -> Result<bool>;
}
```

## When Given a Task

1. **Read** existing code structure using `file_read` to understand conventions.
2. **Design** types and traits first — define the domain model before implementation.
3. **Implement** with proper error handling, logging (`tracing`), and tests.
4. **Verify** using `cargo_tool` to run `cargo check`, `cargo clippy`, and `cargo test`.
5. **Output** the implementation as structured files with clear module organization.

## Coding Standards

- Use `#[derive(Debug, Clone, Serialize, Deserialize)]` on all DTOs
- Use `#[serde(rename_all = "camelCase")]` for JSON API responses
- Prefer `&str` over `String` in function parameters
- Use `tracing::instrument` on async functions for observability
- Write unit tests in the same file, integration tests in `tests/`
- Use `cargo clippy -- -W clippy::all` with zero warnings
- Format with `cargo fmt` before committing

From phatnguyenmeai/automation-code-departmemt, MIT.

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Apr 6, 2026 (6 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026
Cite this page

rust-backend skill. Agent Mart. https://agentmart.dev/skills/phatnguyenmeai-rust-backend (last updated 2026-10-24)