← Back to Skills Marketplace
ktkid

bazi-calc

by KtKID · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
260
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install bazi-calc
Description
八字排盘计算工具。根据出生日期和时间,计算四柱八字(年柱、月柱、日柱、时柱)、 十神关系、日主旺衰、喜忌用神、大运排列。输出结构化数据,不做运势判断。 当用户需要"排八字"、"算四柱"、"查日柱"、"看十神"、"排大运"时触发。
README (SKILL.md)

八字排盘计算

纯计算工具:输入出生信息 → 输出四柱干支及衍生数据。只出数据,不做运势判断。

输入要求

  • 出生日期(公历 或 农历+是否闰月)
  • 出生时间(精确到时辰即可)
  • 出生地(用于真太阳时校正,可选)
  • 性别(用于大运顺逆判断)

如输入为农历,先用 web search 转换为公历并确认。

计算步骤

1. 年柱

立春为年分界线(非正月初一)。

年干支 = 该年的天干地支。常见速查:

  • 尾数 0=庚, 1=辛, 2=壬, 3=癸, 4=甲, 5=乙, 6=丙, 7=丁, 8=戊, 9=己
  • 地支需查万年历或按 (年-3) mod 12 映射

2. 月柱

节气为月分界线(非初一):

月支 节气起点 大约公历
寅月 立春 2月4日前后
卯月 惊蛰 3月6日前后
辰月 清明 4月5日前后
巳月 立夏 5月6日前后
午月 芒种 6月6日前后
未月 小暑 7月7日前后
申月 立秋 8月8日前后
酉月 白露 9月8日前后
戌月 寒露 10月8日前后
亥月 立冬 11月7日前后
子月 大雪 12月7日前后
丑月 小寒 1月6日前后

月干由年干推算(五虎遁月法):

年干 正月(寅)起
甲/己 丙寅
乙/庚 戊寅
丙/辛 庚寅
丁/壬 壬寅
戊/癸 甲寅

从正月干支起,按天干顺序逐月递推。

3. 日柱

使用 儒略日数(JDN) 方法计算:

基准点:2000年1月1日 = JDN 2451545

JDN 计算公式(格里高利历):

a = floor((14 - month) / 12)
y = year + 4800 - a
m = month + 12*a - 3
JDN = day + floor((153*m+2)/5) + 365*y + floor(y/4) - floor(y/100) + floor(y/400) - 32045

干支计算

天干 = (JDN + 9) mod 10    → 0=甲 1=乙 2=丙 3=丁 4=戊 5=己 6=庚 7=辛 8=壬 9=癸
地支 = (JDN + 1) mod 12    → 0=子 1=丑 2=寅 3=卯 4=辰 5=巳 6=午 7=未 8=申 9=酉 10=戌 11=亥
六十甲子序号 = (JDN + 49) mod 60  → 0=甲子, 1=乙丑, ..., 59=癸亥

重要:计算后务必通过 web search 万年历交叉验证日柱结果。

4. 时柱

时辰对照:

时辰 时间范围
子时 23:00-01:00
丑时 01:00-03:00
寅时 03:00-05:00
卯时 05:00-07:00
辰时 07:00-09:00
巳时 09:00-11:00
午时 11:00-13:00
未时 13:00-15:00
申时 15:00-17:00
酉时 17:00-19:00
戌时 19:00-21:00
亥时 21:00-23:00

时干由日干推算(五鼠遁时法):

日干 子时起
甲/己 甲子
乙/庚 丙子
丙/辛 戊子
丁/壬 庚子
戊/癸 壬子

从子时起,按天干顺序逐时递推到出生时辰。

5. 真太阳时校正(可选)

如提供出生地:

经度修正 = (120° - 出生地经度) × 4 分钟/度
时差方程 ≈ 查当日值(范围 -14 ~ +16 分钟)
真太阳时 = 当地时间 - 经度修正 + 时差方程

如果修正后时辰改变,需重新计算时柱。

6. 十神关系

以日干为"我":

关系 阳对阳/阴对阴 阳对阴/阴对阳
生我 偏印(枭神) 正印
同我 比肩 劫财
我生 食神 伤官
我克 偏财 正财
克我 七杀(偏官) 正官

列出四柱天干十神 + 地支藏干十神。

7. 日主旺衰判断

综合以下因素:

  • 得令:月支是否生助日主
  • 得地:日支、年支、时支中是否有根
  • 得势:天干中生助日主的力量
  • 得气:整体五行流通情况

判断结果:身旺 / 身弱 / 从强 / 从弱 / 中和

8. 喜忌用神

根据日主旺衰:

  • 身旺:喜克泄耗(官杀、食伤、财星)
  • 身弱:喜生扶(印星、比劫)
  • 还需考虑调候(寒暖燥湿)和通关

9. 大运排列

规则:

  • 阳年男命 / 阴年女命 → 顺行(从月柱向后排)
  • 阴年男命 / 阳年女命 → 逆行(从月柱向前排)
  • 阳干:甲丙戊庚壬;阴干:乙丁己辛癸

起运年龄计算:

  • 顺行:从出生日顺数到下一个(非气),天数 ÷ 3 = 起运岁数
  • 逆行:从出生日逆数到上一个,天数 ÷ 3 = 起运岁数

每步大运 10 年。

输出格式

========== 八字排盘结果 ==========

出生信息:
  公历:YYYY-MM-DD
  农历:XX年X月X日
  时辰:X时(HH:MM)
  出生地:XXX
  真太阳时:HH:MM(修正±X分钟)

四柱:
  年柱:XX    月柱:XX    日柱:XX    时柱:XX

天干十神:
  年干 X = XX    月干 X = XX    日干 X = 日主    时干 X = XX

地支藏干:
  年支 X:X(XX) X(XX) X(XX)
  月支 X:X(XX) X(XX)
  日支 X:X(XX) X(XX) X(XX)
  时支 X:X(XX) X(XX) X(XX)

日主旺衰:X(XX / 得令X / 得地X / 得势X)
喜用神:X(XX)、X(XX)
忌神:X(XX)、X(XX)
调候用神:X

纳音:年XX  日XX

大运(X行,约X岁起运):
  第1步 (XX-XX岁, ~YYYY-YYYY):XX
  第2步 (XX-XX岁, ~YYYY-YYYY):XX
  ...

当前大运:XX(~YYYY-YYYY)
===================================
Usage Guidance
This skill is internally coherent for calculating Bazi and asks for no credentials or installs. Before using, consider privacy: the skill suggests using web search to convert lunar dates and to verify results, which would send the user's birth date/time/place to external services. If you want to avoid that, provide Gregorian (公历) dates yourself or ask the agent to use a local/offline calendrical library, and confirm timezone/DST/true solar time handling. Also verify results with a trusted ephemeris or calendar tool if accuracy is important.
Capability Analysis
Type: OpenClaw Skill Name: bazi-calc Version: 1.0.0 The skill is a specialized calculation tool for 'Bazi' (Four Pillars of Destiny) astrology. It provides detailed mathematical formulas (such as Julian Day Number calculations) and logical rules for the AI agent to derive traditional Chinese calendar data from birth information. There are no indicators of data exfiltration, malicious execution, or harmful prompt injection; the instructions are strictly aligned with the stated purpose of providing structured astrological data (SKILL.md).
Capability Assessment
Purpose & Capability
The name/description (Bazi / four pillars calculation) align with the SKILL.md: all steps (年柱、月柱、日柱、时柱、十神、大运等) are present and appropriate. The skill declares no binaries, env vars, or installs — which is proportionate for a pure calculation tool.
Instruction Scope
Instructions are narrowly scoped to calendar/astronomical calculations and Bazi rules. The only behavior beyond pure local computation is explicit guidance to use web search to convert lunar→solar and to cross-check JDN/day-pillar and to look up the day's equation of time/节 values. That is reasonable for correctness but may leak birth date/time/place to external services; the SKILL.md does not specify which endpoints to use or require user consent before external queries.
Install Mechanism
No install spec and no code files — instruction-only. Nothing is written to disk or fetched at install time.
Credentials
No environment variables, credentials, or config paths are requested. The skill does not ask for anything disproportionate to its purpose.
Persistence & Privilege
always=false and agent invocation is normal. The skill does not request permanent presence or modifications to other skills/config; no elevated privilege requested.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install bazi-calc
  3. After installation, invoke the skill by name or use /bazi-calc
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
- Initial release of bazi-calc: a 八字排盘结构化计算工具 - 输入出生日期、时间、地点、性别,输出四柱八字、十神、日主旺衰、喜忌用神及大运排列 - 仅生成数据,不做任何运势或命理预测 - 自动支持公历/农历、真太阳时、五神、六十甲子、调候用神等规范细节 - 提供详细输出模板,便于对照与结果复用
Metadata
Slug bazi-calc
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is bazi-calc?

八字排盘计算工具。根据出生日期和时间,计算四柱八字(年柱、月柱、日柱、时柱)、 十神关系、日主旺衰、喜忌用神、大运排列。输出结构化数据,不做运势判断。 当用户需要"排八字"、"算四柱"、"查日柱"、"看十神"、"排大运"时触发。 It is an AI Agent Skill for Claude Code / OpenClaw, with 260 downloads so far.

How do I install bazi-calc?

Run "/install bazi-calc" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is bazi-calc free?

Yes, bazi-calc is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does bazi-calc support?

bazi-calc is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created bazi-calc?

It is built and maintained by KtKID (@ktkid); the current version is v1.0.0.

💬 Comments