cjk-calendar/SKILL.md
Convert between Chinese, Japanese, Korean, and Vietnamese lunisolar calendar dates and Gregorian/Julian dates. Use when the user needs to look up historical East Asian dates, convert era names (年號) like 康熙, 天保, 崇禎 to Western dates, compute sexagenary cycle (干支) day/month/year, or work with Julian Day Numbers. Supports ~220 BCE to 1945 CE with 1,637 eras and 131,808 lunar month records. Runs entirely locally with a SQLite database.
npx skillsauth add kltng/humanities-skills cjk-calendarInstall 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.
Convert between East Asian lunisolar calendars (Chinese, Japanese, Korean, Vietnamese) and Gregorian/Julian dates. All conversions run locally against a SQLite database — no network calls after setup.
Download the SQLite database (~14 MB) on first use:
python3 scripts/calendar_converter.py setup
This downloads calendar.db into the scripts/ directory. Only needed once.
python3 scripts/calendar_converter.py convert "崇禎三年四月初三"
python3 scripts/calendar_converter.py convert "康熙六十一年十二月二十九日"
python3 scripts/calendar_converter.py convert "天保三年閏十一月十五日"
python3 scripts/calendar_converter.py convert "M1.1.1"
python3 scripts/calendar_converter.py gregorian 1644 3 19
python3 scripts/calendar_converter.py jdn 2299161
python3 scripts/calendar_converter.py eras --name 康熙
python3 scripts/calendar_converter.py eras --dynasty 明 --country chinese
python3 scripts/calendar_converter.py eras --country japanese
| Format | Example | Notes | |---|---|---| | Chinese numerals | 崇禎三年四月初三 | Standard CJK date | | Leap month | 天保三年閏九月十五日 | 閏 prefix marks leap | | 元年 (year 1) | 康熙元年正月初一 | 元 = 1, 正 = month 1 | | 廿/卅 shorthand | 光緒廿八年三月卅日 | 廿 = 20, 卅 = 30 | | Arabic numerals | 康熙61年12月29日 | Mixed format | | Japanese shorthand | M1.1.1 | M/T/S/H/R for eras (lunisolar years only) | | Ganzhi year | 嘉慶甲午年三月初五 | Sexagenary year cycle | | Full ganzhi | 嘉慶甲午年丁亥月丙子日 | Year + month + day ganzhi |
All commands output JSON. Example for convert:
[
{
"input_era": {
"era_name": "崇禎",
"era_id": 371,
"emperor_name": "思宗",
"dynasty_name": "明",
"country": "chinese",
"year_in_era": 3,
"month": 4,
"month_name": "四月",
"is_leap_month": false,
"day": 3
},
"jdn": 2316520,
"gregorian": "1630-05-14",
"julian": "1630-05-04",
"ganzhi": { "year": "庚午", "month": "辛巳", "day": "丙子" },
"all_cjk_dates": [
{ "era_name": "崇禎", "country": "chinese", "year_in_era": 3, ... },
{ "era_name": "寛永", "country": "japanese", "year_in_era": 7, ... }
]
}
]
JDN is the universal pivot for all conversions. It's an integer day count from noon GMT, January 1, 4713 BCE (Julian calendar). Every lunisolar month record in the database stores its first_jdn and last_jdn.
The 60-unit cycle combines 10 Heavenly Stems (天干: 甲乙丙丁戊己庚辛壬癸) with 12 Earthly Branches (地支: 子丑寅卯辰巳午未申酉戌亥). Used for years, months, and days.
(JDN + 49) mod 60 gives the cycle indexThe same era name can appear in different dynasties or countries (e.g., 建武 was used by both Han and Japanese emperors). When results are ambiguous, the converter returns all matches. Use --country to filter.
| Region | Coverage | Era Count | |---|---|---| | Chinese | ~220 BCE – 1912 CE | ~900 eras | | Japanese | 645 CE – 1945 CE | ~250 eras | | Korean | Various periods | ~200 eras | | Vietnamese | Various periods | ~200 eras |
Total: 1,637 eras, 131,808 lunar month records.
Note: Japanese dates after Meiji 5 (1872) are not in the database because Japan adopted the Gregorian calendar in 1873. Japanese shorthand (M/T/S/H/R) only works for lunisolar-era dates.
Import the script directly for programmatic use:
import sys
sys.path.insert(0, "scripts")
from calendar_converter import (
get_connection, parse_cjk_date, convert_cjk_to_jdn,
convert_jdn, gregorian_to_jdn, get_era_metadata,
)
conn = get_connection()
# CJK → Gregorian
parsed = parse_cjk_date("康熙六十一年十二月二十九日")
results = convert_cjk_to_jdn(conn, parsed)
for jdn, era_info in results:
conversion = convert_jdn(conn, jdn)
print(f"{era_info.era_name} → {conversion.gregorian}")
# Gregorian → CJK
jdn = gregorian_to_jdn(1644, 3, 19)
conversion = convert_jdn(conn, jdn)
for cjk in conversion.cjk_dates:
print(f"{cjk.era_name}{cjk.year_in_era}年{cjk.month_name}{cjk.day}日 ({cjk.country})")
See references/database_schema.md for the full schema and query guide.
scripts/calendar_converter.py — Standalone converter (Python 3.10+, zero dependencies)references/database_schema.md — SQLite schema and query patternsdevelopment
Query the China Biographical Database (CBDB) locally via SQLite for biographical data on 656K+ historical Chinese figures from the 7th century BCE through the 19th century CE. Use when searching for Chinese historical figures, scholars, officials, or literary figures — their biographical details, family/kinship networks, official postings, social associations, examination records, or addresses. Runs entirely locally after initial database download (~556 MB). Faster and more flexible than the API version.
development
Interact with a local Zotero 8 desktop application through its HTTP API at localhost:23119. Use this skill whenever the user wants to search, fetch, add, edit, or organize bibliographic items in their Zotero library, import citations (BibTeX, RIS, etc.), attach files, manage collections and tags, or retrieve full-text content from Zotero. Triggers on mentions of Zotero, citation management, reference libraries, bibliographic databases, or local library management. Also use when chaining with other catalog skills (Harvard, LOC, HathiTrust, etc.) to save found records into the user's Zotero library.
development
Search for items and properties on Wikidata and retrieve entity details, claims, and external identifiers. Supports both keyword search (Wikidata Action API) and semantic/hybrid search (Wikidata Vector Database), plus direct entity retrieval (Special:EntityData) and structured querying (WDQS SPARQL).
testing
Query and explore the TGAZ (Temporal Gazetteer) SQLite database of 82,000+ historical Chinese placenames spanning 763 BCE to 1911 CE. Use this skill whenever the user asks about historical Chinese places, administrative geography, dynastic jurisdictions, place name evolution, or wants to query tgaz.db. Also trigger when the user mentions CHGIS, TGAZ, historical gazetteer, Chinese historical GIS, or asks questions like "what was X called in dynasty Y", "what counties existed in year Z", "where was X located", or any spatial/temporal query about Chinese historical geography. This skill is relevant even for casual questions like "tell me about ancient Chang'an" or "Tang dynasty cities near the Yellow River".