Rust-Skills Capabilities Summary

2026-08-30 浏览 (11)

Rust-Skills Capabilities Summary

Complete capability inventory of the rust-skills Claude Code plugin

Overview

MetricCount
Total Skills31
Background Agents8
Slash Commands18
Unsafe Rules47
Coding Guidelines80+
Trigger Keywords400+

Core Architecture: Meta-Cognition Framework

Three-Layer Cognitive Model

┌─────────────────────────────────────────────────────┐
│ Layer 3: Domain Constraints (WHY)                   │
│ ├── domain-fintech: Audit, precision, immutability │
│ ├── domain-web: Stateless, thread-safe, async      │
│ ├── domain-cli: Single-thread, user interaction    │
│ ├── domain-embedded: no_std, resource constraints  │
│ ├── domain-cloud-native: Distributed, observable   │
│ ├── domain-iot: Low resource, telemetry            │
│ └── domain-ml: Tensor ops, inference optimization  │
├─────────────────────────────────────────────────────┤
│ Layer 2: Design Choices (WHAT)                      │
│ ├── m09-domain: DDD, entity vs value object        │
│ ├── m10-performance: Benchmarking, optimization    │
│ ├── m11-ecosystem: Crate selection, integration    │
│ ├── m12-lifecycle: RAII, Drop, resource patterns   │
│ ├── m13-domain-error: Retry, circuit breaker       │
│ ├── m14-mental-model: Learning, mental models      │
│ └── m15-anti-pattern: Code smells, pitfalls        │
├─────────────────────────────────────────────────────┤
│ Layer 1: Language Mechanics (HOW)                   │
│ ├── m01-ownership: Ownership, borrowing, lifetime  │
│ ├── m02-resource: Box, Rc, Arc, smart pointers     │
│ ├── m03-mutability: mut, Cell, RefCell, interior   │
│ ├── m04-zero-cost: Generics, traits, dispatch      │
│ ├── m05-type-driven: Newtype, PhantomData, state   │
│ ├── m06-error-handling: Result, Error, panic       │
│ └── m07-concurrency: Send, Sync, async, channels   │
└─────────────────────────────────────────────────────┘

Routing Flow

User Question
    │
    ▼
┌─────────────────┐
│ Hook Triggers   │ ← 400+ keywords (EN/CN/Error codes)
│ (UserPromptSubmit)
└────────┬────────┘
         │
         ▼
┌─────────────────┐
│ rust-router     │ ← Identifies entry layer + domain
└────────┬────────┘
         │
    ┌────┴────┐
    │         │
    ▼         ▼
┌───────┐ ┌────────┐
│ L1    │ │ L3     │  ← Dual-skill loading
│ Skill │ │ Domain │
└───┬───┘ └────┬───┘
    │          │
    └────┬─────┘
         │
         ▼
┌─────────────────┐
│ Trace UP/DOWN   │ ← Cross-layer reasoning
└────────┬────────┘
         │
         ▼
┌─────────────────┐
│ Context-Aware   │ ← Domain best practices
│ Answer          │
└─────────────────┘

Skills Inventory (31 Total)

Layer 1: Language Mechanics (7 Skills)

SkillCore QuestionTriggers
m01-ownershipWho should own this data?E0382, E0597, E0506, E0507, E0515, E0716, move, borrow, lifetime
m02-resourceWhat ownership model needed?Box, Rc, Arc, Weak, RefCell, Cell, smart pointer
m03-mutabilityWhere are immutability boundaries?E0596, E0499, E0502, mut, interior mutability
m04-zero-costWhat can compiler optimize?E0277, E0308, E0599, generic, trait, monomorphization
m05-type-drivenHow do types encode constraints?PhantomData, newtype, type state, builder pattern
m06-error-handlingExpected or exceptional failure?Result, Option, Error, panic, anyhow, thiserror
m07-concurrencyHow ensure compile-time safety?Send, Sync, thread, async, await, Mutex, channel

Layer 2: Design Choices (7 Skills)

SkillCore QuestionFocus
m09-domainHow do domain rules become types?DDD, entity, value object, aggregate, repository
m10-performanceWhat are performance bottlenecks?Benchmark, profiling, flamegraph, criterion
m11-ecosystemHow integrate with existing systems?Crate selection, FFI, PyO3, WASM, feature flags
m12-lifecycleWhat are domain resource patterns?RAII, Drop, connection pools, OnceCell
m13-domain-errorWhat are failure recovery strategies?Retry, circuit breaker, graceful degradation
m14-mental-modelWhat is the correct mental model?Learning Rust, visual memory, analogies
m15-anti-patternWhat are common cognitive pitfalls?Code smells, beginner mistakes, idioms

Layer 3: Domain Constraints (7 Skills)

SkillDomainKey Constraints
domain-fintechFinancialAudit trail, decimal precision, immutable transactions
domain-webWeb ServicesStateless HTTP, thread-safe state, async handlers
domain-cliCommand LineArgument parsing, TUI, progress bars, config files
domain-embeddedEmbedded/no_stdMCU, bare metal, HAL, interrupts, resource limits
domain-cloud-nativeCloudKubernetes, gRPC, observability, distributed tracing
domain-iotIoTMQTT, sensors, edge computing, low resources
domain-mlMachine LearningTensors, inference, model optimization

Core & Utility Skills (10 Skills)

SkillPurpose
rust-routerRoutes ALL Rust questions, implements meta-cognition
rust-learnerFetches latest Rust/crate versions via agents
coding-guidelines80+ Rust coding rules (naming, style, patterns)
unsafe-checker47 unsafe rules, SAFETY comments, FFI review
rust-dailyAggregates Rust news from Reddit, TWIR, blogs
rust-skill-creatorGenerates new skills from documentation
core-actionbookPre-computed website selectors
core-agent-browserBrowser automation infrastructure
core-dynamic-skillsDynamic skill generation from Cargo.toml
core-fix-skill-docsSkill documentation maintenance

Agents (8 Background Researchers)

AgentData SourceOutput
rust-changelogreleases.rsRust version features, breaking changes
crate-researcherlib.rs, crates.ioCrate metadata, versions, features
docs-researcherdocs.rsThird-party crate API documentation
std-docs-researcherdoc.rust-lang.orgStandard library documentation
clippy-researcherrust-clippyLint explanations, categories
rust-daily-reporterReddit, TWIR, BlogEcosystem news (day/week/month)
browser-fetcherWebFetchGeneric web content fallback

Tool Chain Priority

1. actionbook MCP    → Pre-computed selectors
2. agent-browser CLI → Browser automation
3. WebFetch          → Last resort fallback

Commands (18 Slash Commands)

Query Commands

CommandPurpose
/rust-routerRoute question to appropriate skill
/guideline [--clippy] ruleQuery coding guidelines
/skill-index categorySearch skills by category
/docs crate [item]Fetch API documentation

Version & Info Commands

CommandPurpose
/rust-features [version]Rust changelog/features
/crate-info crateCrate metadata
/rust-daily [day|week|month]Ecosystem news

Audit Commands

CommandPurpose
/unsafe-check fileAnalyze file for unsafe issues
/unsafe-review fileInteractive unsafe review
/rust-review fileLightweight clippy review
/audit [security|safety|concurrency|full]Heavy-weight audit

Cache Commands

CommandPurpose
/cache-status [--verbose]Show cache status
/cache-clean [--all|--expired|crate]Clean cache

Dynamic Skill Commands

CommandPurpose
/sync-crate-skills [--force]Generate skills from Cargo.toml
/update-crate-skill crateUpdate specific crate skill
/clean-crate-skills [--all]Remove dynamic skills
/create-skills-via-llms crate pathCreate skill from llms.txt
/create-llms-for-skills urlsGenerate llms.txt from URLs
/fix-skill-docs [--check-only]Fix skill documentation

Unsafe Checker (47 Rules)

Categories

CategoryRulesFocus
Memory Safety12Pointer validity, alignment, initialization
FFI Safety10C interop, ABI, extern functions
Concurrency8Send/Sync impl, data races
Undefined Behavior10Transmute, unions, aliasing
Documentation7SAFETY comments, invariants

SAFETY Comment Requirement

// SAFETY: [preconditions] are satisfied because [reasoning]
unsafe {
    // code
}

Coding Guidelines (80+ Rules)

Categories

CategoryRulesExamples
Naming15snake_case, PascalCase, SCREAMING_SNAKE
Data Types12Prefer &str over String, use newtype
Error Handling10No unwrap in lib, use thiserror
Memory8Avoid unnecessary allocations
Concurrency10Prefer channels over shared state
Async8Don't block in async, scope locks
Macros5Prefer functions over macros
Documentation12Doc examples, # Panics, # Errors

Meta-Cognition Framework (_meta/)

FilePurpose
reasoning-framework.mdThree-layer tracing methodology
layer-definitions.mdL1/L2/L3 scope and signals
error-protocol.md3-Strike escalation rule
externalization.mdFilesystem as external memory
hooks-patterns.mdCognitive trigger patterns

Hook System

Trigger Keywords (400+)

CategoryExamples
Error CodesE0382, E0597, E0277, E0499, E0502, E0596
Ownershipownership, borrow, lifetime, move, clone
Concurrencyasync, await, Send, Sync, thread, spawn
Smart PointersBox, Rc, Arc, RefCell, Cell, Mutex
DomainsWeb API, HTTP, axum, payment, trading, CLI
Chinese所有权, 借用, 生命周期, 异步, 并发, 智能指针
Questionshow to, why, what is, 怎么, 为什么, 如何

Hook Behavior

  1. Detect domain keywords → Load both L1 and L3 skills
  2. Enforce output format → Reasoning Chain required
  3. Mandate tracing → Must trace through relevant layers

Caching System

Configuration

CacheTTLPurpose
Crates24hCrate metadata
Rust Versions168hRelease info
Docs72hAPI documentation
Clippy Lints168hLint data

Features

  • Auto-cleanup of expired entries
  • Stale-while-revalidate strategy
  • Size limits per category

Project Configuration

Default Rust Project Settings

[package]
edition = "2024"
rust-version = "1.85"

[lints.rust]
unsafe_code = "warn"

[lints.clippy]
all = "warn"
pedantic = "warn"

Plugin Manifest

{
  "name": "rust-skills",
  "version": "1.0.0",
  "skills": "./skills/",
  "hooks": "./hooks/hooks.json"
}

Unique Capabilities

1. Meta-Cognition Routing

Not just answering questions, but tracing through cognitive layers to provide domain-aware solutions.

2. Dual-Skill Loading

When domain context detected, automatically loads BOTH:

  • Layer 1 skill (mechanics)
  • Layer 3 skill (domain constraints)

3. Dynamic Skill Generation

Automatically generates crate-specific skills from Cargo.toml dependencies.

4. Background Research Agents

8 specialized agents fetch live data without blocking conversation.

5. Comprehensive Unsafe Auditing

47 rules covering memory safety, FFI, concurrency, and documentation.

6. Bilingual Support

400+ trigger keywords in both English and Chinese.


Example: Meta-Cognition in Action

Question: "My Web API reports Rc cannot be sent between threads"

Traditional Answer:

Use Arc instead of Rc.

Meta-Cognition Answer:

### Reasoning Chain
+-- Layer 1: Send/Sync Error
|   Problem: Rc<T> cannot be sent between threads
|       ^
+-- Layer 3: Web Domain (domain-web)
|   Constraint: Handlers run on any thread
|   Rule: Shared state must be thread-safe
|       v
+-- Layer 2: Design Choice
    Decision: Use Arc<T> + State extractor

### Domain Constraints Analysis
From domain-web:
- "Rc in state" is listed as Common Mistake
- Web handlers require Send + Sync bounds
- Recommended pattern: axum State<Arc<T>>

### Recommended Solution
[Complete code using axum State extractor with Arc,
following Web domain best practices]

Summary

rust-skills transforms Claude from a Rust knowledge base into a domain-aware Rust architect that:

  1. Routes questions through appropriate cognitive layers
  2. Traces to find underlying domain constraints
  3. Recommends solutions aligned with domain best practices
  4. Researches live data through background agents
  5. Audits code for safety and style compliance

The goal: Surface-level fixes → Architecturally sound, domain-aware solutions

你可能感兴趣的文章

Meta-Cognition 示例: E0382 交易系统

Rust-Skills 功能概览

Skills Design Lessons Learned

Hook 机制详解

Context Optimization Guide

Claude Code 配置优先级

Prompt 约束技巧

Skill 继承机制

Skills 编写最佳实践

What Is a Skill?

  • 所属分类: AI
  • 本文标签: rust
  • 版权声明: 本文链接 https://seaxiang.com/blog/XSShPXkn