bazi-skill-chinese-astrology

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

BaZi Skill — 四柱八字命理分析

BaZi Skill — 四柱八字命理分析

Skill by ara.so — Daily 2026 Skills collection.
A Claude Code skill for interactive BaZi (Four Pillars of Destiny) chart calculation and analysis, referencing nine classical Chinese astrology texts. Guides users through birth information collection, produces a complete 四柱 chart, and delivers professional destiny analysis.
Skill 由 ara.so 开发 — 属于2026年度Skill合集。
这是一款支持交互式四柱八字排盘与分析的Claude Code Skill,参考了九部中国传统命理典籍,引导用户收集出生信息,生成完整的四柱命盘,并提供专业的命理分析。

What This Skill Does

Skill 功能

  • Interactive information collection — step-by-step prompts for name, birth date (solar/lunar), birth hour (时辰), gender, and birthplace
  • Chart calculation — derives Year/Month/Day/Hour pillars (年柱/月柱/日柱/时柱), calculates 大运 (major cycles) and 流年 (annual cycles)
  • Comprehensive analysis — day master strength (日主强弱), ten gods (十神), five elements balance (五行), pattern determination (格局), career, relationships, health guidance
  • Classical text references — cross-references nine canonical texts including 《穷通宝典》, 《滴天髓》, 《子平真诠》, and more
  • 交互式信息收集 — 逐步提示用户输入姓名、出生日期(阳历/农历)、出生时辰(时辰)、性别和出生地
  • 命盘计算 — 推导年柱/月柱/日柱/时柱,计算大运(major cycles)和流年(annual cycles)
  • 综合分析 — 涵盖日主强弱、十神、五行平衡、格局判定,以及事业、感情、健康指导
  • 传统典籍参考 — 交叉引用《穷通宝典》《滴天髓》《子平真诠》等九部权威命理典籍

Installation

安装

bash
undefined
bash
undefined

Install to current git project (run from repo root)

安装到当前git项目(在仓库根目录执行)

mkdir -p .claude/skills git clone https://github.com/jinchenma94/bazi-skill .claude/skills/bazi
mkdir -p .claude/skills git clone https://github.com/jinchenma94/bazi-skill .claude/skills/bazi

Install globally (available in all projects)

全局安装(所有项目均可使用)

git clone https://github.com/jinchenma94/bazi-skill ~/.claude/skills/bazi

After installation, Claude Code automatically discovers the skill from `.claude/skills/bazi/SKILL.md` or `~/.claude/skills/bazi/SKILL.md`.
git clone https://github.com/jinchenma94/bazi-skill ~/.claude/skills/bazi

安装完成后,Claude Code会自动从`.claude/skills/bazi/SKILL.md`或`~/.claude/skills/bazi/SKILL.md`路径识别该Skill。

Project Structure

项目结构

bazi-skill/
├── SKILL.md                  # Skill entry point (this file)
├── references/
│   ├── wuxing-tables.md      # Five elements, heavenly stems, earthly branches, ten gods
│   ├── shichen-table.md      # Time period conversion table, daily time calculation
│   ├── dayun-rules.md        # Major cycle forward/reverse rules, starting age calculation
│   └── classical-texts.md    # Core rules from nine classical texts
├── LICENSE
└── README.md
bazi-skill/
├── SKILL.md                  # Skill 入口文件(即当前文件)
├── references/
│   ├── wuxing-tables.md      # 五行、天干、地支、十神对照表
│   ├── shichen-table.md      # 时辰转换表、每日时辰计算规则
│   ├── dayun-rules.md        # 大运顺排/逆排规则、起运年龄计算规则
│   └── classical-texts.md    # 九部传统典籍的核心规则
├── LICENSE
└── README.md

Triggering the Skill

触发Skill

Type any of these in Claude Code to activate:
算八字    看八字    批八字    排八字
四柱      命盘      算命      排盘      bazi
在Claude Code中输入以下任意内容即可激活:
算八字    看八字    批八字    排八字
四柱      命盘      算命      排盘      bazi

Step-by-Step Workflow

分步工作流程

When triggered, follow this exact sequence:
触发后将严格按照以下顺序执行:

Step 1: Collect Birth Information

步骤1:收集出生信息

Ask the user for these fields one at a time (do not ask all at once):
1. 姓名 (Name) — optional, for personalization
2. 性别 (Gender) — 男/女, affects 大运 direction
3. 出生日期 (Birth date) — ask whether 阳历 (solar) or 农历 (lunar)
4. 出生时辰 (Birth hour) — see shichen-table.md for conversion
5. 出生地点 (Birthplace) — province/city for timezone adjustment
逐个向用户询问以下字段(不要一次性问全部):
1. 姓名(Name)— 可选,用于生成个性化分析结果
2. 性别(Gender)— 男/女,影响大运的排布方向
3. 出生日期(Birth date)— 需确认是阳历(solar)还是农历(lunar)
4. 出生时辰(Birth hour)— 可参考shichen-table.md进行转换
5. 出生地点(Birthplace)— 省份/城市,用于时区调整

Step 2: Convert to Four Pillars

步骤2:转换为四柱

Reference
references/wuxing-tables.md
for all lookup tables.
Year Pillar (年柱):
Year stem index  = (year - 4) mod 10  → maps to 天干
Year branch index = (year - 4) mod 12  → maps to 地支
Month Pillar (月柱):
Month branch is fixed by solar term (节气), not calendar month.
Month stem is derived from year stem using the 五虎遁年起月法 table.
Day Pillar (日柱):
Use pre-calculated 万年历 (perpetual calendar) lookup.
Day stem/branch cycle repeats every 60 days (六十甲子).
Hour Pillar (时柱):
Convert clock time → 时辰 (see shichen-table.md)
Hour stem derived from day stem using 五鼠遁日起时法 table.
所有对照表均参考
references/wuxing-tables.md
年柱:
年干索引 = (年份 - 4) mod 10  → 对应天干
年支索引 = (年份 - 4) mod 12  → 对应地支
月柱:
月支由节气确定,而非自然月。
月干根据年干通过五虎遁年起月法表推导。
日柱:
使用预计算的万年历查询。
干支周期每60天循环一次(六十甲子)。
时柱:
将时钟时间转换为时辰(参考shichen-table.md)
时干根据日干通过五鼠遁日起时法表推导。

Step 3: Identify Day Master (日主)

步骤3:确定日主

The Day Pillar's Heavenly Stem is the Day Master — the central reference point for all analysis.
Example: 日柱 = 甲子
Day Master = 甲 (Wood, Yang)
日柱的天干即为日主,是所有命理分析的核心参照点。
示例:日柱 = 甲子
日主 = 甲(木,阳)

Step 4: Calculate 大运 (Major Cycles)

步骤4:计算大运

Reference
references/dayun-rules.md
:
Male + Yang year stem  → Forward (顺排)
Male + Yin year stem   → Reverse (逆排)
Female + Yang year stem → Reverse (逆排)
Female + Yin year stem  → Forward (顺排)

Starting age = days to next/previous 节气 ÷ 3 (round to nearest integer)
Each 大运 lasts 10 years.
参考
references/dayun-rules.md
男 + 年干为阳 → 顺排
男 + 年干为阴 → 逆排
女 + 年干为阳 → 逆排
女 + 年干为阴 → 顺排

起运年龄 = 距离下一个/上一个节气的天数 ÷ 3(四舍五入取整)
每步大运持续10年。

Step 5: Determine Ten Gods (十神)

步骤5:确定十神

Cross-reference Day Master against each pillar stem using the 十神 table in
references/wuxing-tables.md
:
RelationshipSame element, same polaritySame element, opposite polarity
Self比肩劫财
Element I produce食神伤官
Element that produces me正印偏印
Element I control正财偏财
Element that controls me正官七杀
对照日主与各柱天干,通过
references/wuxing-tables.md
中的十神表查询对应关系:
关系同元素同极性同元素异极性
自身比肩劫财
我生食神伤官
生我正印偏印
我克正财偏财
克我正官七杀

Step 6: Assess Five Elements Balance (五行平衡)

步骤6:评估五行平衡

Count Wood/Fire/Earth/Metal/Water across all 8 characters (stems + branches).
Note hidden stems (藏干) in branches — include these in element count.
Identify excess and deficiency.
统计8个干支(天干+地支)中的木/火/土/金/水数量。
需计入地支藏干的元素,最终判定五行的旺衰与缺补。

Step 7: Determine Pattern (格局)

步骤7:判定格局

Reference
references/classical-texts.md
— 《子平真诠》 and 《三命通会》 sections:
普通格局 (Common patterns): 正官格, 七杀格, 正印格, 偏印格,
                            食神格, 伤官格, 正财格, 偏财格
特殊格局 (Special patterns): 从格, 化格, 专旺格, etc.

Month branch hidden stem often determines the primary pattern.
参考
references/classical-texts.md
中《子平真诠》和《三命通会》的相关内容:
普通格局: 正官格, 七杀格, 正印格, 偏印格,
          食神格, 伤官格, 正财格, 偏财格
特殊格局: 从格, 化格, 专旺格, 等

月支藏干通常决定主格局。

Step 8: Full Analysis Output

步骤8:输出完整分析报告

Structure your analysis report as follows:
markdown
undefined
分析报告结构如下:
markdown
undefined

八字命盘 | BaZi Chart

八字命盘 | BaZi Chart

姓名: [Name] 性别: [Gender] 出生: [Date Time]
天干地支
年柱XX
月柱XX
日柱XX
时柱XX
日主: X(X行,X)

姓名: [姓名] 性别: [性别] 出生: [日期时间]
天干地支
年柱XX
月柱XX
日柱XX
时柱XX
日主: X(X行,X)

大运排列

大运排列

起运年龄: X岁(约 XXXX 年起)
大运年份十神
1XXXXXX–XXXXXX
...

起运年龄: X岁(约 XXXX 年起)
大运年份十神
1XXXXXX–XXXXXX
...

命理分析

命理分析

日主强弱

日主强弱

[Assessment of day master strength based on seasonal support, roots, and helpers]
[基于得令、得地、得助情况评估日主强弱]

五行分析

五行分析

[Element count and balance assessment]
[元素数量统计与平衡评估]

格局判定

格局判定

[Pattern name and explanation, citing classical text]
[格局名称与解释,标注参考典籍]

十神解读

十神解读

[Key ten god relationships and their implications]
[核心十神关系及其影响说明]

大运流年

大运流年

[Current and upcoming major/annual cycle analysis]
[当前及未来大运、流年的运势分析]

综合建议

综合建议

事业: [Career guidance] 感情: [Relationship guidance]
健康: [Health guidance] 择吉: [Auspicious timing suggestions]

参考典籍: 《穷通宝典》《三命通会》《滴天髓》《渊海子平》《千里命稿》 免责声明: 仅供传统文化学习与娱乐参考,不构成任何决策依据。
undefined
事业: [事业发展指导] 感情: [感情婚恋指导]
健康: [健康注意事项] 择吉: [吉日选择建议]

参考典籍: 《穷通宝典》《三命通会》《滴天髓》《渊海子平》《千里命稿》 免责声明: 仅供传统文化学习与娱乐参考,不构成任何决策依据。
undefined

Key Reference Tables

核心参考表

天干 Heavenly Stems

天干

甲(Wood+) 乙(Wood-) 丙(Fire+) 丁(Fire-) 戊(Earth+)
己(Earth-) 庚(Metal+) 辛(Metal-) 壬(Water+) 癸(Water-)
甲(Wood+) 乙(Wood-) 丙(Fire+) 丁(Fire-) 戊(Earth+)
己(Earth-) 庚(Metal+) 辛(Metal-) 壬(Water+) 癸(Water-)

地支 Earthly Branches

地支

子(Water+/Rat)  丑(Earth-/Ox)   寅(Wood+/Tiger) 卯(Wood-/Rabbit)
辰(Earth+/Dragon) 巳(Fire-/Snake) 午(Fire+/Horse) 未(Earth-/Goat)
申(Metal+/Monkey) 酉(Metal-/Rooster) 戌(Earth+/Dog) 亥(Water-/Pig)
子(Water+/Rat)  丑(Earth-/Ox)   寅(Wood+/Tiger) 卯(Wood-/Rabbit)
辰(Earth+/Dragon) 巳(Fire-/Snake) 午(Fire+/Horse) 未(Earth-/Goat)
申(Metal+/Monkey) 酉(Metal-/Rooster) 戌(Earth+/Dog) 亥(Water-/Pig)

五虎遁年起月法 (Month Stem from Year Stem)

五虎遁年起月法

Year stem 甲/己 → January stem starts at 丙
Year stem 乙/庚 → January stem starts at 戊
Year stem 丙/辛 → January stem starts at 庚
Year stem 丁/壬 → January stem starts at 壬
Year stem 戊/癸 → January stem starts at 甲
年干为甲/己 → 正月天干为丙
年干为乙/庚 → 正月天干为戊
年干为丙/辛 → 正月天干为庚
年干为丁/壬 → 正月天干为壬
年干为戊/癸 → 正月天干为甲

五鼠遁日起时法 (Hour Stem from Day Stem)

五鼠遁日起时法

Day stem 甲/己 → 子时 stem = 甲
Day stem 乙/庚 → 子时 stem = 丙
Day stem 丙/辛 → 子时 stem = 戊
Day stem 丁/壬 → 子时 stem = 庚
Day stem 戊/癸 → 子时 stem = 壬
日干为甲/己 → 子时天干为甲
日干为乙/庚 → 子时天干为丙
日干为丙/辛 → 子时天干为戊
日干为丁/壬 → 子时天干为庚
日干为戊/癸 → 子时天干为壬

Classical Texts Quick Reference

传统典籍速查

典籍Primary Use
《穷通宝典》Day master seasonal adjustment (调候)
《三命通会》Pattern and spirit star (格局神煞) analysis
《滴天髓》Five element strength and flow (五行旺衰)
《渊海子平》Ten gods and six relations (十神六亲)
《千里命稿》Case study verification (命例实证)
《协纪辨方书》Auspicious date selection (择日神煞)
《果老星宗》Star and fate combined reading (星命合参)
《子平真诠》Use god and pattern (用神格局)
《神峰通考》Correcting common errors (命理辨误)
Full excerpts and rules are in
references/classical-texts.md
.
典籍主要用途
《穷通宝典》日主调候分析
《三命通会》格局神煞分析
《滴天髓》五行旺衰与流通分析
《渊海子平》十神六亲分析
《千里命稿》命例实证参考
《协纪辨方书》择日神煞参考
《果老星宗》星命合参分析
《子平真诠》用神格局判定
《神峰通考》命理常见误区校正
完整摘录与规则详见
references/classical-texts.md

Common Patterns & Troubleshooting

常见问题与处理方案

Lunar to Solar Date Conversion

农历与阳历日期转换

  • Always confirm whether user provides 阳历 (Gregorian) or 农历 (lunar)
  • Use 万年历 lookup for lunar→solar conversion before calculating pillars
  • Intercalary months (闰月) require special handling
  • 始终确认用户提供的是阳历(公历)还是农历(阴历)
  • 计算四柱前需用万年历将农历转换为阳历
  • 闰月需要特殊处理

Solar Term (节气) Boundaries

节气边界处理

  • Month pillar changes at 节 (first solar term of month), NOT at month start
  • Critical for people born near the 1st–8th of a month
  • When uncertain, inform user their month pillar may differ by one month
  • 月柱在节(每月第一个节气)时切换,而非自然月月初
  • 对出生在每月1-8号的用户尤为重要
  • 存疑时需告知用户月柱可能存在1个月的偏差

Timezone Adjustment

时区调整

  • Standard Chinese charts use Beijing time (UTC+8)
  • Users born outside China: convert local birth time to Beijing time
  • Some practitioners use true solar time (真太阳时) — note if applying this
  • 标准八字排盘使用北京时间(UTC+8)
  • 在中国境外出生的用户:需将当地出生时间转换为北京时间
  • 部分从业者使用真太阳时 — 若使用需明确标注

Day Master Strength Assessment Checklist

日主强弱评估清单

✓ Is the birth season supportive? (得令)
✓ Does the day branch support the day master? (得地)  
✓ Do other stems help the day master? (得助)
Strong (身强) if 2+ conditions met; Weak (身弱) if 0–1 conditions met.
✓ 是否得令?(出生季节生扶日主)
✓ 是否得地?(日支生扶日主)  
✓ 是否得助?(其他天干生扶日主)
满足2项及以上为身强;0-1项为身弱。

Missing Information Handling

信息缺失处理

  • If user cannot provide exact birth time: analyze without hour pillar, note limitation
  • If only year/month known: provide partial analysis with appropriate caveats
  • Never fabricate birth data — always ask for clarification
  • 若用户无法提供准确出生时间:不参考时柱分析,明确标注局限性
  • 仅能提供年/月信息:给出部分分析,并附上适当的说明
  • 绝对不要编造出生数据 — 始终向用户询问确认

Example Interaction

交互示例

User: 帮我算八字

Claude: 好的,我来为您排八字!请问您的性别是?

User: 女

Claude: 好的。请问您的出生日期是阳历还是农历?

User: 阳历,1990年3月15日

Claude: 明白了。请问您出生的时辰或具体时间?

User: 早上8点半

Claude: 早上8点半是辰时(07:00–09:00)。请问出生地点?

User: 上海

Claude: [Proceeds to calculate pillars, 大运, and full analysis]
用户: 帮我算八字

Claude: 好的,我来为您排八字!请问您的性别是?

用户: 女

Claude: 好的。请问您的出生日期是阳历还是农历?

用户: 阳历,1990年3月15日

Claude: 明白了。请问您出生的时辰或具体时间?

用户: 早上8点半

Claude: 早上8点半是辰时(07:00–09:00)。请问出生地点?

用户: 上海

Claude: [继续计算四柱、大运并生成完整分析]

Disclaimer

免责声明

本 Skill 仅供传统文化学习与娱乐参考,分析结果不构成任何医疗、法律、财务或人生重大决策依据。命理学属于传统文化范畴,请理性看待。
本 Skill 仅供传统文化学习与娱乐参考,分析结果不构成任何医疗、法律、财务或人生重大决策依据。命理学属于传统文化范畴,请理性看待。