rust-conventions

Enforces Rust workspace conventions for error handling, async patterns, logging, and dependencies in GRID Craft Launcher.

Updated Sep 8, 2026
One-click install
npx skills add https://github.com/Sixdd6/grid-craft-launcher --skill rust-conventions-sixdd6
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rust-conventions
Source: https://github.com/Sixdd6/grid-craft-launcher/tree/main/.claude/skills/rust-conventions
Command: npx skills add https://github.com/Sixdd6/grid-craft-launcher --skill rust-conventions-sixdd6

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Rust code written for the GRID Craft Launcher often drifts from the project's established patterns, producing inconsistent error types, ad-hoc HTTP clients, blocking calls on the async runtime, and unvetted dependencies. This Skill gives an AI assistant the project's exact rules before it writes any Rust in gcl-core or gcl-cli. ## Core Features & Use Cases - Workspace layout rules: gcl-core as a library with one directory per module, gcl-cli mapping subcommands to Launcher methods, and no logic in gcl-ui beyond model adapters. - Error and async discipline: per-module thiserror enums wrapped by a crate-level error, anyhow in binaries, a single tokio runtime owned by Launcher, spawn_blocking for heavy work, and CancellationToken for long tasks. - Vetted dependency table: pinned crate choices for HTTP (reqwest with rustls), hashing, zip, keyring, tracing, clap, Slint, and testing tools like wiremock and insta. - Use Case: Ask the assistant to add a new Modrinth download command to gcl-cli, and it will route through gcl_core::Launcher, reuse the shared HttpClient, instrument with tracing, and return module errors via thiserror instead of panicking. ## Quick Start Read this Skill before writing any Rust code in gcl-core or gcl-cli and follow its layout, error, async, logging, and dependency rules for every change.

Frequently Asked Questions about rust-conventions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure error handling in a Rust workspace with multiple crates?▼

Give each core module its own pub enum Error derived with thiserror, carrying context like URLs and paths in variants. Wrap them in a crate-level error using #[from], and use anyhow with {:#} formatting only in binaries.

How should async Rust code handle blocking operations like zip extraction or hashing?▼

Run blocking work such as zip extraction, hashing, and large file copies through tokio::task::spawn_blocking so the async runtime is not stalled. Keep a single tokio runtime owned by the application core rather than building runtimes in binaries.

Should each Rust module create its own reqwest Client?▼

No. Network code should accept a shared &HttpClient from the core http module instead of constructing its own reqwest::Client. This centralizes configuration like the rustls TLS backend and avoids duplicate connection pools.

Can I use unwrap or expect in production Rust code?▼

No. unwrap, expect, and panic! are restricted to tests and build.rs. Production code propagates errors with the ? operator through the module error types and the crate-level error enum.

What serde settings should Rust structs use for external JSON APIs?▼

Place remote JSON structs in the owning module, derive Deserialize, apply #[serde(rename_all = "camelCase")] when the API uses it, and add #[serde(default)] on optional arrays. Unknown fields stay ignored; do not add deny_unknown_fields.

When should a new dependency be added to a Rust workspace?▼

Only when std or an existing dependency cannot do the job. Add it to [workspace.dependencies] first, then reference it with dep.workspace = true in the crate, choosing versions from the project's vetted dependency table.