Build, differentiate, compile, and debug PyTensor symbolic computations for models. Handles shape/dtype errors, indexing, broadcasting, vectorization, scan, RNG state, graph profiling, and custom Ops.
Ships in pymc-agent-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.
Read when SKILL.md points to them; scripts run unread.
Express the intended calculation, then verify its values, shapes, derivatives, and state transitions.
Read only the references needed for the calculation. This skill is independently installable; no other skill, host adapter, or service is required. If the graph belongs to a probabilistic model, numerical correctness does not replace its formulation, prior checks, inference diagnostics, or predictive criticism.
This float64 vector example compiles a squared norm and its gradient, checks both against independent references, and exercises the rank contract.
import numpy as np
import pytensor
import pytensor.tensor as pt
from pytensor.gradient import grad
x = pt.vector("x", dtype="float64")
energy = pt.sqr(x).sum()
evaluate = pytensor.function([x], [energy, grad(energy, x)])
values = np.array([1.0, -2.0, 3.0], dtype="float64")
value, derivative = evaluate(values)
np.testing.assert_allclose(value, np.square(values).sum(), rtol=1e-12)
np.testing.assert_allclose(derivative, 2 * values, rtol=1e-12)
print("Squared norm:", float(value)) # 14.0
print("Gradient:", derivative) # [ 2. -4. 6.]
try:
evaluate(values.reshape(1, -1))
except TypeError as error:
print("Rank-two input rejected:", error)
else:
raise AssertionError("A vector input accepted a rank-two array")
Prefer built-in operations for ordinary models. The reusable
BinomialLogpOp illustrates a pointwise likelihood
with explicit shape, support, and derivative contracts; it requires PyTensor,
NumPy, and SciPy. Keep the modules in this skill's scripts/ directory together
on the Python import path when using an example.
Import only the lowering needed before compiling for that backend:
These dependencies are optional and needed only for the corresponding examples. Importing the base Op does not register optional lowerings. Check values, derivatives, state, and unsupported inputs on the actual backend before using an extension in a model; a working forward calculation does not establish support for every shape-only, derivative, or accelerator graph.
LICENSE (opens in a new tab)references/compilation.md (opens in a new tab)references/custom-backends.md (opens in a new tab)references/custom-ops.md (opens in a new tab)references/numerics.md (opens in a new tab)references/random.md (opens in a new tab)references/shapes.md (opens in a new tab)scripts/binomial_logp_jax.py (opens in a new tab)scripts/binomial_logp_mlx.py (opens in a new tab)scripts/binomial_logp_numba.py (opens in a new tab)scripts/binomial_logp_op.py (opens in a new tab)scripts/binomial_logp_pytorch.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/pymc-agent-skills:pytensor-workflowsfrom pymc-agent-skills
npx claudepluginhub pymc-devs/pymc-agent-skills --plugin pymc-agent-skills4 skills in this plugin
/arviz-diagnosticsDiagnose existing Bayesian inference output and evaluate fitted predictions with modern ArviZ DataTree summaries, divergences, rank R-hat, ESS and Monte Carlo precision. Use for posterior predictive checks, calibration, LOO/ELPD, Pareto k, stacking, grouped or temporal validation, survival diagnostics and Bayes-factor interpretation./prior-elicitationElicit and check Bayesian prior assumptions in meaningful units. Use for expert quantiles, PreliZ, constrained priors, prior-predictive plausibility and prior sensitivity, including power scaling, regularized horseshoe and R2D2 assumptions./pymc-modelingBuild, revise, and debug Bayesian models with PyMC. Use when choosing likelihoods and priors, specifying model/data dimensions, fitting hierarchical models, GPs, time series, mixtures, BART or splines, selecting inference methods, resolving failed initial evaluation or model/data shape errors, generating predictions, or testing model code with simulated data and simulation-based calibration (SBC). Covers PyMC 6+, PyTensor 3+ and ArviZ 1.0 DataTree workflows.3 plugins in 2 repositories ship this exact skill · first indexed Sep 13, 2026
Other plugins' skills for the same job