[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CRNEX01Z32S0JDZBZ7WGDF":3,"skill-same:01M7CRNEX01Z32S0JDZBZ7WGDF":49},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":31,"ownerHtmlUrl":32,"ownerBlogUrl":6,"ownerDescription":33,"updatedAt":34,"install":35,"resources":48},"01M7CRNEX01Z32S0JDZBZ7WGDF","rust-axum-service",null,"Use when building or extending a Rust service - axum on tokio (or the repository's actix-web \u002F rocket), typed errors with IntoResponse, serde at the boundary, sqlx queries and migrations, never blocking the runtime, tracing, clippy","makifbaysal\u002Ftasktrooper","makifbaysal","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F25031940?v=4","01M7CRG3ZCSYZSSEVDMW3DEYC8","Mehmet Akif Baysal","01M7CRG401FJ8YAXH5ER730XYV",122,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fbackend-developer\u002Fskills\u002Frust-axum-service\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: rust-axum-service\ncategory: architecture\ndescription: Use when building or extending a Rust service - axum on tokio (or the repository's actix-web \u002F rocket), typed errors with IntoResponse, serde at the boundary, sqlx queries and migrations, never blocking the runtime, tracing, clippy\ntech_stack: Rust\n---\n# Rust Service (axum on tokio)\n\n## Overview\n\nRust moves a class of bugs to compile time, and leaves two to you: panics on a request path and blocking the async runtime. Most of the rules below are about those two.\n\n**Core principle:** the repository's framework, error crates, database crate and workspace layout win. Handlers stay thin; the domain is plain Rust that compiles without the web framework.\n\n## Layers\n\n| Layer | Responsibility | axum surface |\n|-------|----------------|--------------|\n| Router \u002F handler | Extract and validate input, call one service, map the result | `Router::new().route(...)`, extractors (`State`, `Path`, `Json`), `impl IntoResponse` |\n| Service | Use-case orchestration and business rules | a struct holding its ports, `async fn` methods |\n| Domain | Types and invariants: newtypes whose constructors validate | plain structs and enums, `thiserror` error enum |\n| Adapter | Database, outbound HTTP, queues | a type implementing the port trait (sqlx, reqwest) |\n\nIn a workspace the domain is often its own crate; a crate that does not depend on axum cannot leak it.\n\n## Patterns\n\n- **Toolchain:** `rust-toolchain.toml` when present; edition from `Cargo.toml` (2024 for a new crate). Commit `Cargo.lock` for a binary. Add crates with `cargo add`, the version from crates.io, not memory.\n- **No panics on a request path:** no `unwrap()`, `expect()`, indexing that can go out of bounds, or `as` casts that truncate on input-derived values. Use `?` with a typed error. `expect` is for startup invariants with a message that says why it cannot fail.\n- **Errors:** a domain error enum with `thiserror`; an application error that implements `IntoResponse` and maps each variant to 400\u002F404\u002F409 in the repository's problem shape, logging the source of a 500 and never returning it. `anyhow` belongs in `main` and scripts, not in a library or a handler's signature.\n- **Parse, don't validate:** request DTOs `#[derive(Deserialize)]` (with `#[serde(deny_unknown_fields)]` where the contract is strict), converted into domain newtypes (`TaskTitle::try_from(String)`) whose constructors enforce the invariant. A malformed JSON body is already a 4xx through `Json`'s rejection — keep that rejection in the same error shape.\n- **State:** one `AppState` (`Clone`, cheap: `Arc`s and pools inside) passed with `.with_state(state)` and taken by `State\u003CAppState>`; no global mutable statics.\n- **Never block the runtime:** blocking I\u002FO or CPU-heavy work goes to `tokio::task::spawn_blocking`; no `std::thread::sleep` in async code (`tokio::time::sleep`); never hold a `std::sync::Mutex` guard across `.await` — restructure, or use `tokio::sync::Mutex` when the lock must span an await.\n- **Timeouts and limits:** `tower_http` layers — `TimeoutLayer`, `RequestBodyLimitLayer`, `TraceLayer`, `CorsLayer` configured, not `permissive()` in production. Outbound `reqwest` clients built once with a timeout and shared.\n- **Database:** sqlx with bound parameters (`query!` \u002F `query_as!` checked at compile time; keep the offline `.sqlx` data committed with `cargo sqlx prepare` when the repository uses offline mode) or the repository's diesel \u002F sea-orm. Never `format!` a SQL string with input. Migrations with `sqlx migrate add \u003Cname>` (reversible when the repository's are) applied by `sqlx::migrate!()` or the deploy step; postgres-migrations covers safe DDL.\n- **Logging:** `tracing` with structured fields and `#[tracing::instrument(skip(state, body))]` on handlers and service methods — skip anything secret or large; JSON output from `tracing-subscriber` where the repository logs JSON.\n- **Graceful shutdown:** `axum::serve(listener, app).with_graceful_shutdown(signal)` on SIGTERM \u002F Ctrl-C.\n- **`unsafe`:** none in a feature task. If a dependency forces it, say so in a task comment; the security agent reviews every `unsafe` block.\n\n## Worked Example\n\n`POST \u002Ftasks`:\n\n```rust\n#[derive(Deserialize)]\n#[serde(deny_unknown_fields)]\npub struct CreateTask { title: String }\n\npub async fn create_task(\n    State(state): State\u003CAppState>,\n    user: AuthUser,\n    Json(body): Json\u003CCreateTask>,\n) -> Result\u003C(StatusCode, Json\u003CTaskResponse>), AppError> {\n    let title = TaskTitle::try_from(body.title)?;            \u002F\u002F 400 through AppError on a bad title\n    let task = state.tasks.create(user.id, title).await?;    \u002F\u002F the service owns the rule set\n    Ok((StatusCode::CREATED, Json(TaskResponse::from(task))))\n}\n```\n\n`TaskTitle::try_from` trims and rejects empty or over-200-character titles, so no `Task` with an invalid title can exist anywhere in the program.\n\n## Verify\n\nThe repository's commands first (list_component_checks, the Makefile, CI). Otherwise: `cargo fmt --check`, `cargo clippy --all-targets --all-features -- -D warnings`, `cargo test`. For the runtime check build once — `cargo build --release` (or the workspace's `-p \u003Capi>`) — and start `target\u002Frelease\u002F\u003Capi>` in the background with its port and `DATABASE_URL` set, rather than `cargo run`, whose child a terminal timeout can orphan.\n\n## Common Mistakes\n\n- `.unwrap()` on a parse of user input — one bad request takes the connection down with a panic.\n- `std::fs` or a synchronous client inside an `async fn` handler.\n- Cloning a large value per request where an `Arc` would do — or the reverse, wrapping everything in `Arc\u003CMutex\u003C_>>`.\n- `#[allow(clippy::...)]` added to get the build green.\n\n## Red Flags\n\n- `format!(\"SELECT ... {}\", input)` anywhere.\n- A `MutexGuard` alive across an `.await`.\n- `unsafe` in a diff with no comment explaining the invariant it relies on.\n- `tokio::spawn` with the `JoinHandle` dropped and no error handling inside the task.\n","# Rust Service (axum on tokio)\n\n## Overview\n\nRust moves a class of bugs to compile time, and leaves two to you: panics on a request path and blocking the async runtime. Most of the rules below are about those two.\n\n**Core principle:** the repository's framework, error crates, database crate and workspace layout win. Handlers stay thin; the domain is plain Rust that compiles without the web framework.\n\n## Layers\n\n| Layer | Responsibility | axum surface |\n|-------|----------------|--------------|\n| Router \u002F handler | Extract and validate input, call one service, map the result | `Router::new().route(...)`, extractors (`State`, `Path`, `Json`), `impl IntoResponse` |\n| Service | Use-case orchestration and business rules | a struct holding its ports, `async fn` methods |\n| Domain | Types and invariants: newtypes whose constructors validate | plain structs and enums, `thiserror` error enum |\n| Adapter | Database, outbound HTTP, queues | a type implementing the port trait (sqlx, reqwest) |\n\nIn a workspace the domain is often its own crate; a crate that does not depend on axum cannot leak it.\n\n## Patterns\n\n- **Toolchain:** `rust-toolchain.toml` when present; edition from `Cargo.toml` (2024 for a new crate). Commit `Cargo.lock` for a binary. Add crates with `cargo add`, the version from crates.io, not memory.\n- **No panics on a request path:** no `unwrap()`, `expect()`, indexing that can go out of bounds, or `as` casts that truncate on input-derived values. Use `?` with a typed error. `expect` is for startup invariants with a message that says why it cannot fail.\n- **Errors:** a domain error enum with `thiserror`; an application error that implements `IntoResponse` and maps each variant to 400\u002F404\u002F409 in the repository's problem shape, logging the source of a 500 and never returning it. `anyhow` belongs in `main` and scripts, not in a library or a handler's signature.\n- **Parse, don't validate:** request DTOs `#[derive(Deserialize)]` (with `#[serde(deny_unknown_fields)]` where the contract is strict), converted into domain newtypes (`TaskTitle::try_from(String)`) whose constructors enforce the invariant. A malformed JSON body is already a 4xx through `Json`'s rejection — keep that rejection in the same error shape.\n- **State:** one `AppState` (`Clone`, cheap: `Arc`s and pools inside) passed with `.with_state(state)` and taken by `State\u003CAppState>`; no global mutable statics.\n- **Never block the runtime:** blocking I\u002FO or CPU-heavy work goes to `tokio::task::spawn_blocking`; no `std::thread::sleep` in async code (`tokio::time::sleep`); never hold a `std::sync::Mutex` guard across `.await` — restructure, or use `tokio::sync::Mutex` when the lock must span an await.\n- **Timeouts and limits:** `tower_http` layers — `TimeoutLayer`, `RequestBodyLimitLayer`, `TraceLayer`, `CorsLayer` configured, not `permissive()` in production. Outbound `reqwest` clients built once with a timeout and shared.\n- **Database:** sqlx with bound parameters (`query!` \u002F `query_as!` checked at compile time; keep the offline `.sqlx` data committed with `cargo sqlx prepare` when the repository uses offline mode) or the repository's diesel \u002F sea-orm. Never `format!` a SQL string with input. Migrations with `sqlx migrate add \u003Cname>` (reversible when the repository's are) applied by `sqlx::migrate!()` or the deploy step; postgres-migrations covers safe DDL.\n- **Logging:** `tracing` with structured fields and `#[tracing::instrument(skip(state, body))]` on handlers and service methods — skip anything secret or large; JSON output from `tracing-subscriber` where the repository logs JSON.\n- **Graceful shutdown:** `axum::serve(listener, app).with_graceful_shutdown(signal)` on SIGTERM \u002F Ctrl-C.\n- **`unsafe`:** none in a feature task. If a dependency forces it, say so in a task comment; the security agent reviews every `unsafe` block.\n\n## Worked Example\n\n`POST \u002Ftasks`:\n\n```rust\n#[derive(Deserialize)]\n#[serde(deny_unknown_fields)]\npub struct CreateTask { title: String }\n\npub async fn create_task(\n    State(state): State\u003CAppState>,\n    user: AuthUser,\n    Json(body): Json\u003CCreateTask>,\n) -> Result\u003C(StatusCode, Json\u003CTaskResponse>), AppError> {\n    let title = TaskTitle::try_from(body.title)?;            \u002F\u002F 400 through AppError on a bad title\n    let task = state.tasks.create(user.id, title).await?;    \u002F\u002F the service owns the rule set\n    Ok((StatusCode::CREATED, Json(TaskResponse::from(task))))\n}\n```\n\n`TaskTitle::try_from` trims and rejects empty or over-200-character titles, so no `Task` with an invalid title can exist anywhere in the program.\n\n## Verify\n\nThe repository's commands first (list_component_checks, the Makefile, CI). Otherwise: `cargo fmt --check`, `cargo clippy --all-targets --all-features -- -D warnings`, `cargo test`. For the runtime check build once — `cargo build --release` (or the workspace's `-p \u003Capi>`) — and start `target\u002Frelease\u002F\u003Capi>` in the background with its port and `DATABASE_URL` set, rather than `cargo run`, whose child a terminal timeout can orphan.\n\n## Common Mistakes\n\n- `.unwrap()` on a parse of user input — one bad request takes the connection down with a panic.\n- `std::fs` or a synchronous client inside an `async fn` handler.\n- Cloning a large value per request where an `Arc` would do — or the reverse, wrapping everything in `Arc\u003CMutex\u003C_>>`.\n- `#[allow(clippy::...)]` added to get the build green.\n\n## Red Flags\n\n- `format!(\"SELECT ... {}\", input)` anywhere.\n- A `MutexGuard` alive across an `.await`.\n- `unsafe` in a diff with no comment explaining the invariant it relies on.\n- `tokio::spawn` with the `JoinHandle` dropped and no error handling inside the task.\n",{"name":5,"category":24,"tech_stack":25,"description":7},"architecture","Rust","main","910394a0b6db9fc8c9a8f36328ec421d3ebd8b38","catalog\u002Fagents\u002Fbackend-developer\u002Fskills\u002Frust-axum-service",18,"https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper","https:\u002F\u002Ftasktrooper.ai","https:\u002F\u002Fgithub.com\u002Fmakifbaysal","Senior Software Developer","2026-11-15 04:50:29",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add makifbaysal\u002Ftasktrooper --skill rust-axum-service",{"tool":41,"command":42},"bunx","bunx skills add makifbaysal\u002Ftasktrooper --skill rust-axum-service",{"tool":44,"command":45},"pnpm","pnpm dlx skills add makifbaysal\u002Ftasktrooper --skill rust-axum-service","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fbackend-developer\u002Fskills\u002Frust-axum-service\u002FSKILL.md",true,[],[50,56,63,70,77,84],{"skillNo":51,"name":52,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7CSVEPQW6J6TD6CS2T5FPNZ","visual-craft","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fvisual-craft\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7CSVAQG91ETHQ0HBNZDG5FR","ux-copy","Use when you write any words a user reads in a mockup or a hand-off - content language and voice, buttons, labels, errors, empty states, confirmations, numbers and dates, and the longest-string check","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fux-copy\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7CSV6H0J38659NDXHJQ8396","screen-mockup-html","Use when you draw screens as the design task's HTML mockup - ONE canvas document holding every screen and every variant side by side, the sanitizer-safe recipe, phone and wide frames, the states grid, static control states, and the loopback self-check with screenshots at 375, 768 and 1440 attached to the task","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fscreen-mockup-html\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7CSV3JFRF3BM3XK52M7YEYR","performance-awareness","How the performance score moves for your role. Use when the score context shows a declining trend, or before handing off work you have not self-checked against every criterion.","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fperformance-awareness\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7CSTZDH00YRF5SCT7BRT9QD","design-variants","Use when a screen design needs variants - how many, variants as side-by-side rows on the one canvas, what makes two variants genuinely different, recommending one, how the human's choice is read, and narrowing to the chosen one in revision","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fdesign-variants\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7CSTV6P3SM3PAE28DB0RF77","design-system-authoring","Use when you derive, change or extend a design system - where tokens live per stack, the DTCG token tree, role-based names for both themes, base vs layer vs drift, the DESIGN.md section order, the inventory format, the contrast check and the lint every proposal returns","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fdesign-system-authoring\u002FSKILL.md",[],[]]