agentleFS
DobroslavRadosavljevicDobroslavRadosavljevic/cabrakan/.agents/skills/date-fns/SKILL.md

date-fns

Skill1 starsChanged 3 months agoMITView on GitHub

Build, review, debug, migrate, or plan date-fns v4 date/time code with @date-fns/tz and @date-fns/utc. Use for date-fns, format, parse, parseISO, addDays, differenceIn*, Interval, Duration, date-fns/fp, locales, TZDate, UTCDate, tz(), utc, transpose, in option, Unicode tokens, DST, SSR hydration date bugs, and migrations from date-fns v2/v3 or date-fns-tz.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use this skill for date-fns v4 date math, formatting, parsing, FP mode, locales, and official timezone packages @date-fns/tz / …

    line 8
  2. Very specific:

    Add/set/boundaries, diffs, Interval, Duration: manipulate-compare.md.

    line 21
  3. Distinctive:

    Verify with typecheck plus focused tests for Invalid Date, calendar vs elapsed diffs, and zone/SSR edges when relevant.

    line 26
  4. Very specific:

    Prefer named imports. Constants come from "date-fns/constants", not the main barrel.

    line 47
  5. Very specific:

    Always isValid before format — format throws RangeError on Invalid Date.

    line 48
  6. Very specific:

    Prefer differenceInCalendar* for calendar-day questions.

    line 51
  7. Very specific:

    Prefer full TZDate / UTCDate at library boundaries.

    line 54
  8. Very specific:

    Do not confuse @date-fns/tz with third-party date-fns-tz.

    line 55
  9. Distinctive:

    Prefer repository-owned commands.

    line 59

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

date-fns

Use this skill for date-fns v4 date math, formatting, parsing, FP mode, locales, and official timezone packages @date-fns/tz / @date-fns/utc.

Workflow

  1. Inspect the local surface before changing code:
    • Packages: date-fns, optional @date-fns/tz, @date-fns/utc (and legacy date-fns-tz if present).
    • Versions: prefer date-fns ≥ 4 for first-class { in } / TZDate / UTCDate interop. v3 is common but local-only unless using date-fns-tz.
    • Zone intent: system-local UI, UTC-normalized server math, or named IANA zones (user/venue/HQ).
    • Imports: named from "date-fns", "date-fns/fp", "date-fns/locale/*", "date-fns/constants".
  2. Refresh docs when versions are unclear or work touches timezones, Unicode tokens, SSR, or major upgrades. Start from source-map.md.
  3. Route deeper detail:
    • Install, imports, core concepts, Invalid Date: setup-core.md.
    • format / parse / parseISO, Unicode tokens: format-parse.md.
    • Add/set/boundaries, diffs, Interval, Duration: manipulate-compare.md.
    • TZDate, UTCDate, tz / utc, transpose, DST, SSR: timezones.md.
    • FP, locales, TypeScript: fp-locales-types.md.
    • v2→v3→v4 and date-fns-tz migration: migration-pitfalls.md.
  4. Match the project's installed major and existing import style. Do not add @date-fns/tz or @date-fns/utc unless zone semantics require them.
  5. Verify with typecheck plus focused tests for Invalid Date, calendar vs elapsed diffs, and zone/SSR edges when relevant.

Zone Decision Tree

System-local calendar / host TZ only?
  → plain Date + date-fns

UTC-only math (server day, charts, no IANA zones)?
  → @date-fns/utc (UTCDate / UTCDateMini or { in: utc })

Named IANA zone or multi-zone product?
  → @date-fns/tz (TZDate / TZDateMini or { in: tz("…") })

Stuck on date-fns v3?
  → upgrade to v4 + official packages, or use legacy date-fns-tz until then

Core Judgment

  • Bare date-fns is system-local, not a UTC library. Use @date-fns/utc or @date-fns/tz for non-local calendar fields.
  • Prefer named imports. Constants come from "date-fns/constants", not the main barrel.
  • Always isValid before format — format throws RangeError on Invalid Date.
  • Unicode tokens: use yyyy-MM-dd, never Moment-style YYYY-MM-DD / DD (week-year / day-of-year). See format-parse.md.
  • parseISO("YYYY-MM-DD") → local midnight; new Date("YYYY-MM-DD") → UTC midnight. Do not conflate.
  • Prefer differenceInCalendar* for calendar-day questions; differenceIn* for elapsed full units.
  • With mixed zones or primitives, pin context with { in: tz("…") } or { in: utc } — first object Date/extension argument otherwise wins and order can flip day math.
  • new TZDate(iso, zone) ≠ legacy toZonedTime. Same instant, different wall clock. Wall-clock remapping uses transpose.
  • Prefer full TZDate / UTCDate at library boundaries; Mini variants skip zone-aware toString / locale formatters (system-zone leak).
  • Do not confuse @date-fns/tz with third-party date-fns-tz.

Verification

Prefer repository-owned commands. Cover the relevant subset:

  • bun pm ls date-fns @date-fns/tz @date-fns/utc (and date-fns-tz if migrating).
  • Typecheck for DateArg, options types, and extension return types.
  • Tests: valid/invalid parse, Unicode tokens, calendar vs elapsed diffs, reversed intervals, DST spring-forward/fall-back, { in } vs argument-order zone selection.
  • SSR/hydration smoke when formatting “today” or local day boundaries across server (often UTC) and client (local).

Report which checks ran, which did not, and version assumptions that remain.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.