model-diagnostics

model-diagnostics is a skill for Claude Code, Codex from choxos/BiostatAgent. It costs 26 tokens per session (1,644 once invoked), scanned A, original, MIT.

A guide for checking whether Bayesian model simulations are trustworthy, including convergence, effective sample size, divergences, tree-depth limits, and posterior predictive checks. Bayesian models estimate uncertain quantities from probability distributions.

In plain words
What is it for?
Use it to diagnose Stan or JAGS results, inspect Rhat and effective sample size, count divergences, check tree-depth limits, and perform posterior predictive checks.
Why use it?
It helps reveal when a simulation has not explored the model correctly or when its estimates may be unreliable. The checks provide concrete warning signs instead of relying only on the model's final output.

Skill for Claude CodeCodex

Part of the bayesian-modeling plugin — 9 skills, 3 commands, 6 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/choxos/biostatagent/model-diagnostics
Any agent
npx skills add choxos/BiostatAgent --skill model-diagnostics
Clone the repo
git clone --depth 1 https://github.com/choxos/BiostatAgent

Made for: Claude Code, Codex.

Or install bayesian-modeling, the plugin that ships this one along with the rest of its 9 skills, 3 commands, 6 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for model-diagnostics

README.md
[![agentmods](https://agentmods.dev/badge/skills/choxos/biostatagent/model-diagnostics.svg)](https://agentmods.dev/skills/choxos/biostatagent/model-diagnostics)
Your own site
<a href="https://agentmods.dev/skills/choxos/biostatagent/model-diagnostics"><img src="https://agentmods.dev/badge/skills/choxos/biostatagent/model-diagnostics.svg" alt="Measured on agentmods" height="20"></a>
Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,644 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00026 $0.01644
Opus 5 $0.00013 $0.00822
Sonnet 5 $0.00005 $0.00329
Haiku 4.5 $0.00003 $0.00164

Measured 4d ago against content hash b132ef2f6da2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

model-diagnostics scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/bayesian-modeling/skills/model-diagnostics/SKILL.md · 237 lines

How it starts

The opening of the file, as written. The whole thing — 237 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Model Diagnostics

Key Convergence Metrics

Metric Good Value Concern
Rhat < 1.01 > 1.1 indicates non-convergence
ESS bulk > 400 < 100 unreliable estimates
ESS tail > 400 < 100 unreliable intervals
Divergences 0 Any indicates geometry issues
Max treedepth 0 hits Hitting limit = slow exploration

Stan Diagnostics (cmdstanr)

library(cmdstanr)

fit <- mod$sample(data = stan_data, ...)

# Quick check
fit$cmdstan_diagnose()

# Summary with diagnostics
fit$summary()

# Detailed diagnostics
fit$diagnostic_summary()

# Extract specific metrics
draws <- fit$draws()
rhat <- posterior::rhat(draws)
ess_bulk <- posterior::ess_bulk(draws)
ess_tail <- posterior::ess_tail(draws)

# Divergences
np <- fit$sampler_diagnostics()
sum(np[,,"divergent__"])

# Treedepth
sum(np[,,"treedepth__"] == 10)  # Default max

JAGS Diagnostics (R2jags)

library(R2jags)
library(coda)

fit <- jags(...)

# Summary (includes Rhat, n.eff)
print(fit)
fit$BUGSoutput$summary

# Rhat
max(fit$BUGSoutput$summary[,"Rhat"])

# Effective sample size
min(fit$BUGSoutput$summary[,"n.eff"])

# Convert to coda
mcmc_obj <- as.mcmc(fit)

# Gelman-Rubin
gelman.diag(mcmc_obj)

# Autocorrelation
autocorr.diag(mcmc_obj)
autocorr.plot(mcmc_obj)

# Geweke diagnostic
geweke.diag(mcmc_obj)

Visual Diagnostics

Trace Plots

# Stan (bayesplot)
library(bayesplot)
mcmc_trace(fit$draws(), pars = c("mu", "sigma"))

# JAGS
traceplot(fit)

Rank Histograms

# Should be uniform if chains mixed well
mcmc_rank_hist(fit$draws(), pars = "mu")

Pairs Plot (Detect Correlations)

mcmc_pairs(fit$draws(), pars = c("mu", "sigma", "tau"))

Divergence Diagnosis (Stan)

# Identify divergent transitions
np <- nuts_params(fit)
divergent <- np[np$Parameter == "divergent__" & np$Value == 1, ]

# Pairs plot highlighting divergences
mcmc_pairs(fit$draws(), np = np,
           pars = c("mu", "tau"),
           off_diag_args = list(size = 0.5))

# Common fixes:
# 1. Increase adapt_delta
fit <- mod$sample(data = stan_data, adapt_delta = 0.95)

# 2. Use non-centered parameterization
# 3. Reparameterize (use Cholesky for covariances)

Read the full file on GitHub · 237 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 237 lines · 26 tokens per session scan A b132ef2f6da2

Subscribe to this mod's changes

model-diagnostics is a skill published in the GitHub repository choxos/BiostatAgent (11 stars, last pushed 3mo ago), licensed MIT. It adds 26 tokens to every session and 1,644 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

clinical-trials-search

Search ClinicalTrials.gov with natural language queries. Find clinical trials, enrollment, and outcomes using Valyu semantic search.

beita6969/ScienceClaw · 28 tokens

lifesciences-clinical

Queries clinical databases (Open Targets, ClinicalTrials.gov) via curl for target-disease associations, target tractability assessment, and clinical trial discovery. This skill should be used when the user asks to "validate drug targets", "find clinical trials", "assess target tractability", "discover disease…

donbr/lifesciences-research · 94 tokens

lifesciences-genomics

Queries genomic databases (Ensembl, NCBI, HGNC) via curl for gene lookup, variant annotation, orthology, and cross-database ID resolution. This skill should be used when the user asks to "annotate variants", "find orthologs", "map gene IDs", "analyze linkage disequilibrium", or mentions gene symbols, ENSG IDs, HGNC…

donbr/lifesciences-research · 101 tokens

clinical-trials-search

Search ClinicalTrials.gov with natural language queries. Find clinical trials, enrollment, and outcomes using Valyu semantic search.

vitaclaw/vitaclaw · 28 tokens

pipeline-tracker

Global drug development pipeline tracking by disease, target, mechanism, or company. Use for competitive intelligence, opportunity identification, and trend analysis. Keywords: pipeline, drug development, clinical trials, R&D tracking, competitive landscape.

huifer/drug-discovery-skills · 48 tokens

clinical-trials-search

Search ClinicalTrials.gov with natural language queries. Find clinical trials, enrollment, and outcomes using Valyu semantic search.

Zaoqu-Liu/ScienceClaw · 28 tokens