← 返回 Skills 市场
tianlinle

Awesome Bazi Calculator - Cantian AI

作者 cantian.ai · GitHub ↗ · v0.0.8 · MIT-0
cross-platform ✓ 安全检测通过
1986
总下载
8
收藏
30
当前安装
8
版本数
在 OpenClaw 中安装
/install cantian-bazi
功能描述
以命理场景为主的八字排盘、黄历查询与大运/流年/流月/流日/流时区间查询技能。用于用户请求“算八字”“四柱排盘”“阳历/农历转八字”“查黄历/宜忌”“查未来10年流年”“查下个月流日/流时”等场景;关键词包括:八字、四柱、命理、大运、流年、流月、流日、流时、时辰、阳历转八字、农历转八字、黄历、宜忌、干支日期。真太...
使用说明 (SKILL.md)

八字排盘、黄历与大运流年查询 (Bazi, Calendar & Fortune Range)

何时使用 / When to Use

  • 用户要根据阳历出生时间计算四柱八字。 / User wants Four Pillars from Gregorian birth datetime.
  • 用户要根据农历出生时间计算四柱八字。 / User wants Four Pillars from lunar birth datetime.
  • 用户要查询某一天对应的农历、干支、宜忌等信息。 / User wants Chinese calendar info for a specific date.
  • 用户要“查黄历”或看某天宜忌。 / User wants almanac-style daily auspicious/inauspicious info.
  • 用户要查询一段时间内的大运、流年、流月、流日或流时。 / User wants decade/annual/monthly/daily/hourly fortune cycles in a time range.

前置依赖 / Prerequisites

  • 推荐运行环境:Node 24(可直接运行 TypeScript 源码)。 / Recommended runtime: Node 24 (can run TypeScript source directly).
  • 兼容方案:若 Node 版本较低,使用 tsx 执行。 / Fallback: use tsx on lower Node versions.
  • 执行目录:在 skill 根目录(SKILL.md 所在目录)执行以下命令。 / Run commands in the skill root (where SKILL.md is located).
npm i

# 仅在需要兼容运行时安装
# Install only for fallback mode
npm i -D tsx

脚本清单 / Script Index

  • 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 & Parameters

scripts/buildBaziFromSolar.ts

# 推荐方式
node scripts/buildBaziFromSolar.ts \x3CsolarTime> [gender] [sect]

# 兼容方式(fallback)
tsx scripts/buildBaziFromSolar.ts \x3CsolarTime> [gender] [sect]

参数定义 / Parameters:

  • solarTime(必填 / required)
    • 格式:ISO 8601 日期时间(不带时区),如 1990-05-15T14:30:00
    • 默认值:无
    • 非法输入:格式不合法或为空时,由底层解析失败并报错
  • gender(可选 / 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 \x3ClunarTime> [gender] [sect]

# 兼容方式(fallback)
tsx scripts/buildBaziFromLunar.ts \x3ClunarTime> [gender] [sect]

参数定义 / Parameters:

  • lunarTime(必填 / required)
    • 格式:ISO 8601 日期时间(不带时区),如 1990-04-21T14:30:00
    • 默认值:无
    • 非法输入:格式不合法或为空时,由底层解析失败并报错
  • gender(可选 / 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 \x3CbeijingTime> \x3ClongitudeOrCity> [standardLongitude]

# 兼容方式(fallback)
tsx scripts/convertToTrueSolarTime.ts \x3CbeijingTime> \x3ClongitudeOrCity> [standardLongitude]

参数定义 / Parameters:

  • beijingTime(必填 / required)
    • 含义:北京时间(东八区标准时)输入时间
    • 格式:YYYY-MM-DDTHH:mm[:ss](不带时区),如 1990-05-15T14:30:00
    • 默认值:无
    • 非法输入:抛错 时间格式无效...请使用不带时区的 YYYY-MM-DDTHH:mm[:ss]...
  • longitudeOrCity(必填 / required)
    • 含义:可直接传经度,或传城市名由脚本自动匹配经度
    • 经度格式:十进制度数,范围 -180180(如武汉 114.17
    • 城市格式:城市名(支持常见后缀,如 武汉武汉市
    • 默认值:无
    • 非法输入:地点无法识别时抛错 无法识别地点...请传经度或城市名...
  • standardLongitude(可选 / optional)
    • 含义:标准经度,默认 120(北京时间基准经线)
    • 取值范围:-180180
    • 默认值:120
    • 非法输入:抛错 standardLongitude 无效...standardLongitude 超出范围...

输出 / Output:

  • 标准输出仅返回 1 行真太阳时时间字符串(YYYY-MM-DDTHH:mm:ss),可直接作为 buildBaziFromSolar.tsqueryFortuneRange.tssolar 时间参数。

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 '\x3Cjson>'

# 兼容方式(fallback)
tsx scripts/queryFortuneRange.ts '\x3Cjson>'

参数定义 / Parameters:

  • json(必填 / required)
    • 格式:JSON 字符串,结构如下:
      • birth.calendar(必填):solarlunar
      • birth.time(必填):出生时间(不带时区),如 1990-05-15T14:30:00
      • birth.gender(可选):1 男,0 女,默认 1
      • birth.sect(可选):12,默认 2
      • query.startDateTime(必填):YYYY-MM-DDYYYY-MM-DDTHH
      • query.endDateTime(必填):YYYY-MM-DDYYYY-MM-DDTHH
      • query.level(可选):yearmonthdayhour,默认 year
    • 自动补全规则:
      • startDateTimeYYYY-MM-DD 时补为 T00
      • endDateTimeYYYY-MM-DD 时补为 T23
    • 结果规则:
      • level 采用层级语义:year \x3C month \x3C day \x3C hour
      • 自动补父级:查 day 自动包含 year+month;查 hour 自动包含 year+month+day
      • level=hour 时返回流时,输出会将连续相同流时合并为时辰段(2 小时语义)
      • 查询层级达到 month 时返回按连续干支月分段的流月区间
      • 流年/流月/流日/流时结果均包含:干支、十神、神煞、与原命盘的刑冲合会关系
      • 输出固定为完整 Markdown(按层级标题展开全部字段,不使用代码块),不做省略与去重
    • 非法输入:
      • JSON 非法时抛错 参数 JSON 解析失败。请传入合法 JSON。
      • 时间格式错误时抛错 时间格式无效...请使用 YYYY-MM-DD 或 YYYY-MM-DDTHH...
      • startDateTime 晚于 endDateTime 时抛错 时间范围无效:startDateTime 不能晚于 endDateTime。
      • level=hour 且范围超过 62 天时抛错 hour 查询区间过大...

示例 / Examples

# 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

注意事项 / Notes

  1. 所有命令均在 skill 根目录执行,不依赖仓库根目录路径。 / Run all commands in the skill root; do not rely on repo-root paths.
  2. 时间字符串不要携带时区后缀(如 Z+08:00),以免产生与预期不一致的换日结果。 / Do not append timezone suffixes (such as Z or +08:00) to avoid unexpected day shifts.
  3. 若要按真太阳时排盘,请先运行 convertToTrueSolarTime.ts,再把输出时间传给其它脚本;其它脚本本身不做真太阳时换算。 / For true solar time workflow, run convertToTrueSolarTime.ts first and pass its output to other scripts.
  4. 涉及 23:00-23:59 出生时,建议显式传 sect,避免晚子时归属歧义。 / For births between 23:00-23:59, explicitly set sect to avoid ambiguity.
  5. queryFortuneRange.tsstartDateTime/endDateTime 只支持 YYYY-MM-DDYYYY-MM-DDTHH,不支持分钟秒。 / queryFortuneRange.ts supports only YYYY-MM-DD and YYYY-MM-DDTHH for range inputs.
  6. 真太阳时换算只依赖经度,不需要纬度;脚本支持直接传城市名自动匹配经度。 / True solar time conversion uses longitude only; latitude is not required.
安全使用建议
Only provide birth details and gender when needed for the reading, avoid entering someone else’s personal data without consent, and treat the results as entertainment or cultural reference rather than high-stakes advice. Installation depends on an external npm package, so install only if you are comfortable with that dependency.
能力评估
Purpose & Capability
The documented purpose is Bazi charting, Chinese calendar lookup, true-solar-time conversion, and fortune-cycle range queries; the scripts implement those calculation workflows using the expected birth time, optional gender, date range, and longitude/city inputs.
Instruction Scope
Instructions are limited to running local CLI scripts with explicit arguments and producing Markdown or timestamp output; no prompt overrides, hidden agent instructions, account actions, deletion, or broad local access were found.
Install Mechanism
Installation uses npm with one runtime dependency, cantian-tymext, and optional tsx for older Node versions; the artifact package.json contains no install hooks or auto-start scripts, but users still rely on the npm dependency supply chain.
Credentials
Birth datetime, optional gender, and location/longitude can be personal data, but they are proportionate to the stated fortune-calculation purpose; source review found no file writes, network calls, telemetry, credential use, or unrelated data handling.
Persistence & Privilege
No persistence, privilege escalation, background workers, credential/session/profile access, or local storage behavior is present in the reviewed artifacts.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install cantian-bazi
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /cantian-bazi 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.0.8
**Expanded functionality for Bazi range queries and true solar time conversion** - New: Added `scripts/convertToTrueSolarTime.ts` for longitude-based true solar time conversion (supports both longitude and common city names as input). - New: Added `scripts/queryFortuneRange.ts` for querying decade, annual, monthly, daily, and hourly luck cycles over a time range, with rich output (includes support for merging consecutive hourly cycles and relational analysis). - Skill description and documentation greatly expanded to clarify fortune range querying as a main scenario. - All usage examples and error handling for new scripts are included. - True solar time conversion is now provided as a dedicated script, decoupled from core Bazi charting.
v0.0.7
- Expanded the skill description and keywords to include “查黄历 (huangli)” and “宜忌 (yi-ji)” scenarios, clarifying application to Chinese almanac and auspicious/inauspicious activity queries. - No code changes in this version. Documentation updates only.
v0.0.6
Version 0.0.6 - Refactored scripts from JavaScript (.js) to TypeScript (.ts) for improved type safety and maintainability. - Added new scripts: buildBaziFromLunar.ts, buildBaziFromSolar.ts, getChineseCalendar.ts, and util.ts. - Introduced getChineseCalendar.ts to support Chinese calendar (农历/干支) and almanac queries. - Enhanced documentation with detailed instructions, parameter definitions, and usage examples for both Bazi calculation and calendar lookup. - Updated prerequisites to recommend Node 24+ and provided compatible fallback instructions using tsx.
v0.0.5
- Skill renamed from "bazi" to "cantian-bazi" - Description expanded to include calculation of "Ten Gods" and various astrological factors (神煞), and translated into English - No code or feature changes detected in this version
v0.0.4
- Added an English and Chinese introduction highlighting Cantian AI's expertise and platform features for Bazi charting and analysis. - Enhanced descriptions to emphasize AI-powered interpretations and personalized astrology services. - No changes to usage instructions, parameters, or script examples.
v0.0.3
- Added English translations to all documentation sections for bilingual support. - Clarified usage scenarios, parameters, and examples in both Chinese and English. - Improved documentation consistency for easier understanding by a wider audience. - No functional changes; documentation update only.
v0.0.2
- Added package.json to manage dependencies. - Removed scripts/package.json, consolidating package management to the root. - Updated documentation to instruct users to run npm install in the skill root directory before using scripts.
v0.0.1
Initial release of Cantian Bazi: - Enables 八字排盘 (Bazi calculation) based on Gregorian birth date and time. - Returns 四柱八字, 五行, 十神 and other related fate analysis information. - Supports solar-to-Bazi conversion, gender, and 子时 (midnight hour) calculation options. - CLI interface with parameters for date, gender, and midnight configuration. - Usage scenarios include Bazi queries, fate analysis, and solar-to-Chinese calendar conversions.
元数据
Slug cantian-bazi
版本 0.0.8
许可证 MIT-0
累计安装 30
当前安装数 30
历史版本数 8
常见问题

Awesome Bazi Calculator - Cantian AI 是什么?

以命理场景为主的八字排盘、黄历查询与大运/流年/流月/流日/流时区间查询技能。用于用户请求“算八字”“四柱排盘”“阳历/农历转八字”“查黄历/宜忌”“查未来10年流年”“查下个月流日/流时”等场景;关键词包括:八字、四柱、命理、大运、流年、流月、流日、流时、时辰、阳历转八字、农历转八字、黄历、宜忌、干支日期。真太... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 1986 次。

如何安装 Awesome Bazi Calculator - Cantian AI?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install cantian-bazi」即可一键安装,无需额外配置。

Awesome Bazi Calculator - Cantian AI 是免费的吗?

是的,Awesome Bazi Calculator - Cantian AI 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Awesome Bazi Calculator - Cantian AI 支持哪些平台?

Awesome Bazi Calculator - Cantian AI 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Awesome Bazi Calculator - Cantian AI?

由 cantian.ai(@tianlinle)开发并维护,当前版本 v0.0.8。

💬 留言讨论