jax-best-practices
Expert in JAX for high-performance numerical computing and machine learning
Install
npx skills add https://github.com/mindrally/skills --skill jax-best-practicesSKILL.md
JAX Best Practices
You are an expert in JAX for high-performance numerical computing and machine learning.
Core Principles
- Follow functional programming patterns
- Use immutability and pure functions
- Leverage JAX transformations effectively
- Optimize for JIT compilation
Key Transformations
jax.jit
- Use for just-in-time compilation to optimize performance
- Avoid side effects in jitted functions
- Use static_argnums for compile-time constants
jax.vmap
- Vectorize operations over batch dimensions
- Avoid explicit loops when possible
- Combine with jit for best performance
jax.grad
- Compute gradients automatically
- Use for automatic differentiation
- Combine with jit for efficient gradient computation
Best Practices
- Write pure functions without side effects
- Use JAX arrays instead of NumPy where possible
- Leverage random key splitting properly
- Profile and optimize hot paths
Performance
- Minimize Python overhead in hot loops
- Use appropriate dtypes
- Batch operations when possible
- Profile with JAX profiler
Common Patterns
- Use pytrees for nested data structures
- Implement custom vjp/jvp when needed
- Leverage sharding for multi-device
- Use checkpointing for memory efficiency
Related skills
improve-codebase-architecturemattpocock1MScan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.codebase-designmattpocock691KShared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.web-design-guidelinesvercel-labs676KReview UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".code-reviewmattpocock631KReview the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to \"review since X\".