compass-ai-bazi

Chinese Bazi (八字) four-pillar fortune calculation and basic interpretation — enables AI agents to compute and read a birth chart using traditional Zi-Ping methodology.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "compass-ai-bazi" with this command: npx skills add Judyzj/compass-ai-bazi

Compass AI — Bazi (八字) Calculation & Lite Interpretation

This skill gives you the complete reference data and step-by-step algorithms needed to calculate a Chinese Bazi (Four Pillars of Destiny) chart from a person's birth date, time, and location, and to produce a basic personality and fortune interpretation.

⚠️ NO EXTERNAL TOOLS OR LIBRARIES NEEDED. Every calculation in this skill — year pillar, month pillar, day pillar, hour pillar, Ten Gods, Five Elements, Major Fortune Cycles — is performed by you, the AI, using only arithmetic and the lookup tables below. Do NOT attempt to call any tool, install any library, or search the web. Just reason through the steps.

For full AI-powered streaming analysis, life K-line charts, two-person compatibility, daily fortune sticks, and interactive fortune-telling chat, visit Compass AI.


When to Use This Skill

Use this skill when the user:

  • Provides a birth date, birth time, and birth city/location and asks for a Bazi (八字) reading
  • Asks about their Four Pillars, Day Master, Five Elements balance, Ten Gods, or Major Fortune cycles
  • Wants to know their favorable/unfavorable elements (喜用神/忌神)
  • Asks about personality traits or career tendencies based on Chinese astrology

Important UX rules:

  • Only ask the user for: birth date (年月日), birth time (时辰), gender, and birth city name. Never ask for longitude/latitude — look it up from the City Coordinates table below.
  • If the city is not in the table, estimate from the nearest listed city or provincial capital.
  • Collect all info in as few turns as possible. Ideally one message: "请告诉我您的出生年月日、时辰、性别和出生城市".

Core Concepts (Quick Reference)

Heavenly Stems (天干) and Their Five Elements

StemPinyinElementPolarity
jiǎ木 WoodYang
木 WoodYin
bǐng火 FireYang
dīng火 FireYin
土 EarthYang
土 EarthYin
gēng金 MetalYang
xīn金 MetalYin
rén水 WaterYang
guǐ水 WaterYin

Earthly Branches (地支) and Their Five Elements

BranchPinyinElementZodiac
水 WaterRat
chǒu土 EarthOx
yín木 WoodTiger
mǎo木 WoodRabbit
chén土 EarthDragon
火 FireSnake
火 FireHorse
wèi土 EarthGoat
shēn金 MetalMonkey
yǒu金 MetalRooster
土 EarthDog
hài水 WaterPig

Five Elements Generating & Controlling Cycles (五行生克)

Generating (相生): Wood → Fire → Earth → Metal → Water → Wood

Controlling (相克): Wood → Earth → Water → Fire → Metal → Wood

Hidden Stems in Earthly Branches (地支藏干)

Each Earthly Branch contains one or more hidden Heavenly Stems with relative strength weights (main qi / middle qi / residual qi):

BranchMain Qi (本气)Middle Qi (中气)Residual Qi (余气)
癸 (100%)
己 (60%)癸 (30%)辛 (10%)
甲 (60%)丙 (30%)戊 (10%)
乙 (100%)
戊 (60%)乙 (30%)癸 (10%)
丙 (60%)戊 (30%)庚 (10%)
丁 (70%)己 (30%)
己 (60%)丁 (30%)乙 (10%)
庚 (60%)壬 (30%)戊 (10%)
辛 (100%)
戊 (60%)辛 (30%)丁 (10%)
壬 (70%)甲 (30%)

City Coordinates Lookup (城市经纬度)

When the user provides a birth city, resolve it to longitude (lng) and latitude (lat) using this table. Do NOT ask the user for coordinates -- look them up here automatically.

If the city is not listed, estimate from a nearby city or use a reasonable default (e.g. provincial capital).

China — Municipalities & Provincial Capitals

Citylnglat
北京116.40739.904
上海121.47431.230
天津117.20139.084
重庆106.55229.563
南京118.79732.060
杭州120.15530.274
广州113.26423.129
深圳114.05822.543
成都104.06730.573
武汉114.31630.581
西安108.94034.342
郑州113.64034.757
济南117.12136.652
沈阳123.43241.806
长春125.32443.817
哈尔滨126.53645.802
石家庄114.51538.043
太原112.54937.871
呼和浩特111.75240.841
合肥117.22731.821
福州119.29726.075
南昌115.89228.677
长沙112.93928.228
海口110.33120.022
昆明102.71525.049
贵阳106.63026.648
拉萨91.14129.646
兰州103.83436.061
西宁101.77836.617
银川106.23138.487
乌鲁木齐87.61743.826
南宁108.36722.817

China — Other Major Cities

Citylnglat
苏州120.58531.299
无锡120.31231.491
宁波121.54429.868
温州120.69928.001
厦门118.11124.480
青岛120.38336.067
大连121.61538.914
烟台121.39137.539
珠海113.57722.271
佛山113.12123.022
东莞113.75223.021
桂林110.29025.274
洛阳112.45434.620
开封114.30834.797
保定115.46538.874
唐山118.18039.631
大同113.30040.077
包头109.84040.657
齐齐哈尔123.91847.354
大庆125.10346.589

International Cities

Citylnglat
纽约-74.00640.713
洛杉矶-118.24434.052
旧金山-122.41937.775
芝加哥-87.63041.878
西雅图-122.33247.606
波士顿-71.05942.360
华盛顿-77.03738.907
伦敦-0.12851.507
巴黎2.35248.857
柏林13.40552.520
莫斯科37.61755.756
东京139.65035.676
大阪135.50234.694
首尔126.97837.567
新加坡103.8201.352
曼谷100.50213.756
悉尼151.209-33.869
墨尔本144.963-37.814
多伦多-79.38343.653
温哥华-123.12249.283

Calculation Steps

Reminder: Perform all steps below yourself using arithmetic. Do not call any tool or library.

Step 1: True Solar Time Conversion

Standard Chinese time is based on Beijing (120°E). Adjust for the birth location:

time_offset_minutes = (birth_longitude - 120.0) × 4
true_solar_time = local_time + time_offset_minutes

Step 2: Four Pillars (四柱) — Direct Arithmetic (No Library)

All four pillars are computed with arithmetic and lookup tables. Work through each sub-step in order.


2a. Year Pillar (年柱)

Use the birth year (if the birth date is before 立春 of that year, use the previous year):

year_stem_index   = (year − 4) % 10   → index into Stems list (甲=0 … 癸=9)
year_branch_index = (year − 4) % 12   → index into Branches list (子=0 … 亥=11)

Example: 1990 → stem = (1990−4)%10 = 6 → 庚 ; branch = (1990−4)%12 = 6 → 午 → 庚午年


2b. Month Pillar (月柱)

The Bazi month changes at solar terms (节令), NOT at the lunar new month. Find which month the true-solar-time date falls in using the table below, then derive the stem.

Month Branch by Solar Term:

Bazi MonthBranchSolar Term (节)Approx. Start
1立春 Start of SpringFeb 4
2惊蛰 Awakening of InsectsMar 6
3清明 Clear and BrightApr 5
4立夏 Start of SummerMay 6
5芒种 Grain in EarJun 6
6小暑 Minor HeatJul 7
7立秋 Start of AutumnAug 7
8白露 White DewSep 8
9寒露 Cold DewOct 8
10立冬 Start of WinterNov 7
11大雪 Major SnowDec 7
12小寒 Minor ColdJan 6

Month Stem — Five Tiger Trick (五虎遁年起月法):

Year StemMonth-1 (寅) starts at Stem index
甲 or 己2 (丙)
乙 or 庚4 (戊)
丙 or 辛6 (庚)
丁 or 壬8 (壬)
戊 or 癸0 (甲)
month_offset      = bazi_month_number − 1      (0 for month 1, 1 for month 2 … 11 for month 12)
month_stem_index  = (five_tiger_start + month_offset) % 10

Example: Year stem 庚 (index 6) → five-tiger start = 4 (戊). Birth in March (Bazi month 2, 卯) → month_stem = (4 + 1) % 10 = 5 → 己. Month pillar: 己卯.


2c. Day Pillar (日柱)

Use the Julian Day Number (JDN) to get a unique integer for each calendar date, then apply the fixed offset.

Step 1 — Compute JDN:

If M ≤ 2: set Y = Y−1, M = M+12
A = floor(Y / 100)
B = 2 − A + floor(A / 4)
JDN = floor(365.25 × (Y + 4716)) + floor(30.6001 × (M + 1)) + D + B − 1524

Step 2 — Day Stem-Branch:

delta            = JDN − 2415021        (2415021 = JDN of 1900-01-01)
day_stem_index   = delta % 10           (甲=0, 乙=1, … 癸=9)
day_branch_index = (delta + 10) % 12    (子=0, 丑=1, … 亥=11)

Verification anchor: JDN 2451545 = 2000-01-01 = 戊午日 (delta=36524, stem=4=戊, branch=6=午).


2d. Hour Pillar (时柱)

  1. Map the true-solar-time hour to an Earthly Branch:

    • Hour 23 or 0 → index 0 (子)
    • Otherwise → (hour + 1) // 2
  2. Derive the Heavenly Stem using the Five Rat Trick (五鼠遁) from the Day Stem:

Day Stem子时 starts at Stem index
甲 or 己0 (甲)
乙 or 庚2 (丙)
丙 or 辛4 (戊)
丁 or 壬6 (庚)
戊 or 癸8 (壬)
hour_stem_index = (zi_start_index + branch_index) % 10

Step 3: Ten Gods (十神)

The Ten Gods describe the relationship between any Heavenly Stem and the Day Master (日主 = Day Pillar's Heavenly Stem).

Algorithm — given Day Stem index d and Other Stem index o:

  1. Compute Five-Element indices: d_wx = d // 2, o_wx = o // 2
  2. Check polarity: same_polarity = (d % 2) == (o % 2)
  3. Compute relation: diff = (o_wx - d_wx) % 5
diffRelationshipSame PolarityDifferent Polarity
0Same as me比肩 (Companion)劫财 (Rob Wealth)
1I produce食神 (Eating God)伤官 (Hurting Officer)
2I control偏财 (Indirect Wealth)正财 (Direct Wealth)
3Controls me七杀 (Seven Killings)正官 (Direct Officer)
4Produces me偏印 (Indirect Seal)正印 (Direct Seal)

Step 4: Five Elements Energy Score

For each of the Four Pillars, accumulate scores:

  • Each Heavenly Stem contributes 100 points to its element
  • Each Hidden Stem in the Earthly Branch contributes its weighted score (see Hidden Stems table above)

Then apply monthly coefficients based on the Month Branch to get seasonal adjustments. The element in season gets a ~2× boost; the element controlled by the season gets ~0.5×.

Step 5: Day Master Strength (日主强弱)

Compute:

  • Allies (同党): Elements that are Same-as-me + Produces-me (比劫 + 印)
  • Opponents (异党): Elements that I-produce + I-control + Controls-me (食伤 + 财 + 官杀)

If allies score > opponents score → Day Master is Strong (身强) If opponents score > allies score → Day Master is Weak (身弱)

Step 6: Favorable & Unfavorable Elements (用神/忌神)

  • Strong Day Master needs to be drained/controlled → Favorable: Food God element, Wealth element, Officer element. Unfavorable: Seal, Companion.
  • Weak Day Master needs support → Favorable: Seal element, Companion element. Unfavorable: Food, Wealth, Officer.

Step 7: Major Fortune Cycles (大运)

  1. Determine direction: Yang-year + Male OR Yin-year + Female → Forward; otherwise → Reverse
  2. Calculate start age: Count days between birth and the next (forward) or previous (reverse) solar term (节); 3 days = 1 year
  3. Starting from the Month Pillar, step the Stem-Branch forward or backward for each 10-year cycle

Lite Interpretation Guide

Day Master Personality Profiles

Day MasterElementCore Traits
Wood (Yang)Upright, ambitious, natural leader
Wood (Yin)Gentle, resilient, adaptable
Fire (Yang)Passionate, radiant, optimistic
Fire (Yin)Meticulous, warm, patient
Earth (Yang)Honest, steady, inclusive
Earth (Yin)Gentle, responsible, nurturing
Metal (Yang)Resolute, decisive, principled
Metal (Yin)Refined, precise, persistent
Water (Yang)Intelligent, dynamic, big-picture thinker
Water (Yin)Gentle, wise, highly adaptable

Pattern (格局) Quick Guide

The pattern is determined primarily by the Ten God of the Month Pillar's Heavenly Stem:

PatternKey Characteristics
食神格 (Eating God)Creative, expressive, enjoys life
伤官格 (Hurting Officer)Talented, unconventional, outspoken
正官格 (Direct Officer)Responsible, disciplined, rule-following
七杀格 (Seven Killings)Bold, courageous, risk-taking
正印格 (Direct Seal)Wise, studious, compassionate
偏印格 (Indirect Seal)Original thinker, perceptive, solitary
正财格 (Direct Wealth)Pragmatic, good with money, reliable
偏财格 (Indirect Wealth)Flexible, opportunistic, sociable

Lucky Attributes by Favorable Element

Favorable ElementLucky ColorsLucky Direction
木 WoodGreen, TealEast
火 FireRed, PurpleSouth
土 EarthYellow, BrownCenter
金 MetalWhite, GoldWest
水 WaterBlack, BlueNorth

Output Format

When presenting results to the user, structure the output as:

  1. Birth Info — Name, date, time, location, true solar time
  2. Four Pillars Chart — Year / Month / Day / Hour pillars with Stem, Branch, Hidden Stems, Ten Gods, and Na-Yin
  3. Five Elements Analysis — Score breakdown, strongest/weakest element, missing elements
  4. Day Master Analysis — Element, strength (strong/weak/balanced), personality tags
  5. Favorable Elements — Yong Shen (用神), Xi Shen (喜神), Ji Shen (忌神), lucky colors, lucky directions
  6. Major Fortune Cycles — Start age, 10-year cycle Stem-Branch pairs

Advanced Features — Available on Compass AI

This skill covers the core calculation and basic interpretation. For a complete, AI-powered fortune experience, visit:

https://fortune.zodi.zone/web/

Advanced features include:

  • AI Deep Analysis — Full personality, career, relationship, and health analysis powered by large language models with streaming output
  • Life K-Line Chart (人生K线图) — Fortune scores from age 0 to 100, visualized as an interactive chart showing the highs and lows of each life stage
  • Two-Person Compatibility (合盘分析) — Compare two birth charts for love, business, or family compatibility with detailed energy dynamics, conflict points, and synergy analysis
  • Daily Fortune Stick (每日灵签) — Personalized daily divination based on your Bazi and the current day's energy
  • Interactive Fortune Chat (命理对话) — Multi-turn conversation with an AI fortune-teller that remembers your chart and provides deep, contextual guidance
  • Fortune Book Management (命书管理) — Save, compare, and revisit birth charts for yourself and your loved ones

Try it now → Compass AI

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

Zodi AI Bazi

Chinese Bazi (八字) four-pillar fortune calculation and basic interpretation — enables AI agents to compute and read a birth chart using traditional Zi-Ping me...

Registry SourceRecently Updated
0101
Profile unavailable
General

liuyao-xueer

雪儿六爻占卜技能。当用户提到「六爻」「占卜」「起卦」「解卦」「易经」「问卦」时激活。打开一个古风水墨界面,由玄猫雪儿为用户摇卦、解卦,支持接入大模型进行精准六爻解读。

Registry SourceRecently Updated
037
Profile unavailable
General

MBTI Fortune Teller — Ask Anything

MBTI算命师。用户提任何问题,随机抽取一个MBTI类型,用认知功能栈解读答案。触发词:「MBTI算命」「帮我算」「问一卦」「抽个MBTI」「XX会不会」「XX喜不喜欢」「XX是什么类型」。

Registry SourceRecently Updated
014
Profile unavailable