Skip to main content
skill CX Codex

machine-learning — Claude Code skill for JAX and functional ML code

A skill that steers your agent toward JAX idioms: pure functions, JIT, and correct PRNG key handling.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Mindrally/skills --skill machine-learning -a claude-code
Open on GitHub

What machine-learning does

This skill sets the ground rules for machine learning work in JAX. It tells the agent to keep functions pure, avoid side effects, and write code that JIT can actually compile. Handy when you are building a training loop and do not want PyTorch habits leaking into the output.

The rules cover the JAX basics. Arrays go through jax.numpy, gradients through jax.grad, compilation through jax.jit, batching through jax.vmap. Control flow should use jax.lax.scan, jax.lax.cond and jax.lax.fori_loop; Python branching inside a jitted function is called out as something to avoid. Random numbers get their own section: split keys, never reuse one, or reproducibility breaks.

Memory and speed have their own blocks — dtype choices, batching, checkpointing for large models, profiling hot paths. Neural network layers are expected to come from Flax or Haiku, with models defined as pure functions. Keep in mind this is instruction text for the agent only; JAX itself and your layer library still need to be installed in the project.

What it helps with

  • write JAX training code without side effects
  • swap Python loops for jax.lax.scan and fori_loop
  • split PRNG keys so runs stay reproducible
  • cut memory use with checkpointing and dtype choices
  • define network layers with Flax or Haiku

Example prompts for the agent

  • rewrite this training loop in JAX using pure functions
  • check this jitted function for Python branching and replace it with jax.lax.cond
  • split the PRNG keys so batching and dropout do not share one

How to install machine-learning

1Skills CLI (Vercel)

npx skills add Mindrally/skills --skill machine-learning -a claude-code

2Manually: put the files in place

~/.claude/skills/machine-learning/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/machine-learning/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about machine-learning

How do I install machine-learning in Claude?

Run npx skills add Mindrally/skills --skill machine-learning -a claude-code. The skill lands in ~/.claude/skills/machine-learning/SKILL.md.

What does the machine-learning skill do?

It gives the agent JAX development rules: functional style, JIT, automatic differentiation, vectorization, and PRNG key splitting.

Which platforms support it?

Besides Claude, it installs into Codex, Cursor, GitHub Copilot, Gemini CLI and OpenCode.

Source text

SKILL.md · Apache-2.0
---
name: machine-learning
description: Machine learning development with JAX, functional programming patterns, and high-performance computing.
metadata:
  maintainer: Mindrally
  source: https://github.com/Mindrally/skills
---

# Machine Learning

You are an expert in machine learning development with JAX and functional programming patterns.

## Core Principles

- Follow functional programming patterns
- Use immutability and pure functions
- Leverage JAX transformations effectively
- Optimize for JIT compilation

## JAX Fundamentals

### Array Operations
- Use `jax.numpy` for NumPy-compatible operations
- Leverage automatic differentiation with `jax.grad`
- Apply JIT compilation with `jax.jit`
- Vectorize with `jax.vmap`

### Control Flow
- Use `jax.lax.scan` for sequential operations
- Apply `jax.lax.cond` for conditionals
- Implement loops with `jax.lax.fori_loop`
- Avoid Python control flow in jitted functions

### Random Numbers
- Use JAX's functional random API
- Split keys properly for reproducibility
- Never reuse random keys

## Best Practices

### Performance
- Write pure functions without side effects
- Use JAX arrays instead of NumPy where possible
- Leverage random key splitting properly
- Profile and optimize hot paths
- Minimize Python overhead in hot loops

### Memory Management
- Use appropriate dtypes for memory efficiency
- Batch operations when possible
- Implement checkpointing for large models
- Profile with JAX profiler

## Common Patterns

- Use pytrees for nested data structures
- Implement custom vjp/jvp when needed
- Leverage sharding for multi-device training
- Use checkpointing for memory efficiency

## Model Development

- Define models as pure functions
- Use Flax or Haiku for neural network layers
- Implement proper initialization strategies
- Structure training loops functionally

© Mindrally · Apache-2.0 · Mindrally/skills

Similar skills

Everything for AI and ML →

From the same set214

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor