Agent skill

numpy-core

Stars 0
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/cuba6112/skillfactory/tree/main/skills/numpy-core

SKILL.md

Overview

NumPy Core focuses on the foundational architecture of the ndarray. This includes how data types (dtypes) interpret raw memory, how shapes are manipulated without copying data through "views," and how memory alignment impacts hardware-level performance.

When to Use

  • Creating efficient multidimensional arrays from raw data.
  • Manipulating array shapes for algorithm compatibility.
  • Optimizing memory-intensive operations by ensuring hardware alignment.
  • Handling large-scale numerical data where precision and memory overhead are critical.

Decision Tree

  1. Do you need to change array shape?
    • Use .reshape(). (Check .base to see if it's a view).
  2. Are you performing truth-value testing (e.g., if arr:) on multi-element arrays?
    • No: Use .any() or .all() to avoid ambiguity errors.
  3. Is performance suboptimal on modern hardware?
    • Check arr.flags['ALIGNED']. If False, use np.require with ALIGNED.

Workflows

  1. Optimizing Performance via Alignment

    • Check the ALIGNED flag of the array via arr.flags.
    • Use np.require with requirements=['ALIGNED'] to ensure proper memory offsets.
    • Perform calculations on the aligned array to leverage hardware SIMD optimizations.
  2. Safe Shape Manipulation

    • Use arr.reshape to create a view with a new shape without copying data.
    • Verify the result's .base attribute to confirm it is a view of the original.
    • Use .copy() if the new shape requires a contiguous layout that the view cannot provide.
  3. Precision-Aware Reduction

    • Select a reduction method like .sum() or .prod().
    • Pass a larger dtype (e.g., float64 for a float32 array) to the dtype parameter.
    • Execute the operation to prevent numerical overflow during accumulation.

Non-Obvious Insights

  • Shared Buffers: Different ndarrays can share the same data; modifications in a "view" are immediately visible in the base array.
  • Ambiguity Prevention: NumPy raises errors for boolean testing of multi-element arrays because the truth value is ambiguous; explicit .any() or .all() is required.
  • Dtype Interpretation: A dtype is not just a label but an instruction on how to interpret fixed-size blocks of memory corresponding to array items.

Evidence

  • "Different ndarrays can share the same data, so that changes made in one ndarray may be visible in another." Source
  • "An array is considered aligned if the memory offsets for all elements and the base offset itself is a multiple of self.itemsize." Source

Scripts

  • scripts/numpy-core_tool.py: Provides utilities for checking alignment and creating precision-safe reductions.
  • scripts/numpy-core_tool.js: Simulated logic for shape validation and alignment checks.

Dependencies

  • numpy (Python)

References

  • references/README.md

Expand your agent's capabilities with these related and highly-rated skills.

cuba6112/skillfactory

prompt-engineering

Comprehensive prompt engineering techniques for Claude models. Use this skill when crafting, optimizing, or debugging prompts for Claude API, Claude Code, or any Claude-powered application. Covers system prompts, role prompting, multishot examples, chain of thought, XML structuring, long context handling, extended thinking, prompt chaining, Claude 4.x-specific best practices, and agentic orchestration including subagents, agent loops, skills, MCP integration, and multi-agent workflows.

0 0
Explore
cuba6112/skillfactory

adk-rag-agent

Build RAG (Retrieval-Augmented Generation) agents with Google ADK and Vertex AI RAG Engine. Use when implementing document Q&A, knowledge base search, or citation-backed responses. Covers VertexAiRagRetrieval tool, corpus setup, and citation formatting.

0 0
Explore
cuba6112/skillfactory

headless-cli-agents

Build agentic systems using Claude CLI in headless mode or the Claude Agent SDK. Use when building automation pipelines, CI/CD integrations, multi-agent orchestration, or programmatic Claude interactions. Covers CLI flags (-p, --output-format), session management (--resume, --continue), Python SDK (claude-agent-sdk), custom tools, and agent loop patterns.

0 0
Explore
cuba6112/skillfactory

notion-knowledge-capture

Capture conversations and decisions into structured Notion pages; use when turning chats/notes into wiki entries, how-tos, decisions, or FAQs with proper linking.

0 0
Explore
cuba6112/skillfactory

mcp-builder

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

0 0
Explore
cuba6112/skillfactory

gh-fix-ci

Inspect GitHub PR checks with gh, pull failing GitHub Actions logs, summarize failure context, then create a fix plan and implement after user approval. Use when a user asks to debug or fix failing PR CI/CD checks on GitHub Actions and wants a plan + code changes; for external checks (e.g., Buildkite), only report the details URL and mark them out of scope.

0 0
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results