.cursor/skills/calendar-math/SKILL.md
Designs and implements complete calendar and timekeeping calculation modules for the Library of Time project, including algorithms, date conversions, and tests. Use when working on calendar logic, adding a new calendar, or one-shotting an entire calendar implementation from a prompt. Treat `CalendarAPI/Calendars/*`, `CalendarAPI/Timekeeping/*`, and `CalendarAPI/Other/*` as a single Calendar API layer.
npx skillsauth add CodapopKSP/LibraryOfTime calendar-mathInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill whenever the user:
Follow this end-to-end workflow for each calendar or timekeeping feature:
Understand the specification
Docs/src/.anchor-based-lunisolar skill.Docs/src/, follow add-calendar-system (subsection Reference tables in #### Info): header rows, days per month, Latin transliteration beside non-Latin names, and Gregorian alignment notes only when a stable mapping exists.Design the data and API surface
CalendarAPI/Calendars/*.js for concrete calendar families.CalendarAPI/Timekeeping/*.js for general time computations and shared utilities.CalendarAPI/Other/*.js for related astronomical, political, and cultural time data.output string and in structured fields (year, month, day, other, etc.) only what the user or project docs explicitly asked for. Do not add era labels, year numbers, or other metadata because other calendars include them or because it “seems useful.” If a stub returns year: null and the user did not request a year label, keep year: null and omit the year from output.toGregorian, fromGregorian, isLeapYear).calendar-patterns skill for concrete examples from the existing codebase.Plan the algorithms
generateAllNewMoons + getNewMoon, or getMoonPhase, from CalendarAPI/Other/astronomicalData.js) to determine the real new-moon instants.[yearStart, nextYearStart) (with a max-iteration guard). Never assume one decrement/increment is enough. Never display a negative day-of-month — fix the year resolution. See anchor-based-lunisolar skill.Place the implementation
CalendarAPI/Calendars/* for calendar systems and their primary date-conversion functions.CalendarAPI/Timekeeping/* for non-calendar timekeeping systems (e.g., clocks, decimal time) that are still treated like first-class calendar APIs.CalendarAPI/Other/* for additional time-related systems and data organized separately from the main calendar and clock modules but used in the same way.Integrate with the UI
Content/nodeData.js directly; it is procedurally generated from the mdBook in Docs/. Instead, update the relevant source docs when explicitly requested, and rely on the build process to regenerate it.UserInterface/calendarView.js: register the node in buildNodeValueGetters (key = node id from nodeData, without -node). Without this, Calendar View shows empty cells when that system is selected. See add-calendar-system Step 4b.nodeDraw.js and descriptionPanel.js so that the new system appears correctly in the Library of Time UI without breaking existing calendars.Design and implement tests
Tests/ (for example, Tests/otherCalendarsTests.js, Tests/lunisolarCalendarTests.js, etc.).expected: getCalendar(input)); that is a tautology and does not validate correctness.runAllTests() commented out by default.Validate and iterate
When the user asks to one-shot an entire calendar implementation, ensure the plan and output cover:
Tests/ with round-trip checks and edge cases.calendarView.js if Calendar View should show per-day values; see add-calendar-system Step 4b).development
Compute weekdays correctly for calendars where some days (intercalary/epagomenal) are excluded from the weekday cycle. Use when implementing or debugging weekday logic with “skipped days”, “epagomenal”, “intercalary”, or “non-weekday” days.
development
Catalogs common implementation patterns used by existing calendars and timekeeping systems in the Library of Time, with examples and guidance on when to use each pattern. Use when choosing how to structure a new calendar’s algorithm.
tools
Use user-provided month names or labels in calendar implementations and output. Use when implementing or updating a calendar and the user has given a list of month names (including for leap months), so the implementation does not default to numeric-only output.
development
Encodes conventions and logic patterns for building calendars and timekeeping systems in the Library of Time project, including preferred use of utilities like createAdjustedDateTime, timezone handling, and epoch selection. Use when implementing or refactoring calendar logic so behavior matches existing systems.