rust-development
Gutsプロジェクトにおいて、Rustの慣用的なコーディング、エラー処理、非同期処理パターン、そして共通コンポーネントの統合といった、開発におけるベストプラクティスを実践するSkill。
📜 元の英語説明(参考)
Rust development best practices for the Guts project - idiomatic code, error handling, async patterns, and commonware integration
🇯🇵 日本人クリエイター向け解説
Gutsプロジェクトにおいて、Rustの慣用的なコーディング、エラー処理、非同期処理パターン、そして共通コンポーネントの統合といった、開発におけるベストプラクティスを実践するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o rust-development.zip https://jpskill.com/download/8808.zip && unzip -o rust-development.zip && rm rust-development.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/8808.zip -OutFile "$d\rust-development.zip"; Expand-Archive "$d\rust-development.zip" -DestinationPath $d -Force; ri "$d\rust-development.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
rust-development.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
rust-developmentフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Guts 用 Rust 開発スキル
分散型インフラストラクチャ用の commonware プリミティブを使用して Rust プロジェクトを開発しています。
コードスタイルガイドライン
一般原則
- 慣用的な Rust: Rust のイディオムと慣習に従ってください
- メモリ安全性: ボローチェッカーを活用し、どうしても必要な場合を除き
unsafeを避けてください - エラー処理: ライブラリのエラーには
thiserrorを、アプリケーションにはanyhowを使用してください - ドキュメント: すべての公開アイテムには、例を含むドキュメントが必要です
フォーマットとリンティング
# コミット前に必ず実行してください
cargo fmt --all
cargo clippy --all-targets --all-features -- -D warnings
エラー処理パターン
use thiserror::Error;
#[derive(Debug, Error)]
pub enum RepositoryError {
#[error("repository not found: {0}")]
NotFound(String),
#[error("permission denied for repository: {0}")]
PermissionDenied(String),
#[error("storage error: {0}")]
Storage(#[from] StorageError),
}
pub type Result<T> = std::result::Result<T, RepositoryError>;
Async パターン
構造化された並行性を持つ非同期ランタイムには Tokio を使用します。
use tokio::sync::{mpsc, oneshot};
// 共有状態よりもチャネルを優先します
pub struct Service {
tx: mpsc::Sender<Command>,
}
impl Service {
pub async fn query(&self, request: Request) -> Result<Response> {
let (tx, rx) = oneshot::channel();
self.tx.send(Command::Query { request, reply: tx }).await?;
rx.await?
}
}
モジュール構造
// lib.rs - 公開 API を再エクスポートします
pub mod error;
pub mod types;
pub mod service;
pub use error::{Error, Result};
pub use types::*;
pub use service::Service;
テスト
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn test_feature() {
// Arrange
let service = Service::new().await;
// Act
let result = service.do_something().await;
// Assert
assert!(result.is_ok());
}
}
Commonware 統合
主要なクレート
commonware-cryptography: Ed25519 署名に使用しますcommonware-p2p: ピアツーピアネットワークに使用しますcommonware-consensus: BFT コンセンサスに使用しますcommonware-storage: 永続ストレージに使用しますcommonware-codec: シリアライゼーションに使用します
例: 暗号の使用
use commonware_cryptography::{Ed25519, Signer, Verifier};
pub struct Identity {
keypair: Ed25519,
}
impl Identity {
pub fn new() -> Self {
Self {
keypair: Ed25519::generate(),
}
}
pub fn sign(&self, message: &[u8]) -> Signature {
self.keypair.sign(message)
}
}
Cargo.toml のベストプラクティス
[package]
name = "guts-core"
version = "0.1.0"
edition = "2021"
rust-version = "1.75"
license = "MIT OR Apache-2.0"
description = "Core types and traits for Guts"
repository = "https://github.com/AbdelStark/guts"
keywords = ["decentralized", "git", "p2p"]
categories = ["development-tools"]
[dependencies]
# ワークスペースの依存関係を使用します
thiserror = { workspace = true }
tokio = { workspace = true }
[dev-dependencies]
tokio-test = { workspace = true }
[lints.rust]
unsafe_code = "deny"
missing_docs = "warn"
[lints.clippy]
all = "warn"
pedantic = "warn"
nursery = "warn"
パフォーマンスに関する考慮事項
- 非同期タスク間で共有所有権を得るには
Arcを使用します - ゼロコピーネットワーキングには
bytes::Bytesを優先します - 並行ハッシュマップには
dashmapを使用します - 最適化する前に
flamegraphでプロファイルします
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Rust Development Skill for Guts
You are developing a Rust project using commonware primitives for decentralized infrastructure.
Code Style Guidelines
General Principles
- Idiomatic Rust: Follow Rust idioms and conventions
- Memory Safety: Leverage the borrow checker, avoid unsafe unless absolutely necessary
- Error Handling: Use
thiserrorfor library errors,anyhowfor applications - Documentation: Every public item needs docs with examples
Formatting & Linting
# Always run before committing
cargo fmt --all
cargo clippy --all-targets --all-features -- -D warnings
Error Handling Pattern
use thiserror::Error;
#[derive(Debug, Error)]
pub enum RepositoryError {
#[error("repository not found: {0}")]
NotFound(String),
#[error("permission denied for repository: {0}")]
PermissionDenied(String),
#[error("storage error: {0}")]
Storage(#[from] StorageError),
}
pub type Result<T> = std::result::Result<T, RepositoryError>;
Async Patterns
Use Tokio for async runtime with structured concurrency:
use tokio::sync::{mpsc, oneshot};
// Prefer channels over shared state
pub struct Service {
tx: mpsc::Sender<Command>,
}
impl Service {
pub async fn query(&self, request: Request) -> Result<Response> {
let (tx, rx) = oneshot::channel();
self.tx.send(Command::Query { request, reply: tx }).await?;
rx.await?
}
}
Module Structure
// lib.rs - re-export public API
pub mod error;
pub mod types;
pub mod service;
pub use error::{Error, Result};
pub use types::*;
pub use service::Service;
Testing
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn test_feature() {
// Arrange
let service = Service::new().await;
// Act
let result = service.do_something().await;
// Assert
assert!(result.is_ok());
}
}
Commonware Integration
Key Crates
commonware-cryptography: Use for Ed25519 signaturescommonware-p2p: Use for peer-to-peer networkingcommonware-consensus: Use for BFT consensuscommonware-storage: Use for persistent storagecommonware-codec: Use for serialization
Example: Using Cryptography
use commonware_cryptography::{Ed25519, Signer, Verifier};
pub struct Identity {
keypair: Ed25519,
}
impl Identity {
pub fn new() -> Self {
Self {
keypair: Ed25519::generate(),
}
}
pub fn sign(&self, message: &[u8]) -> Signature {
self.keypair.sign(message)
}
}
Cargo.toml Best Practices
[package]
name = "guts-core"
version = "0.1.0"
edition = "2021"
rust-version = "1.75"
license = "MIT OR Apache-2.0"
description = "Core types and traits for Guts"
repository = "https://github.com/AbdelStark/guts"
keywords = ["decentralized", "git", "p2p"]
categories = ["development-tools"]
[dependencies]
# Use workspace dependencies
thiserror = { workspace = true }
tokio = { workspace = true }
[dev-dependencies]
tokio-test = { workspace = true }
[lints.rust]
unsafe_code = "deny"
missing_docs = "warn"
[lints.clippy]
all = "warn"
pedantic = "warn"
nursery = "warn"
Performance Considerations
- Use
Arcfor shared ownership across async tasks - Prefer
bytes::Bytesfor zero-copy networking - Use
dashmapfor concurrent hash maps - Profile with
flamegraphbefore optimizing