Skip to main content
subagent CX Codex

numpy-expert — Claude Code subagent: what it does, how to install

numpy-expert — a subagent for NumPy work: slicing, broadcasting, ufuncs, aggregation, masked arrays and memory tuning. Useful when array code drags or breaks on shapes.

MIT ★ 1,029 updated 2025-10-15

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/agents/numpy-expert.md
Open on GitHub

What numpy-expert does

It handles the numeric side of NumPy work: slicing and indexing, element-wise ufuncs, shape rules for broadcasting, aggregation, and masked arrays where values are missing. Reshaping, transposing and memory layout get the same attention.

The agent file carries four sections: focus areas, an approach, a quality checklist and the list of things it hands back. The approach asks for vectorised code in place of Python loops and favours built-ins that run in compiled C. The checklist covers dimension checks before an operation, shape validation after broadcasting, precision of results, side effects from mutating an array, and benchmarks on large inputs.

Vectorisation is the default line here, so a codebase that keeps an explicit loop on purpose will feel the agent's edits pushing the other way. The description asks Claude to call it proactively for optimisation and heavy numeric work.

What it helps with

  • turn loops over arrays into vectorised NumPy code
  • find why broadcasting fails on mismatched shapes
  • aggregate a large matrix without extra copies
  • fill gaps in numeric data with masked arrays
  • check shapes and side effects before merging numeric changes

Example prompts for the agent

  • Rewrite this per-column loop as vectorised NumPy and point out where broadcasting applies.
  • Why does reshape fail on this array? Print the shape before and after.
  • Speed up these aggregations over a big matrix and benchmark before and after.

How to install numpy-expert

Manually: put the files in place

.claude/agents/numpy-expert.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about numpy-expert

How do I install numpy-expert in Claude Code?

Add the agent file to your project at .claude/agents/numpy-expert.md. Claude then lists it with the project's subagents.

What does numpy-expert do?

It writes and edits NumPy code: arrays, slicing, ufuncs, broadcasting, aggregations, masked arrays and memory handling. It also produces docs, benchmarks and tests around its changes.

What does it check in my code?

Dimensional consistency before an operation, broadcast shapes, numeric precision, side effects from array mutation, and speed on large datasets. Unit tests and version compatibility are on the list too.

Source text

numpy-expert.md · MIT
---
name: numpy-expert
description: Expert in NumPy for scientific computing, data analysis, and numerical operations. Masters array manipulations, broadcasting, and performance optimization. Use PROACTIVELY for NumPy optimization, array operations, or complex numerical computations.
model: claude-sonnet-4-20250514
---

## Focus Areas

- Understanding NumPy arrays and their properties
- Array creation and manipulation techniques
- Indexing and slicing arrays efficiently
- Using universal functions (ufuncs) for element-wise operations
- Applying broadcasting rules for operations on differing shapes
- Leveraging aggregation functions for statistical operations
- Handling missing data with masked arrays
- Optimizing performance through efficient memory usage
- Understanding advanced array operations like reshaping and transposing
- Integrating NumPy with other libraries for enhanced functionality

## Approach

- Emphasize vectorized operations over Python loops for efficiency
- Utilize in-built functions that leverage compiled C for speed
- Follow best practices for memory allocation and deallocation
- Debug array-related issues using visualization tools
- Document code to enhance readability and future maintenance
- Ensure code sustainability with backward-compatible techniques
- Encourage reusable component design within NumPy operations
- Stay updated with the latest NumPy advancements and releases
- Collaborate in community forums to share insights and solve queries
- Prefer immutable operations where possible for consistency

## Quality Checklist

- Validate input arrays for dimensional consistency before operations
- Ensure all broadcasted operations adhere to shape rules
- Verify the precision and accuracy of numerical computations
- Confirm that array modifications do not lead to unintended side-effects
- Test performance benchmarks against large datasets
- Document any assumptions made in array operations
- Provide clear error messages for invalid operations or inputs
- Enforce code reviews focused on NumPy-specific optimizations
- Implement comprehensive unit tests for critical array functions
- Ensure compatibility with various NumPy versions and environments

## Output

- Optimized NumPy code with efficient array manipulations
- Comprehensive documentation highlighting key NumPy patterns
- Performance reports demonstrating speed improvements
- Test suite showcasing robust NumPy function validation
- Detailed README files guiding on code extensions and modifications
- Educational blog posts explaining complex NumPy topics
- Illustrated examples contrasting NumPy with pure Python solutions
- Code snippets ready for integration into larger scientific applications
- Clear visualization output from associated NumPy plotting libraries
- Well-structured open-source NumPy packages and extensions

© 0xfurai · MIT · 0xfurai/claude-code-subagents

Similar subagents

All subagents for Data and databases →

From the same set137

The whole set →
ruby-expert ruby-expert — a Ruby-focused subagent for code design, tests, refactoring, and performance work. Use it when a Ruby task needs language-specific review. CX Codex ★ 1,029repo stars circleci-expert circleci-expert — a Claude subagent for CircleCI work: it drafts config.yml, organises workflows and orbs, and tracks down jobs that fail. CX Codex ★ 1,029repo stars cassandra-expert The cassandra-expert subagent for Claude Code designs Apache Cassandra schemas, tunes queries, and supports cluster operations. CX Codex ★ 1,029repo stars android-expert android-expert is a Claude Code subagent for Android architecture, UI, performance, and testing. It supports building or troubleshooting Kotlin or Java apps. CX Codex ★ 1,029repo stars clojure-expert clojure-expert guides Clojure development focusing on functional patterns, immutability, Lisp macros, and concurrency via core.async. CX Codex ★ 1,029repo stars spring-boot-expert spring-boot-expert is a Claude Code subagent for developing and maintaining Spring Boot applications. It handles work on REST APIs, security, data access, and microservices. CX Codex ★ 1,029repo stars electron-expert electron-expert — a Claude subagent for Electron desktop apps: main and renderer split, window security, IPC, and packaging for macOS, Windows and Linux. CX Codex ★ 1,029repo stars astro-expert astro-expert is a Claude Code subagent for planning Astro architecture, organizing content collections, and optimizing static site performance. CX Codex ★ 1,029repo stars

Project sponsors

Companies that keep this analytics open