numpy
Skill15 starsChanged 42 days agoMITView on GitHub
Expert NumPy numerical computing assistance covering ndarrays, broadcasting, linear algebra, vectorization, and memory views. Use when writing ultra-fast scientific calculations and array operations in Python.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- kandada/aacodetheir own version, first seen Jul 22, 2026
- microsoft/debugpytheir own version, first seen Apr 3, 2026
- tondevrel/scientific-agent-skillstheir own version, first seen Feb 1, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- microsoft/debugpy★ 2.5ksame name
- kandada/aacode★ 134same name
- tondevrel/scientific-agent-skills★ 22same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository350 other files it gives its agents.
- airflowSkill
- catboostSkill
- claudeSkill
- comfyuiSkill
- cursor-aiSkill
- dalleSkill
- daskSkill
- dbtSkill
- deepseekSkill
- fastaiSkill
- geminiSkill
- github-copilotSkill
- huggingfaceSkill
- jaxSkill
- jupyterSkill
- kerasSkill
- langchainSkill
- lightgbmSkill
- llamaindexSkill
- llamaSkill
- matplotlibSkill
- midjourneySkill
- mistralSkill
- mlflowSkill
- nltkSkill
- ollamaSkill
- openai-gptSkill
- opencvSkill
- pandasSkill
- perplexitySkill
- plotlySkill
- polarsSkill
- pytorchSkill
- raySkill
- scikit-learnSkill
- seabornSkill
- spacySkill
- sparkSkill
- stable-diffusionSkill
- tensorflowSkill
- vaexSkill
- weights-biasesSkill
- whisperSkill
- xgboostSkill
- api-gatewaySkill
- clean-architectureSkill
- cqrsSkill
- domain-driven-designSkill
- event-drivenSkill
- event-sourcingSkill
- graphqlSkill
- grpcSkill
- hexagonalSkill
- microservicesSkill
- modular-monolithSkill
- monolithSkill
- rest-apiSkill
- sagaSkill
- serverlessSkill
- service-meshSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 122
Check arr.flags['C_CONTIGUOUS'] before passing arrays to C/C++/Cython extensions.
- Very specific: line 126
Use np.matrix; it is deprecated—use standard 2D np.ndarray and the @ matrix multiplication operator.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
NumPy
NumPy is the foundational library for scientific computing in Python, providing multidimensional array objects, vectorized mathematical operations, and unified C/C++ API bindings.
When to Use
- High-Performance Numerical Computation: Vectorized array arithmetic and multi-dimensional tensor manipulation.
- Scientific Computing & Linear Algebra: Matrix decompositions (SVD, QR, Cholesky), eigenvalues, and inversions via
np.linalg. - Foundational Data Layer for AI/ML: Serving as the memory buffer standard for PyTorch, TensorFlow, OpenCV, and Scikit-learn.
- NumPy 2.0+ Modern Standard: Utilizing improved typing, standardized C-API, and optimized array constructors.
Quick Start
import numpy as np
# Vectorized matrix operations with broadcasting
a = np.array([[1, 2, 3], [4, 5, 6]], dtype=np.float64)
b = np.array([10, 20, 30])
# Broadcast addition across rows
c = a + b
print("Result shape:", c.shape)
print("Row-wise sum:", np.sum(c, axis=1))Core Concepts
Vectorization, Broadcasting & Masking
Eliminating slow Python loops through vector operations:
import numpy as np
# Fast random number generation with modern Generator API
rng = np.random.default_rng(seed=42)
# Generate 2D array of sensor readings
readings = rng.normal(loc=25.0, scale=3.0, size=(1000, 5))
# Broadcasting: subtract sensor baseline offsets (shape (5,)) from matrix (1000, 5)
baselines = np.array([24.0, 25.0, 24.5, 25.5, 26.0])
calibrated = readings - baselines
# Boolean masking: identify readings exceeding alert threshold
anomaly_mask = np.abs(calibrated) > 6.0
anomaly_count = np.count_nonzero(anomaly_mask)
print(f"Total readings: {readings.size}, Anomalies detected: {anomaly_count}")Linear Algebra & Matrix Decomposition with np.linalg
Solving linear equations and singular value decomposition:
# System of equations: Ax = b
A = np.array([[3.0, 1.0], [1.0, 2.0]])
b = np.array([9.0, 8.0])
# Solve for x: [x0, x1]
x = np.linalg.solve(A, b)
print("Solution x:", x)
# Singular Value Decomposition (SVD)
U, S, Vt = np.linalg.svd(A)
print("Singular values:", S)Memory Layouts: Views vs. Copies
Understanding strides and C-contiguous memory:
arr = np.arange(12, dtype=np.int32).reshape((3, 4))
print("C-Contiguous:", arr.flags['C_CONTIGUOUS'])
# Slice creates a view (shared memory buffer)
sub_view = arr[:2, :2]
sub_view[0, 0] = 999
print("Original modified via view:", arr[0, 0] == 999) # True
# Explicit copy allocates independent memory
safe_copy = arr[:2, :2].copy()
safe_copy[0, 0] = 0
print("Original unchanged by copy:", arr[0, 0] == 999) # TrueCommon Patterns
Efficient Memory Views and Strided Slicing
Problem: Unnecessary memory duplication when working with sub-arrays of large numerical datasets.
Solution: Leverage NumPy non-copying array views and boolean indexing:
data = np.arange(1_000_000)
# Creates a view, not a memory copy
view = data[::2]
print(view.base is data) # True - shares identical memory buffer
# Fast boolean masking without Python loops
positive_values = data[data > 500_000]Best Practices
Do:
- Target NumPy 2.0+ conventions and use
np.random.default_rng()instead of legacynp.random.seed(). - Utilize vectorization and boolean array indexing instead of iterating with
forloops in Python. - Specify appropriate
dtype(e.g.np.float32vsnp.float64) to minimize memory footprint in deep learning pipelines. - Check
arr.flags['C_CONTIGUOUS']before passing arrays to C/C++/Cython extensions.
Don't:
- Use
np.matrix; it is deprecated—use standard 2Dnp.ndarrayand the@matrix multiplication operator. - Mutate sliced arrays without knowing whether they are views or independent copies.
- Append elements to arrays in loops with
np.append(); allocate pre-sized arrays withnp.empty()ornp.zeros().
Troubleshooting
| Error | Cause | Solution |
ValueError: operands could not be broadcast together with shapes | Incompatible array dimensions along non-singleton axes. | Align shapes using np.newaxis or .reshape(-1, 1). |
MemoryError: Unable to allocate array with shape | Array size exceeds available system RAM in standard precision. | Use lower precision dtype (e.g. np.float32 or np.int16) or use memmap. |
IndexError: too many indices for array | Accessing 2D index on 1D array. | Check array dimensions with arr.ndim and arr.shape. |
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

