new-method-implementation

Implements new gmt date-time API methods using Temporal with string-first I/O conventions.

6|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/northguild/gmt --skill new-method-implementation-northguild
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: new-method-implementation
Source: https://github.com/northguild/gmt/tree/main/packages/gmt/skills/contributor/new-method-implementation
Command: npx skills add https://github.com/northguild/gmt --skill new-method-implementation-northguild

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Contributors to the gmt library need a consistent, rules-driven process for adding new date/time methods to packages/gmt/src without duplicating existing helpers, breaking string-first I/O contracts, or mixing plain and zoned Temporal logic. ## Core Features & Use Cases - Reuse-first implementation flow: Searches all gmt namespaces (calendar, duration, instant, plain, precision, regex, span, unix, utc, zoned) for existing helpers before writing new Temporal code. - Convention enforcement: Applies naming patterns (ForDate/ForZoned suffixes, startOf*/endOf*, isBetween*, get*), module boundary rules, and typed fallback returns ("" for strings, null for numbers/objects, false for booleans, [] for arrays, 0n for bigint). - Testing and release checklist: Mandates unit tests with DST/timezone boundary matrices via battleTestTimeZones, plus index.ts exports, package.json subpaths, and README API Surface updates. - Use Case: A contributor wants to add a getQuarterForZoned method. The skill guides them to check existing quarter helpers, place the logic in zoned/, return ISO strings, add Chatham/Santiago/Apia transition test rows, and update exports and docs. ## Quick Start Ask the assistant to implement a new gmt method such as getQuarterForZoned in packages/gmt/src following the contributor implementation rules.

Frequently Asked Questions about new-method-implementation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new method to the gmt date library?▼

First search all gmt namespaces under packages/gmt/src for an existing helper and reuse it if found. Otherwise implement with Temporal, keep string-first I/O, separate plain and zoned logic, add tests, and update exports and the README API Surface section.

What naming conventions does gmt use for date functions?▼

gmt uses ForDate/ForDateTime/ForZoned suffixes for type-specific variants, startOf*/endOf* for boundaries, isBetween* for range checks, and get* for getters. Current-moment accessors live in get/, while argument-taking getters live in calculate/.

Does gmt allow using the JavaScript Date object in new methods?▼

No. gmt forbids Date, Date.now, and manual date parsing entirely. All implementations must use TC39 Temporal constructors and immutable Temporal operations, with ISO 8601 strings and IANA timezone identifiers as inputs.

What should a gmt function return on invalid input?▼

Fallbacks depend on return type: empty string for strings, null for numbers and objects, false for booleans, empty array for arrays, and 0n for bigint precision converters. Functions in span/ return null instead of 0n.

How are timezone edge cases tested in gmt zoned methods?▼

Zoned methods must run battleTestTimeZones and include DST transition rows for zones like Pacific/Chatham, America/Santiago, and Pacific/Apia. Tests use it.each template tables, and start-of-unit values must never be computed by truncating and re-resolving wall clocks.