/prometheus-rust-skills:workspace-structurefrom prometheus-rust-skills
Canonical Rust workspace layout for Prometheus AGS multi-crate projects. Enforces resolver=2, workspace-level dependency versions, domain-driven crate separation (*-core / *-store / *-librarian / *-mcp / *-cli), feature flag discipline, and release profile settings. Use when scaffolding any new Prometheus Rust workspace.
Ships in prometheus-rust-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Every Prometheus AGS Rust project follows domain-driven workspace decomposition. Crates are separated by concern, not by layer.
my-project/
├── Cargo.toml ← workspace manifest
├── Cargo.lock ← always committed (application); gitignored (library-only)
├── CLAUDE.md ← agent development guide
├── README.md
├── .env.example
├── .gitignore
└── crates/
├── my-core/ ← domain types: structs, enums, traits — no I/O
│ ├── Cargo.toml
│ └── src/lib.rs
├── my-store/ ← persistence: flat-file, SurrealDB, PostgreSQL
├── my-librarian/ ← orchestration: business logic, LLM calls
├── my-mcp/ ← Axum MCP server (JSON-RPC 2.0 + SSE)
├── my-uar/ ← UAR integration (optional)
└── my-cli/ ← binary entry point
├── Cargo.toml
└── src/main.rs
Rule: *-core must never depend on any other workspace crate. It is the root of
the dependency graph. All other crates may depend on *-core.
[workspace]
members = ["crates/my-core", "crates/my-store", "crates/my-librarian", "crates/my-mcp", "crates/my-cli"]
resolver = "2" # Always resolver=2 for feature unification correctness
[workspace.package]
version = "0.1.0"
edition = "2021"
authors = ["Travis James <[email protected]>"]
license = "MIT"
[workspace.dependencies]
# Pin ALL external deps at the workspace level. Crate Cargo.toml only uses
# { workspace = true } — no version strings in crate manifests.
tokio = { version = "1", features = ["full"] }
axum = { version = "0.8", features = ["macros"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
anyhow = "1"
thiserror = "2"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
uuid = { version = "1", features = ["v4", "serde"] }
chrono = { version = "0.4", features = ["serde"] }
# Internal crates — always path deps
my-core = { path = "crates/my-core" }
my-store = { path = "crates/my-store" }
my-librarian = { path = "crates/my-librarian" }
my-mcp = { path = "crates/my-mcp" }
[profile.release]
strip = true
lto = true
codegen-units = 1
[package]
name = "my-store"
# No version/edition/authors — all inherited from workspace
version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
[dependencies]
my-core = { workspace = true }
tokio = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
anyhow = { workspace = true }
thiserror = { workspace = true }
Never put version strings in a crate's [dependencies] when the dep is declared
at workspace level. Use { workspace = true } exclusively.
Use feature flags only for genuinely optional capabilities. Don't use them to split code that always runs together — that's what crate separation is for.
[features]
default = []
jemalloc = ["dep:tikv-jemallocator"] # Optional allocator
mcp = ["dep:axum", "dep:tower"] # Enable MCP server in library crates
[dependencies]
tikv-jemallocator = { workspace = true, optional = true }
axum = { workspace = true, optional = true }
Apply jemalloc only in the binary entry point (*-cli), never in library crates.
my-core ← no deps on other workspace crates
my-store ← depends on: my-core
my-librarian ← depends on: my-core, my-store
my-mcp ← depends on: my-core, my-librarian
my-cli ← depends on: my-core, my-librarian, my-mcp
Circular dependencies are a compile error. If a circular dep is tempting, the design
has a layering problem — introduce a trait in *-core and implement it in a separate crate.
Cargo.lockCargo.lock, but check it in for reproducible CI[dependencies] when dep is declared at workspace levelresolver = "1" — always use resolver = "2"*-core depending on any other workspace crateWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub prometheus-ags/prometheus-skill-system --plugin prometheus-rust-skills13 skills in this plugin
/actor-modelTokio-native actor model pattern for Prometheus AGS projects. Implements actors as tokio tasks communicating via mpsc channels with a typed message enum, enabling safe concurrent state management without shared locks. Used in UAR session management, pk-librarian event broadcasting, and parking-lot scheduler design. Use when a component needs to own state exclusively while serving concurrent callers.
/async-patternsCanonical async Rust patterns for Prometheus AGS projects. Covers tokio task spawning, Arc<RwLock<T>> vs parking_lot::Mutex selection, blocking guard prevention, broadcast channels, graceful shutdown, and structured concurrency. Use whenever writing async code in any Prometheus Fabric crate.
/axum-patternsAxum 0.8 router, middleware, extractor, and state injection patterns for Prometheus AGS projects. Enforces the canonical Axum structure: typed state via Extension/State extractors, Tower middleware composition, structured error types, and Axum-native SSE for MCP servers. Use when building any Axum HTTP service, MCP server, or API gateway in the Prometheus stack.
/error-handlingCanonical Rust error handling for Prometheus AGS projects. Enforces the thiserror/anyhow boundary: thiserror for library crate errors (typed, composable), anyhow for application code (ergonomic, context-rich). Includes #[cold] error path annotation, no unwrap/expect in non-test code, and structured error propagation via the ? operator.
/karpathy-tokenizerTrain GPT-style BPE tokenizers with rustbpe (Karpathy), export to tiktoken for fast Rust inference, and integrate with agent-tokenizer for prompt-budget enforcement./mcp-serverCanonical Axum MCP server pattern for Prometheus AGS projects. Implements the MCP protocol as JSON-RPC 2.0 over HTTP POST /mcp with optional SSE event stream at GET /events. Covers tool registration, handler dispatch, SSE fan-out via broadcast, and stdio transport for Claude Desktop integration. Use when building any new MCP-enabled service in the Prometheus stack.
2 plugins in one repository ship this exact skill · first indexed Nov 27, 2026