Agent skill

numpy-set-ops

Stars 0
Forks 0

Install this agent skill to your Project

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

SKILL.md

Overview

NumPy provides vectorized set operations for 1D arrays and multidimensional subarrays. These tools allow for deduplication, membership testing, and finding differences/intersections between datasets.

When to Use

  • Deduplicating rows in a large feature matrix.
  • Filtering a dataset to exclude a list of forbidden values.
  • Synchronizing two datasets by finding their intersection.
  • Compressing data by storing unique values and their index mappings.

Decision Tree

  1. Need to find non-duplicate elements?
    • Use np.unique.
  2. Need to reconstruct the original array from unique values?
    • Set return_inverse=True in np.unique.
  3. Checking if elements exist in another list?
    • Use np.isin(data, target_list).

Workflows

  1. Finding Unique Rows in a Dataset

    • Create a 2D array.
    • Call np.unique(arr, axis=0).
    • Inspect the result to see the deduplicated records.
  2. Reconstructing an Array from Sets

    • Call u, inv = np.unique(arr, return_inverse=True).
    • Store 'u' and 'inv' separately (useful for data compression).
    • Rebuild the original array using u[inv].
  3. Filtering by Membership

    • Define a 'forbidden' set of values.
    • Generate a boolean mask using ~np.isin(data, forbidden).
    • Filter the data: clean_data = data[mask].

Non-Obvious Insights

  • Flattening by Default: Set operations work on flattened 1D versions of input arrays unless an axis is explicitly specified.
  • NaN Handling: Like sorting, unique treats NaN as a value and sorts it to the end of the unique output.
  • Lexicographic Row Sort: When axis=0 is used in unique, the resulting unique rows are sorted lexicographically.

Evidence

  • "Returns the sorted unique elements of an array." Source
  • "isin(element, test_elements...)... broadcasting over element only." Source

Scripts

  • scripts/numpy-set-ops_tool.py: Routines for unique row detection and inverse reconstruction.
  • scripts/numpy-set-ops_tool.js: Simulated set intersection 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