結構化的 Rust 程式語言知識體系,專為 AI Agent(Claude Code、Copilot、ChatGPT 等)設計,讓 AI 能產出高品質、production-ready 的 Rust 程式碼。
本專案包含 12 個獨立的 Rust 技能模組,涵蓋從基礎到進階的完整知識體系。每個技能模組都遵循統一的結構規範,包含:
- SKILL.md — 主要知識文件(含 YAML frontmatter 觸發描述)
- references/sources.md — 參考來源清單
- examples/ — 三級程式碼範例(Basic / Intermediate / Advanced)
所有內容針對 Rust Edition 2024(Rust 1.85+),crate 版本均為 2025 年最新穩定版。
| # | 技能 | 說明 |
|---|---|---|
| 1 | rust-project-init | Cargo 專案初始化、workspace 設定、Cargo.toml 最佳實踐 |
| 2 | rust-ownership-patterns | Ownership / Borrowing / Lifetime 模式與編譯器錯誤修復 |
| 3 | rust-error-handling | Result/Option、thiserror 2.0、anyhow、? 運算子 |
| # | 技能 | 說明 |
|---|---|---|
| 4 | rust-async-runtime | tokio 1.44 runtime、async/await、channel 與 task spawn |
| 5 | rust-testing | #[test]、proptest、mockall、cargo-llvm-cov 覆蓋率 |
| 6 | rust-design-patterns | Builder / Newtype / Typestate / RAII 等慣用模式 |
| # | 技能 | 說明 |
|---|---|---|
| 7 | rust-ffi-interop | PyO3 / cbindgen / bindgen、Rust ↔ C/Python 互操作 |
| 8 | rust-unsafe-guide | unsafe 使用準則、安全封裝、Miri 驗證 |
| 9 | rust-performance | criterion benchmark、flamegraph、記憶體與效能優化 |
| # | 技能 | 說明 |
|---|---|---|
| 10 | rust-crate-selection | 12 領域 crate 推薦、選擇標準與版本鎖定 |
| 11 | rust-ci-deploy | GitHub Actions、Docker、cargo-dist 發布流程 |
| 12 | rust-prompt-templates | 7 大類 21 個 AI 輔助 Rust 開發提示詞模板 |
- 技能數量:12
- 程式碼範例:36 個(每技能 3 級)
- 參考來源:130+ 個
- 錯誤對照表:80+ 條
- 目標 Edition:Rust 2024
- 將
rust-skills/目錄加入 AI Agent 的 skill 搜尋路徑 - Agent 根據使用者問題,比對 SKILL.md 的
description欄位觸發相關技能 - 載入對應 SKILL.md 作為上下文,產出高品質 Rust 程式碼
# 查看技能索引
cat rust-skills/index.md
# 閱讀特定技能
cat rust-skills/rust-error-handling/SKILL.md
# 執行範例程式碼
cd rust-skills/rust-error-handling/examples
rustc basic.rs && ./basic在 .claude/skills/ 或 .copilot/skills/ 中建立 symlink 或複製對應 skill 資料夾即可自動觸發。
rust-skill/
├── claude.md # 建構指令文件
├── README.md # 本文件
└── rust-skills/
├── index.md # 技能索引
├── SUMMARY.md # 研究摘要
├── rust-project-init/
│ ├── SKILL.md
│ ├── references/sources.md
│ └── examples/
│ ├── basic.rs
│ ├── intermediate.rs
│ └── advanced.rs
├── rust-ownership-patterns/
│ └── ...(同上結構)
├── rust-error-handling/
├── rust-async-runtime/
├── rust-testing/
├── rust-design-patterns/
├── rust-ffi-interop/
├── rust-unsafe-guide/
├── rust-performance/
├── rust-crate-selection/
├── rust-ci-deploy/
└── rust-prompt-templates/
| Crate | 版本 | 用途 |
|---|---|---|
| tokio | 1.44 | 非同步 runtime |
| serde | 1.0 | 序列化框架 |
| thiserror | 2.0 | Library 錯誤定義 |
| anyhow | 1.0 | Application 錯誤處理 |
| clap | 4.5 | CLI 參數解析 |
| axum | 0.8 | Web 框架 |
| sqlx | 0.8 | 非同步資料庫 |
| reqwest | 0.12 | HTTP Client |
| tracing | 0.1 | 結構化日誌 |
| criterion | 0.5 | Benchmark |
| pyo3 | 0.23 | Python 互操作 |
| proptest | 1.6 | 屬性測試 |
每個 SKILL.md 遵循以下品質紅線:
- YAML frontmatter 含
name和description(≥5 觸發關鍵詞) - 程式碼範例 ≥ 3 個(Basic / Intermediate / Advanced)
- 常見錯誤對照表 ≥ 3 筆
- 參考來源 ≥ 5 個
- 總行數 ≤ 500
- 無 placeholder 或 TODO 殘留
- Crate 版本為 2025 最新穩定版
歡迎提交 Issue 或 PR:
- Fork 本專案
- 建立功能分支:
git checkout -b feat/new-skill - 遵循現有 SKILL.md 格式與品質標準
- 提交 PR 並附上技能自評
MIT License
本專案由 AI Agent 自動研究與建構,所有內容經過結構化整理,非直接複製外部文件。