Index of every page on this site: llms.txt
All skills
corey-alix avatar

/date-management-assistant

@e4fbc1d
Run it yourself

Specialized assistant for implementing consistent date handling patterns using YYYY-MM-DD string format to avoid timezone issues.

  • 1 file
  • 4.5 KB
  • Updated 9 months ago
  • GitHub
Use this Skill: https://skilld.dev/gh/corey-alix/dwp-hours/date-management-assistant

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈39 tokens for metadata: the name and description. ≈1.1k when used: this file.

Description uses 2.0% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈157 characters, or 2.0%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Date Management Assistant

Description

Specialized assistant for implementing consistent date handling patterns in the DWP Hours Tracker. Provides guidance on the bespoke date management system that uses YYYY-MM-DD string format to avoid timezone issues, ensuring predictable and testable date operations across the application.

Date Management System

The DWP Hours Tracker uses a lightweight bespoke date management library to ensure consistency and avoid timezone-related issues. All dates are persisted in the database as strings in YYYY-MM-DD format (ISO 8601 date-only representation).

Core Principles

  • String-Based Dates: All dates stored and manipulated as YYYY-MM-DD formatted strings
  • Timezone Agnostic: Eliminates timezone ambiguity by avoiding Date objects where possible
  • Consistency: Simplifies date comparisons and calculations across client and server
  • Compatibility: Ensures reliable operation across different environments
  • Performance: Avoids the complexities of JavaScript Date objects

Anti-Patterns

Never extract date components by slicing today() or other date strings. Instead, use or extend dateUtils.ts with a purpose-built function.

// ❌ WRONG — opaque string slicing, duplicates logic, breaks if format changes
const currentYear = today().slice(0, 4);
const currentMonth = today().slice(0, 7);

// ✅ CORRECT — use existing dateUtils functions
import { getCurrentYear, getCurrentMonth } from "../shared/dateUtils.js";
const year = getCurrentYear(); // returns number
const month = getCurrentMonth(); // returns "YYYY-MM" string

If no suitable function exists in dateUtils.ts, extend the library with a well-named, tested function rather than inlining string manipulation at the call site.

Key Implementation Areas

Database Layer
  • All date fields stored as TEXT columns containing YYYY-MM-DD formatted strings
  • Ensures timezone-agnostic storage and retrieval
  • Compatible with SQLite TEXT type for reliable querying
Server-side Calculations
  • Functions in shared/workDays.ts and shared/ptoCalculations.ts perform date arithmetic
  • Use Date objects internally but convert results to YYYY-MM-DD strings for consistency
  • Maintain separation between calculation logic and data representation
Client-side Components
  • Components like pto-calendar and pto-dashboard construct date strings directly
  • Build dates from year, month, and day components to avoid timezone issues
  • Calendar rendering logic uses string-based date construction
API Endpoints
  • Date parameters accepted and returned as YYYY-MM-DD strings
  • Maintains consistency across client-server communication
  • Simplifies API contracts and reduces serialization issues
Test Data
  • Seed files and test utilities use hardcoded YYYY-MM-DD date strings
  • Ensures predictable testing without timezone dependencies
  • Facilitates deterministic test execution

Trigger

Activate this skill when users ask about:

  • Date handling patterns and best practices
  • YYYY-MM-DD string format usage
  • Timezone avoidance strategies
  • Date storage in database
  • Date utility functions and conversions
  • Calendar date construction
  • Date-related testing approaches

Response Pattern

When activated, follow this structured approach:

  1. Identify Date Context: Determine if query involves storage, calculation, display, or testing
  2. Reference Core Principles: Explain YYYY-MM-DD string-based approach and timezone avoidance
  3. Provide Implementation Guidance: Show how to use shared/dateUtils.ts functions
  4. Address Edge Cases: Cover date boundary conditions, leap years, and month transitions
  5. Ensure Consistency: Verify approach aligns with existing date management patterns

Examples

  • "How should I handle dates in the database?"
  • "What's the best way to calculate date ranges?"
  • "How do I avoid timezone issues with dates?"
  • "How are dates formatted in API responses?"
  • "How do I construct dates for calendar components?"

Additional Context

This skill integrates with the bespoke date utility functions in shared/dateUtils.ts. The approach ensures date handling is predictable, testable, and free from timezone-related bugs. All date operations should go through the shared utilities rather than native Date APIs to maintain consistency.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at e4fbc1d. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Dormantupdated 9 months ago

README badge

README badge for corey-alix/dwp-hours/date-management-assistant