Ganzhi Calendar (干支计算)

Calculate Chinese lunar calendar dates with Heavenly Stems (天干) and Earthly Branches (地支). Use when generating Chinese calendar tables, checking 黄历, or conve...

MIT-0 · Free to use, modify, and redistribute. No attribution required.
0 · 156 · 1 current installs · 1 all-time installs
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
Purpose & Capability
Name and description match the included files and runtime instructions. The skill only requires Python and contains a single script that computes stems/branches and prints a weekly calendar — this is proportional to the stated purpose.
Instruction Scope
SKILL.md tells the agent to run python3 scripts/calendar.py and the script does only local date math and printing. However, both the README and code explicitly say the lunar-date calculation is approximate and a proper lunar library is required for accurate results. There are also factual/inconsistency issues in the docs/code (see below) that affect correctness: a module docstring references 1984-02-02 as a reference while the code uses 1983-02-05; month/day formatting and some formulas look incorrect or simplified. These are functional accuracy concerns, not scope creep or data-exfiltration issues.
Install Mechanism
No install spec; instruction-only with a local Python script. Nothing is downloaded or written to disk beyond the included files.
Credentials
No environment variables, credentials, or config paths are requested. The script uses only the Python standard library and command-line arguments.
Persistence & Privilege
The skill does not request always:true nor modify system or other-skill settings. It runs only when invoked and does not persist state or credentials.
Assessment
This skill appears safe from a security perspective: it runs a local Python script, does not access the network, and requests no secrets. Before using it for anything that requires accuracy (scheduling, historical research, horoscopes), be aware that the code contains approximations and some implementation errors (inconsistent reference dates, a rough Chinese-new-year approximation, unusual use of the stems array for day numerals, and a likely incorrect month-branch calculation). If you need authoritative lunar/Ganzhi dates, prefer a well-tested lunar calendar library or validate outputs against a trusted source. If you accept approximate results for casual use, the skill is fine to run locally.

Like a lobster shell, security has layers — review code before you run it.

Current versionv1.0.0
Download zip
latestvk97cn1w7e4bdr9dm371nn53eed82e7q1

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

SKILL.md

Chinese Calendar Calculator

Usage

Run the script to generate weekly calendar:

python3 scripts/calendar.py

Output format:

丙午(马年) 🐎
| Date | Weekday | Nongli | 月天干地支 | 日天干地支 |
| ---- | ------- | ------ | ---------- | ---------- |
| 3月6日 | 周五 | 农历正月十八 | 辛卯月 | 己卯日 |

Calculation Method

Reference Date

  • 1983-02-05 = 甲子日 (calibrated against verified sources)
  • Day stem-branch: (days since reference) % 60 → stem = pos % 10, branch = pos % 12

Day Calculation

delta = (date - 1983-02-05).days
stem_idx = delta % 10
branch_idx = delta % 12
day_stem_branch = STEMS[stem_idx] + BRANCHES[branch_idx]

Month Calculation

Month branches: 正月=寅, 二月=卯, 三月=辰...

month_branch_idx = (month + 1) % 12
month_stem_idx = (year_stem_idx * 2 + month) % 10
month_stem_branch = STEMS[month_stem_idx] + BRANCHES[month_branch_idx]

Year Calculation

cycle_pos = (year - 4) % 60
year_stem_idx = cycle_pos % 10
year_branch_idx = cycle_pos % 12
year_stem_branch = STEMS[year_stem_idx] + BRANCHES[year_branch_idx]

Constants

STEMS = ['甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸']
BRANCHES = ['子', '丑', '寅', '卯', '辰', '巳', '午', '未', '申', '酉', '戌', '亥']
ZODIAC = {
    '子': '鼠', '丑': '牛', '寅': '虎', '卯': '兔',
    '辰': '龙', '巳': '蛇', '午': '马', '未': '羊',
    '申': '猴', '酉': '鸡', '戌': '狗', '亥': '猪'
}

Files

2 total
Select a file
Select a file to preview.

Comments

Loading comments…