Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/hajibabaie/combinatorial-optimization-skills/numpy-vectorization-for-optimizationnpx skills add hajibabaie/combinatorial-optimization-skills --skill numpy-vectorization-for-optimizationgit clone --depth 1 https://github.com/hajibabaie/combinatorial-optimization-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/hajibabaie/combinatorial-optimization-skills/numpy-vectorization-for-optimization)<a href="https://agentmods.dev/skills/hajibabaie/combinatorial-optimization-skills/numpy-vectorization-for-optimization"><img src="https://agentmods.dev/badge/skills/hajibabaie/combinatorial-optimization-skills/numpy-vectorization-for-optimization.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00125 | $0.10543 |
| Opus 5 | $0.00063 | $0.05271 |
| Sonnet 5 | $0.00025 | $0.02109 |
| Haiku 4.5 | $0.00013 | $0.01054 |
Grade B, and why
numpy-vectorization-for-optimization scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Strips warnings and disclaimersmediumAnti-refusal
Omitting safety caveats hides risk from the user and is a common jailbreak preamble.
around without any warning (NumPy fixed-width ints are modular). Promote to int64 or float64 How it starts
The opening of the file, as written. The whole thing — 787 lines — stays where its author put it; the contents beside it link to each section on GitHub.
NumPy Vectorization for Optimization
You are an expert in high-performance scientific Python for combinatorial optimization. This skill
covers turning loop-based metaheuristic code into vectorized NumPy: population-level operations,
batch fitness evaluation, distance matrices, broadcasting, argsort/argpartition idioms, the
default_rng Generator API, and memory layout — plus the profiling discipline that decides which
loops are worth removing. Use the pattern catalog below to deliver 10-1000x constant-factor
speedups without changing what the algorithm computes.
Initial Assessment
Establish these facts before rewriting any loop:
- Profile evidence. Ask for (or produce) a
cProfileor timing breakdown. Never vectorize a loop that consumes 3% of runtime; Amdahl's law caps the whole-run gain at 1.03x. - Algorithm class. Population methods (GA, DE, PSO, EDA) vectorize naturally: one array axis is the population. Trajectory methods (SA, tabu, ILS) have sequentially dependent iterations; only their inner evaluations and neighborhood scans vectorize.
- Loop inventory. Classify every hot loop: over individuals, over genes within an individual, over parent pairs, over neighborhood moves, over generations, over restarts. Each class has a different replacement pattern (see the decision table below).
- Array sizes. NumPy pays a fixed ~1 µs dispatch cost per call. Arrays under a few hundred
elements rarely amortize it; a
(pop_size, n)batch almost always does. - Objective structure. Can the objective be written as gathers (fancy indexing), elementwise ops, reductions, and matrix products? Sums of local terms vectorize; recursions with data-dependent state (e.g., makespan propagation) resist and may need a JIT instead.
- Branchiness. Data-dependent
if/elseper element converts to masks andnp.where; deep nested control flow may produce unreadable mask algebra — consider Numba for those kernels. - Memory headroom. Broadcasting materializes temporaries:
(n, n, d)for pairwise differences,(p, n, n)for batched matrix gathers. Check RAM before promising speed. - dtype and value ranges. Integer products overflow silently in NumPy fixed-width ints; float32 halves bandwidth but costs precision. Decide dtypes up front.
- Reproducibility contract. Vectorizing changes the RNG draw order, so results differ from the loop version even with the same seed. Agree on equivalence: bit-identical (rarely possible), numerically identical given the same inputs, or statistically equivalent.
- Dependency policy. NumPy only, or are SciPy (
cdist), Numba, and threadpoolctl allowed? - Hardware and BLAS. Core count and BLAS backend (OpenBLAS/MKL) matter for
@-heavy code, and BLAS threading interacts badly withmultiprocessingworkers. - Target throughput. Evaluations/second needed for the experiment budget. Stop optimizing when the budget fits; refactoring time is also research time.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 787 lines · 125 tokens per session scan B cdc100e930ea
numpy-vectorization-for-optimization is a skill published in the GitHub repository hajibabaie/combinatorial-optimization-skills (7 stars, last pushed 2mo ago), licensed MIT. It adds 125 tokens to every session and 10,543 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it B with 1 finding (strips warnings and disclaimers). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
esp32-expert
This skill should be used for ESP32-specific hardware and runtime work in ESP-IDF, Arduino-ESP32, or PlatformIO projects: target/build detection, FreeRTOS tasks and ISRs, memory/DMA, peripherals, power, networking/security, OTA, crash diagnosis, and unattended reliability. Trigger on "debug this ESP32 crash", "review…
janitor-value
Show whether each skill is earning its context-window cost — combined tokens-used view sorted by waste. Use when the user asks 'are my skills worth it', 'what's my context budget', 'which skills are dead weight', or wants to audit skill value, token cost, or usage. Trigger with '/janitor-value'.
ucai-patterns
Use when the user asks about Claude Code best practices, how to write agents, how to use hooks, how to manage context, or how to work effectively with Claude Code's native systems.
code-reviewer
Code review knowledge base: quality, security (OWASP Top 10), error-handling, performance, and test-coverage checklists with severity-ranked output format. Use when reviewing code changes, PRs, or before commits. Loaded automatically by the code-reviewer agent.
evolving-status
View Self-Evolving Loop session status, history, and memory metrics.
orient
Use when user invokes /orient with a topic keyword, entity type, project name, time qualifier, or combination. Also triggers on "what do we know about X", "remind me about X", "where did we leave off on X". Provides targeted context loading — searches the MCP Memory Server graph, knowledge files, journal entries, and…