Iván

NumPy

開発v1.0.0
作者:Iván更新日 2026-05-11numpy@clawhub_ivangdavila/numpy
コード生成スクリプトツール

AlphaMoatによると、2026-09時点でNumPyのダウンロード数は1,657、スター数は0で、AIスキル全体5,078件中4,669位、開発では577件中549位です。

インストール数
113
ダウンロード数
1657
スター数
-
総合順位
#4,669
全体の上位 92% · 開発の上位 96%
プラットフォームインストール数ダウンロード数スター数コメント
ClawHub ↗401473--
SkillHub ↗1131657-—

プラットフォームごとに集計方法と集計時点が異なります。

このスキルでできること

配列の形状とデータ型、軸、組み込み数学関数、ビューとコピー、データ操作、行列演算を扱います。計算はローカルで行われると説明されていますが、設定やコード例を保存する場合があります。明示的な同意後に必要最小限の情報だけを保存し、ローカル記録を確認・削除できるようにしてください。 共有のメインメモリにも保存する提案があるため、保存前に明示的な同意が必要です。

資料公開日 2026-10-29

できること

  • 要素ごとの処理を配列演算に置き換える
  • ブロードキャスト、軸、データ型の挙動を理解する
  • 統計や線形代数に組み込み関数を使う

使う場面

  • Pythonで配列計算や数値計算を行うとき
  • ブロードキャスト、ビューとコピー、データ型の挙動を確認するとき

プロンプト例

スキルのドキュメントをもとに生成した例であり、実際の実行結果ではありません。

NumPyで配列に要素ごとの演算を行う方法を説明してください。設定やコード例は保存しないでください。
この配列コードの形状、ブロードキャスト、ビューとコピーの挙動を確認し、分析だけを行ってファイルは編集しないでください。

月次の推移

ダウンロード数1657
511112717422026-03 · ダウンロード数 5962026-05 · ダウンロード数 9502026-06 · ダウンロード数 10812026-07 · ダウンロード数 12822026-08 · ダウンロード数 13932026-09 · ダウンロード数 165726-0326-09
スター数-
0112026-03 · スター数 -2026-05 · スター数 -2026-06 · スター数 -2026-07 · スター数 -2026-08 · スター数 -2026-09 · スター数 -26-0326-09

2026-09 から集計方法を変更し、同名スキルを作者ごとに分けて集計し、全スキルを対象にしました。破線は変更前の月で、変更後のデータとは直接比較せず、変更をまたぐ増減も計算していません。

月ダウンロード数前月比スター数
2026-091657—-
2026-081393+8.7%-
2026-071282+18.6%-
2026-061081+13.8%-
2026-05950—-
2026-03596—-

SKILL.md 原文

作者が公開した元のファイルをテキストのまま表示しています。AlphaMoat による編集や審査はしていません。リンクはクリックできません。コマンドは内容を確認してから実行してください。取得日 2026-10-23。

5.8 KB・ClawHub v1.0.0
---
name: NumPy
slug: numpy
version: 1.0.0
homepage: https://clawic.com/skills/numpy
description: Write fast, memory-efficient numerical code with arrays, broadcasting, vectorization, and linear algebra.
metadata: {"clawdbot":{"emoji":"🔢","requires":{"bins":["python3"]},"os":["linux","darwin","win32"]}}
---

## Setup
すべて表示(全 233 行)

On first use, read `setup.md` for integration guidelines. Creates `~/numpy/` to store preferences and snippets.

## When to Use

User needs numerical computing in Python. Agent handles array operations, mathematical computations, linear algebra, and data manipulation with NumPy.

## Architecture

Memory lives in `~/numpy/`. See `memory-template.md` for structure.

```
~/numpy/
├── memory.md      # Preferences + common patterns used
└── snippets/      # User's saved code patterns
```

## Quick Reference

| Topic | File |
|-------|------|
| Setup process | `setup.md` |
| Memory template | `memory-template.md` |

## Core Rules

### 1. Vectorize First
Never use Python loops for array operations. NumPy's vectorized operations are 10-100x faster.

```python
# BAD - Python loop
result = []
for x in arr:
    result.append(x * 2)

# GOOD - Vectorized
result = arr * 2
```

### 2. Understand Broadcasting
Broadcasting allows operations on arrays of different shapes. Know the rules:
- Dimensions align from the right
- Size-1 dimensions stretch to match
- Missing dimensions treated as size-1

```python
# Shape (3,1) + (4,) broadcasts to (3,4)
a = np.array([[1], [2], [3]])  # (3,1)
b = np.array([10, 20, 30, 40])  # (4,)
result = a + b  # (3,4)
```

### 3. Prefer Views Over Copies
Slicing returns views (same memory). Use `.copy()` only when needed.

```python
# View - modifying b changes a
b = a[::2]

# Copy - independent
b = a[::2].copy()
```

### 4. Use Appropriate Dtypes
Choose the smallest dtype that fits your data. Saves memory and speeds up computation.

```python
# For integers 0-255
arr = np.array(data, dtype=np.uint8)

# For floats that don't need double precision
arr = np.array(data, dtype=np.float32)
```

### 5. Axis Awareness
Most functions accept `axis` parameter. Know your axes:
- `axis=0`: operate along rows (down columns)
- `axis=1`: operate along columns (across rows)
- `axis=None` or omit: operate on flattened array

```python
arr = np.array([[1, 2], [3, 4]])
np.sum(arr, axis=0)  # [4, 6] - sum each column
np.sum(arr, axis=1)  # [3, 7] - sum each row
```

### 6. Leverage Built-in Functions
NumPy has optimized functions for common operations. Don't reinvent them.

| Need | Use |
|------|-----|
| Element-wise math | `np.sin`, `np.exp`, `np.log` |
| Statistics | `np.mean`, `np.std`, `np.median` |
| Linear algebra | `np.dot`, `np.linalg.*` |
| Sorting | `np.sort`, `np.argsort` |
| Searching | `np.where`, `np.searchsorted` |

## NumPy Traps

### Shape Mismatches
```python
# TRAP: Confusing (n,) with (n,1) or (1,n)
a = np.array([1, 2, 3])      # shape (3,)
b = np.array([[1, 2, 3]])    # shape (1,3)
c = np.array([[1], [2], [3]])  # shape (3,1)

# FIX: Use reshape or newaxis
a.reshape(-1, 1)  # (3,1)
a[np.newaxis, :]  # (1,3)
```

### Silent Type Coercion
```python
# TRAP: Integer array silently truncates floats
arr = np.array([1, 2, 3])  # int64
arr[0] = 1.9  # becomes 1, not 1.9!

# FIX: Declare dtype upfront
arr = np.array([1, 2, 3], dtype=np.float64)
```

### View vs Copy Confusion
```python
# TRAP: Fancy indexing returns copy, slicing returns view
arr = np.array([1, 2, 3, 4, 5])

# This is a VIEW (changes affect original)
view = arr[1:4]

# This is a COPY (independent)
copy = arr[[1, 2, 3]]
```

### Broadcasting Surprises
```python
# TRAP: Unexpected broadcasting
a = np.array([1, 2, 3])
b = np.array([1, 2])
a + b  # ERROR - shapes don't broadcast

# TRAP: Accidental broadcasting
a = np.zeros((3, 4))
b = np.array([1, 2, 3])
a + b  # ERROR - (3,4) and (3,) don't align
a + b.reshape(-1, 1)  # Works - (3,4) and (3,1)
```

### In-Place Operations
```python
# TRAP: Some operations modify in-place, others don't
np.sort(arr)        # Returns sorted copy
arr.sort()          # Sorts in-place

# Safe pattern: be explicit
arr = np.sort(arr)  # Clear intent
```

## Essential Patterns

### Create Arrays
```python
np.zeros((3, 4))           # All zeros
np.ones((3, 4))            # All ones
np.full((3, 4), 7)         # All sevens
np.eye(3)                  # Identity matrix
np.arange(0, 10, 2)        # [0, 2, 4, 6, 8]
np.linspace(0, 1, 5)       # [0, 0.25, 0.5, 0.75, 1]
np.random.rand(3, 4)       # Uniform [0,1)
np.random.randn(3, 4)      # Normal distribution
```

### Reshape and Stack
```python
arr.reshape(2, 6)          # New shape (must match size)
arr.flatten()              # 1D copy
arr.ravel()                # 1D view
np.concatenate([a, b])     # Join along existing axis
np.stack([a, b])           # Join along new axis
np.vstack([a, b])          # Stack vertically
np.hstack([a, b])          # Stack horizontally
```

### Boolean Indexing
```python
arr = np.array([1, 5, 3, 8, 2])
mask = arr > 3
arr[mask]                  # [5, 8]
arr[arr > 3] = 0           # Replace values > 3 with 0
np.where(arr > 3, 1, 0)    # 1 where >3, else 0
```

### Linear Algebra
```python
np.dot(a, b)               # Matrix multiplication
a @ b                      # Same (Python 3.5+)
np.linalg.inv(a)           # Inverse
np.linalg.det(a)           # Determinant
np.linalg.eig(a)           # Eigenvalues/vectors
np.linalg.solve(a, b)      # Solve Ax = b
```

## Security & Privacy

**Data that stays local:**
- All computations run locally
- Code patterns saved in ~/numpy/

**This skill does NOT:**
- Send data externally
- Access files outside ~/numpy/
- Require network connectivity

## Related Skills
Install with `clawhub install <slug>` if user confirms:
- `data` — data processing workflows
- `math` — mathematical computations
- `statistics` — statistical analysis

## Feedback

- If useful: `clawhub star numpy`
- Stay updated: `clawhub sync`

開発の人気スキル

Ivánのその他のスキル

データ月:2026-09 · ダウンロード数、スター数、インストール数は公開スキルレジストリ(ClawHub、SkillHub)から月単位で集計しています。詳しくはデータの方法論をご覧ください。