Agent skill
numpy-io
Install this agent skill to your Project
npx add-skill https://github.com/cuba6112/skillfactory/tree/main/skills/numpy-io
SKILL.md
Overview
NumPy I/O handles the transition of data between system memory and persistent storage. It supports highly efficient binary formats (.npy, .npz), flexible text parsers for messy data, and memory-mapping for datasets that exceed available RAM.
When to Use
- Storing model weights or large datasets in a compressed binary format.
- Reading messy CSV files with missing data or mixed types.
- Processing multi-gigabyte datasets without loading the entire file into memory.
- Bundling multiple related arrays into a single archive file.
Decision Tree
- Storing data for future NumPy use?
- Use
.npyfor single arrays,.npzfor multiple arrays.
- Use
- Is the file larger than your RAM?
- Use
np.memmapto access disk segments lazily.
- Use
- Reading a clean CSV?
- Use
np.loadtxt(fast).
- Use
- Reading a messy CSV with missing values?
- Use
np.genfromtxt(feature-rich but slower).
- Use
Workflows
-
Handling Large Disk-Bound Arrays
- Create a memory-mapped file with
np.memmap(filename, dtype='float32', mode='w+', shape=shape). - Process or fill the array as if it were in memory.
- Call
.flush()to ensure all data is written to the physical disk.
- Create a memory-mapped file with
-
Importing Messy CSV Data
- Define a dictionary of converters for specific columns.
- Use
np.genfromtxt(csv_file, delimiter=',', skip_header=1, converters=converters). - Access the data which now has NaNs or default values where data was missing.
-
Bundling Multiple Arrays for Storage
- Identify several related ndarrays.
- Save them into a single archive with
np.savez_compressed('data.npz', arr1=arr1, arr2=arr2). - Load them later using
data = np.load('data.npz')and access viadata['arr1'].
Non-Obvious Insights
- Manual Flush Requirement: Changes to a
memmaparray are not guaranteed to persist on disk until.flush()is called. - NPZ Lazy Loading:
.npzfiles are ZIP archives;np.loadon an.npzdoes not load the data until you access a specific key. - Parser Capability:
genfromtxthandles column selection, comment characters, and missing value substitution automatically, making it the primary tool for "real-world" text data.
Evidence
- "Memory-mapped files are used for accessing small segments of large files on disk, without reading the entire file into memory." Source
- "savez_compressed... Save several arrays into a single file in compressed .npz format." Source
Scripts
scripts/numpy-io_tool.py: Functions for memmap creation and compressed npz saving.scripts/numpy-io_tool.js: Basic CSV line parser simulation.
Dependencies
numpy(Python)
References
- references/README.md
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
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.
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.
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.
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.
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).
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.
Didn't find tool you were looking for?