add-handler

Add precise primitive handlers to the JAX Jaxpr interpreter.

40|5|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/adrhill/asdex --skill add-handler-adrhill
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-handler
Source: https://github.com/adrhill/asdex/tree/main/.claude/skills/add-handler
Command: npx skills add https://github.com/adrhill/asdex --skill add-handler-adrhill

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and scripts (resource) components.

What problem does it solve?

This Skill streamlines the JAX Jaxpr interpreter by adding precise, primitive-specific handlers, replacing less efficient, conservative fallbacks for improved performance and accuracy.

Core Features & Use Cases

  • Primitive Handler Implementation: Develops custom handlers for JAX primitives to accurately map input/output indices and Jacobian structures.
  • Interpreter Optimization: Replaces generic fallback logic with specialized code for specific JAX operations.
  • Use Case: When JAX encounters an unsupported primitive during Jaxpr interpretation, this Skill allows for the creation of a new, efficient handler, ensuring sparse Jacobians are computed correctly instead of relying on a dense, slower fallback.

Quick Start

Use the add-handler skill to add a precise primitive handler for the 'reshape' primitive.

Frequently Asked Questions about add-handler

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a primitive handler to the JAX Jaxpr interpreter?

To add a primitive handler to the JAX Jaxpr interpreter, you implement custom logic for specific JAX primitives that accurately maps input and output indices. This replaces conservative fallbacks with specialized code.

Why does JAX use a dense fallback for unsupported primitives during Jaxpr interpretation?

JAX uses a dense fallback for unsupported primitives during Jaxpr interpretation to ensure computation completes safely. This conservative approach prevents errors but sacrifices performance and sparse Jacobian accuracy.

How can I compute sparse Jacobians correctly when JAX encounters unsupported primitives?

You can compute sparse Jacobians correctly by developing precise primitive handlers for the JAX Jaxpr interpreter. This custom logic maps Jacobian structures accurately, replacing the slower dense fallback logic.

Do I need to understand JAX internals to implement custom primitive handlers?

Yes, implementing custom primitive handlers requires an advanced understanding of JAX internals, Jaxpr, and Python programming. You need this knowledge to develop and test handler logic for specific JAX operations.

What is the best way to optimize JAX interpreter performance for specific operations?

The best way to optimize JAX interpreter performance is replacing generic fallback logic with precise primitive-specific handlers. This specialized code for specific JAX operations improves both computation speed and accuracy.

When should I replace conservative fallback logic in the JAX Jaxpr interpreter?

You should replace conservative fallback logic in the JAX Jaxpr interpreter when JAX encounters an unsupported primitive and you need efficient computation. This ensures sparse Jacobians are computed correctly without relying on dense fallbacks.