Agent skill
numpy-datetime
Install this agent skill to your Project
npx add-skill https://github.com/cuba6112/skillfactory/tree/main/skills/numpy-datetime
SKILL.md
Overview
NumPy implements datetime64 for fixed-point dates and timedelta64 for durations. Unlike Python's standard datetime, NumPy's implementation is "naive" (no timezones) and designed for high-performance vectorized operations on time-series data.
When to Use
- Creating uniform time grids for simulations or financial modeling.
- Calculating business day offsets while accounting for weekends and holidays.
- Performing arithmetic between dates (e.g., finding durations in hours).
- Handling timestamp datasets where timezone complexity is not required.
Decision Tree
- Need to create a sequence of dates?
- Use
np.arange(start, stop, dtype='datetime64[D]').
- Use
- Calculating work deadlines?
- Use
np.busday_offsetwith theholidaysparameter.
- Use
- Converting a duration to a numeric float (e.g., hours)?
- Divide the
timedelta64bynp.timedelta64(1, 'h').
- Divide the
Workflows
-
Generating a Custom Date Range
- Define a start date and end date as strings (e.g., '2023-01-01').
- Use
np.arange(start, end, dtype='datetime64[D]')to create the sequence. - Index the resulting array to select specific dates.
-
Calculating Business Deadlines
- Select a start date.
- Use
np.busday_offset(date, 10, roll='forward')to find the date 10 business days later. - Pass a 'holidays' list to ensure the calculation skips known non-working days.
-
Time-Difference Analysis
- Subtract two
datetime64arrays to get atimedelta64result. - Divide the result by
np.timedelta64(1, 'h')to convert the duration into a float of hours. - Perform statistical analysis (e.g., mean duration) on the numeric result.
- Subtract two
Non-Obvious Insights
- Naive Assumption:
datetime64ignores timezones and assumes 86,400 SI seconds per day, meaning it cannot parse timestamps during positive leap seconds. - Unsafe Casting: Conversion between variable-length units (Months/Years) and fixed-length units (Days) is considered "unsafe" because their relationship changes (leap years, month lengths).
- Precision Mapping: The unit in brackets (e.g.,
[ms],[D]) determines the resolution and the maximum range the timestamp can represent.
Evidence
- "This is a “naive” time, with no explicit notion of timezones or specific time scales." Source
- "Timedelta day unit is equivalent to 24 hours, month and year units cannot be converted directly into days without using ‘unsafe’ casting." Source
Scripts
scripts/numpy-datetime_tool.py: Logic for business day calculations and time delta conversion.scripts/numpy-datetime_tool.js: Simulated ISO date range generator.
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?