/prometheus-skill-pack:error-handlingfrom prometheus-skill-pack
Canonical 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.
Ships in prometheus-skill-pack. 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.
Library crates (*-core, *-store, *-librarian, etc.) define typed errors with thiserror.
Application crates (*-cli, *-mcp) use anyhow::Result for ergonomic propagation.
// In a library crate (forge-core, pk-store, etc.)
#[derive(thiserror::Error, Debug)]
pub enum StoreError {
#[error("entry not found: {0}")]
NotFound(String),
#[error("serialization failed")]
Serialize(#[from] serde_json::Error),
#[error("I/O error")]
Io(#[from] std::io::Error),
}
// In an application crate (forge-cli, pk-cherry, etc.)
use anyhow::{Context, Result};
fn load_config(path: &Path) -> Result<Config> {
let raw = std::fs::read_to_string(path)
.with_context(|| format!("reading config from {}", path.display()))?;
toml::from_str(&raw).context("parsing config")
}
#[cold]Mark error paths #[cold] and #[inline(never)] to push them out of the hot path
and improve instruction cache behavior. This is especially important in server code
where errors are rare but the hot path runs millions of times.
#[cold]
#[inline(never)]
fn report_store_error(e: &StoreError) {
tracing::error!(error = %e, "store operation failed");
}
// In hot path:
match store.get(id) {
Ok(entry) => process(entry),
Err(e) => { report_store_error(&e); return Err(e.into()); }
}
? Operator and ContextAlways use ? for error propagation. Never use unwrap() or expect() outside of:
#[test] functionsconst evaluation where panic is intentional// SAFETY: commentsWhen using ?, add context to make error messages actionable:
// Bad — "No such file or directory" with no context
let content = std::fs::read_to_string(path)?;
// Good — "reading wiki entry from /path/to/file.md: No such file or directory"
let content = std::fs::read_to_string(path)
.with_context(|| format!("reading wiki entry from {}", path.display()))?;
Use #[from] on thiserror variants for automatic From impl. Use .map_err() when
the conversion is non-trivial or context-dependent.
#[derive(thiserror::Error, Debug)]
pub enum LibrarianError {
// Automatic From<StoreError> via #[from]
#[error("store error")]
Store(#[from] StoreError),
// Manual conversion with context
#[error("LLM API error: {message}")]
LlmApi { message: String },
}
// Manual conversion
async fn compile(raw: RawDoc) -> Result<WikiEntry, LibrarianError> {
let response = call_llm(&raw.content)
.await
.map_err(|e| LibrarianError::LlmApi { message: e.to_string() })?;
// ...
}
Log errors at the boundary where they are handled — not where they originate. Use structured fields so logs are machine-parseable.
match operation().await {
Ok(result) => { /* happy path */ }
Err(e) => {
tracing::error!(
error = %e,
error.kind = std::any::type_name_of_val(&e),
"operation failed"
);
return Err(e.into());
}
}
unwrap() in non-test production code — use ? or matchexpect("message") in non-test production code — add .with_context(|| ...) insteadpanic!() in library crates — return an errorlet _ = risky_operation(); — log or propagateeprintln! for errors — use tracing::error!What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub prometheus-ags/prometheus-skill-system --plugin prometheus-skill-pack218 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.
/adversarial-reviewIsolated, cross-model adversarial review of KBD artifacts and change diffs. Dispatches a fresh-context LLM judge over an OpenAI-compatible REST gateway (openai-proxy or `liter-llm api`) with an explicit mandate to find problems — the model that produced an artifact or change is never the model that reviews it. Runs as a pipeline stage inside kbd-assess/analyze/plan (artifact mode) and kbd-execute's single phase-boundary QA step (diff mode, once over the whole phase diff). Findings are severity-bucketed (CRITICAL/WARNING/SUGGESTION) and the judge's own report is screened by sycophancy-correction before it is surfaced.
/agent-team-creatorCreate, revise, package, and deploy agent-team definitions with staged questions and native exports for UAR, Codex, Claude Code, Copilot, Kimi Code, MiniMax CLI, OpenCode and DeepSeek. Use for team definition and catalog lifecycle; use agent-team-manage for active runtime task state.Other plugins' skills for the same job
2 plugins in one repository ship this exact skill · first indexed Nov 27, 2026