Agent skill

numpy-string-ops

Stars 0
Forks 0

Install this agent skill to your Project

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

SKILL.md

Overview

NumPy's char submodule provides vectorized versions of standard Python string operations. It allows for efficient processing of arrays containing str_ or bytes_ types, though it is being transitioned to a newer strings module in recent versions.

When to Use

  • Cleaning large text datasets (e.g., stripping whitespace, normalization).
  • Performing batch substring searches across thousands of records.
  • Concatenating columns of text data using broadcasting.
  • Converting character casing for entire datasets simultaneously.

Decision Tree

  1. Starting new development?
    • Use numpy.strings if available; numpy.char is legacy.
  2. Comparing strings with potential trailing spaces?
    • numpy.char comparison operators automatically strip whitespace.
  3. Concatenating a constant prefix to an array of names?
    • Use np.char.add(prefix, name_array).

Workflows

  1. Batch String Concatenation

    • Create two arrays of strings, A and B.
    • Use np.char.add(A, B) to join them element-wise.
    • Broadcasting applies if one array is a single string and the other is multidimensional.
  2. Cleaning Text Datasets

    • Identify an array of messy text.
    • Apply np.char.strip(arr) to remove whitespace.
    • Use np.char.lower(arr) to normalize casing across the entire dataset.
  3. Finding Substrings in Arrays

    • Use np.char.find(text_array, 'target_word').
    • Identify elements with non-negative indices (where the word was found).
    • Filter the original array using boolean indexing based on the search result.

Non-Obvious Insights

  • Legacy Status: The char module is considered legacy; future-proof code should look towards the numpy.strings alternative.
  • Implicit Stripping: Unlike standard Python ==, char module comparison operators strip trailing whitespace before evaluating equality.
  • Vectorization Reality: While these operations are vectorized, string manipulation is inherently less performant than numeric math because strings have variable lengths and require more complex memory management.

Evidence

  • "Unlike the standard numpy comparison operators, the ones in the char module strip trailing whitespace characters before performing the comparison." Source
  • "The numpy.char module provides a set of vectorized string operations for arrays of type numpy.str_ or numpy.bytes_." Source

Scripts

  • scripts/numpy-string-ops_tool.py: Routines for batch text cleaning and search.
  • scripts/numpy-string-ops_tool.js: Simulated string concatenation logic.

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