Install
openclaw skills install cantian-bazi以命理场景为主的八字排盘、黄历查询与大运/流年/流月/流日/流时区间查询技能。用于用户请求“算八字”“四柱排盘”“阳历/农历转八字”“查黄历/宜忌”“查未来10年流年”“查下个月流日/流时”等场景;关键词包括:八字、四柱、命理、大运、流年、流月、流日、流时、时辰、阳历转八字、农历转八字、黄历、宜忌、干支日期。真太阳时换算属于辅助能力,仅在需要校时定盘时使用。 / Bazi-first skill for charting, Chinese almanac lookup, and range queries of decade/annual/monthly/daily/hourly luck cycles. Use for requests like “calculate my Bazi”, “convert solar/lunar datetime to Bazi”, “check huangli”, “query next 10 years”, and “check next month daily/hourly cycles”. Keywords focus on Bazi/Four Pillars and fortune-cycle analysis; true-solar-time conversion is an auxiliary step only when time correction is required.
openclaw skills install cantian-bazitsx 执行。 / Fallback: use tsx on lower Node versions.SKILL.md 所在目录)执行以下命令。 / Run commands in the skill root (where SKILL.md is located).npm i
# 仅在需要兼容运行时安装
# Install only for fallback mode
npm i -D tsx
scripts/buildBaziFromSolar.ts:根据阳历时间生成八字 Markdown。 / Build Bazi from solar datetime.scripts/buildBaziFromLunar.ts:根据农历时间生成八字 Markdown。 / Build Bazi from lunar datetime.scripts/convertToTrueSolarTime.ts:将北京时间按经度换算为真太阳时(输出可直接给其它脚本使用)。 / Convert Beijing time to true solar time by longitude.scripts/getChineseCalendar.ts:查询指定日期(默认今天)的农历与干支信息。 / Get Chinese calendar for a given date (defaults to today).scripts/queryFortuneRange.ts:按时间区间查询大运与流年/流月/流日/流时(流时按时辰段合并)。 / Query decade fortune and annual/monthly/daily/hourly cycles in a time range.scripts/buildBaziFromSolar.ts# 推荐方式
node scripts/buildBaziFromSolar.ts <solarTime> [gender] [sect]
# 兼容方式(fallback)
tsx scripts/buildBaziFromSolar.ts <solarTime> [gender] [sect]
参数定义 / Parameters:
solarTime(必填 / required)
1990-05-15T14:30:00gender(可选 / optional)
1(男 / male)、0(女 / female)1性别参数无效。男性传 1,女性传 0。sect(可选 / optional)
1(23:00-23:59 视为明天)、2(23:00-23:59 视为当天)2早晚子时配置参数无效。传 1 表示 23:00-23:59 日干支为明天,传 2 表示 23:00-23:59 日干支为当天。scripts/buildBaziFromLunar.ts# 推荐方式
node scripts/buildBaziFromLunar.ts <lunarTime> [gender] [sect]
# 兼容方式(fallback)
tsx scripts/buildBaziFromLunar.ts <lunarTime> [gender] [sect]
参数定义 / Parameters:
lunarTime(必填 / required)
1990-04-21T14:30:00gender(可选 / optional)
1(男 / male)、0(女 / female)1性别参数无效。男性传 1,女性传 0。sect(可选 / optional)
1(23:00-23:59 视为明天)、2(23:00-23:59 视为当天)2早晚子时配置参数无效。传 1 表示 23:00-23:59 日干支为明天,传 2 表示 23:00-23:59 日干支为当天。scripts/convertToTrueSolarTime.ts(真太阳时换算)# 推荐方式
node scripts/convertToTrueSolarTime.ts <beijingTime> <longitudeOrCity> [standardLongitude]
# 兼容方式(fallback)
tsx scripts/convertToTrueSolarTime.ts <beijingTime> <longitudeOrCity> [standardLongitude]
参数定义 / Parameters:
beijingTime(必填 / required)
YYYY-MM-DDTHH:mm[:ss](不带时区),如 1990-05-15T14:30:00时间格式无效...请使用不带时区的 YYYY-MM-DDTHH:mm[:ss]...longitudeOrCity(必填 / required)
-180 到 180(如武汉 114.17)武汉、武汉市)无法识别地点...请传经度或城市名...standardLongitude(可选 / optional)
120(北京时间基准经线)-180 到 180120standardLongitude 无效... 或 standardLongitude 超出范围...输出 / Output:
YYYY-MM-DDTHH:mm:ss),可直接作为 buildBaziFromSolar.ts 与 queryFortuneRange.ts 的 solar 时间参数。scripts/getChineseCalendar.ts(黄历/农历查询)# 推荐方式(不传参默认今天)
node scripts/getChineseCalendar.ts [date]
# 兼容方式(fallback)
tsx scripts/getChineseCalendar.ts [date]
参数定义 / Parameters:
date(可选 / optional)
YYYY-MM-DD(兼容 YYYY/MM/DD),如 2024-02-10日期格式无效。请传入 YYYY-MM-DD(也兼容 YYYY/MM/DD)。日期值无效。请确认年月日是实际存在的日期。scripts/queryFortuneRange.ts(大运/流年/流月/流日/流时区间查询)# 推荐方式
node scripts/queryFortuneRange.ts '<json>'
# 兼容方式(fallback)
tsx scripts/queryFortuneRange.ts '<json>'
参数定义 / Parameters:
json(必填 / required)
birth.calendar(必填):solar 或 lunarbirth.time(必填):出生时间(不带时区),如 1990-05-15T14:30:00birth.gender(可选):1 男,0 女,默认 1birth.sect(可选):1 或 2,默认 2query.startDateTime(必填):YYYY-MM-DD 或 YYYY-MM-DDTHHquery.endDateTime(必填):YYYY-MM-DD 或 YYYY-MM-DDTHHquery.level(可选):year、month、day、hour,默认 yearstartDateTime 传 YYYY-MM-DD 时补为 T00endDateTime 传 YYYY-MM-DD 时补为 T23level 采用层级语义:year < month < day < hourday 自动包含 year+month;查 hour 自动包含 year+month+daylevel=hour 时返回流时,输出会将连续相同流时合并为时辰段(2 小时语义)month 时返回按连续干支月分段的流月区间参数 JSON 解析失败。请传入合法 JSON。时间格式无效...请使用 YYYY-MM-DD 或 YYYY-MM-DDTHH...startDateTime 晚于 endDateTime 时抛错 时间范围无效:startDateTime 不能晚于 endDateTime。level=hour 且范围超过 62 天时抛错 hour 查询区间过大...# buildBaziFromSolar.ts 最小可用示例
node scripts/buildBaziFromSolar.ts "1990-05-15T14:30:00"
# buildBaziFromLunar.ts 最小可用示例
node scripts/buildBaziFromLunar.ts "1990-04-21T14:30:00"
# convertToTrueSolarTime.ts 最小可用示例(武汉经度)
node scripts/convertToTrueSolarTime.ts "1990-05-15T14:30:00" 114.17
# convertToTrueSolarTime.ts 城市名示例(无需手查经度)
node scripts/convertToTrueSolarTime.ts "1990-05-15T14:30:00" 武汉
# getChineseCalendar.ts 最小可用示例(默认今天)
node scripts/getChineseCalendar.ts
# getChineseCalendar.ts 指定日期
node scripts/getChineseCalendar.ts 2024-02-10
# queryFortuneRange.ts: 查询 2026-2028 流年
node scripts/queryFortuneRange.ts '{"birth":{"calendar":"solar","time":"1990-05-15T14:30:00","gender":1,"sect":2},"query":{"startDateTime":"2026-01-01","endDateTime":"2028-12-31","level":"year"}}'
# queryFortuneRange.ts: 查询下个月流日(按日)
node scripts/queryFortuneRange.ts '{"birth":{"calendar":"solar","time":"1990-05-15T14:30:00"},"query":{"startDateTime":"2026-05-01","endDateTime":"2026-05-31","level":"day"}}'
# queryFortuneRange.ts: 查询某段流时(按时辰段合并)
node scripts/queryFortuneRange.ts '{"birth":{"calendar":"solar","time":"1990-05-15T14:30:00"},"query":{"startDateTime":"2026-05-01T09","endDateTime":"2026-05-03T18","level":"hour"}}'
# 两步流程示例:先换算真太阳时,再排盘(示例结果需替换为实际换算输出)
node scripts/convertToTrueSolarTime.ts "1990-05-15T14:30:00" 114.17
node scripts/buildBaziFromSolar.ts "1990-05-15T14:10:20" 1 2
Z、+08:00),以免产生与预期不一致的换日结果。 / Do not append timezone suffixes (such as Z or +08:00) to avoid unexpected day shifts.convertToTrueSolarTime.ts,再把输出时间传给其它脚本;其它脚本本身不做真太阳时换算。 / For true solar time workflow, run convertToTrueSolarTime.ts first and pass its output to other scripts.sect,避免晚子时归属歧义。 / For births between 23:00-23:59, explicitly set sect to avoid ambiguity.queryFortuneRange.ts 的 startDateTime/endDateTime 只支持 YYYY-MM-DD 或 YYYY-MM-DDTHH,不支持分钟秒。 / queryFortuneRange.ts supports only YYYY-MM-DD and YYYY-MM-DDTHH for range inputs.