AI Agent Hub
Back to skills
Bazi Paipan Calculator icon

Bazi Paipan Calculator

Life Service Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please refer to https://skillhub.cn/install/skillhub.md to install @user_1854b633/bazi-paipan.

About this skill

Solving the Problem

BaZi Paipan is a vital tool in traditional Chinese astrology for analyzing destiny based on birth time, deriving the Four Pillars of Destiny to assess Five Elements balance, life patterns, and fortune trends. Manual calculation involves intricate conversions of Heavenly Stems and Earthly Branches, solar term calibration, and void computation, which is cumbersome and error-prone. This skill offers an automated script to directly generate structured results from user inputs, eliminating manual lookups and calculations.

Core Capabilities and Workflow

The core of this skill is the Python script bazi_calculator.py, which depends on the data file bazi_data.py in the same directory. It requires no third-party libraries and supports Python 3.7+. The workflow involves three steps:

  1. Information Collection: Users must provide birth time (format YYYY-MM-DD HH:MM) and gender (male/female). Optional parameters include birthplace (default Beijing), name, and flow year. The script handles missing optional parameters by applying defaults.

  2. Calculation Execution: The script is invoked via command line, for example:
    bash python bazi_calculator.py --time "1990-05-15 08:30" --gender male
    It performs the following calculations:
    - True Solar Time Adjustment: Automatically corrects birth time.
    - Four Pillar Generation: Computes the Heavenly Stems and Earthly Branches for Year, Month, Day, and Hour pillars.
    - Five Elements Analysis: Quantifies the strength of Metal, Wood, Water, Fire, and Earth.
    - Ten Gods Derivation: Determines Ten Gods based on relationships between the Day Master and other pillars.
    - Void Calculation: Processes void branches according to the sixty Jiazi cycle principles.

  3. Output and Interpretation: The script produces a JSON file with top-level keys like bazi (Eight Characters), five_elements (Five Elements), and dayun (Great Cycles). Users can read the JSON and interpret in the following order:
    - Birth Chart Overview: Displays Four Pillars, Day Master, and Five Elements statistics.
    - Pattern Judgment: Identifies life patterns based on Five Elements and Ten Gods distribution.
    - Great Cycles Trends: Analyzes the current Great Cycle's Ten Gods and auspicious/inauspicious directions.
    - Flow Year Analysis: Examines interactions between flow year pillars and Four Pillars, including clashes and combinations.
    - Special Stars Highlights: Lists influences of stars like Nobleman, Literary Star, and Peach Blossom.

Output can be directed to a file via the --output parameter; otherwise, it defaults to the console.

Application Scenarios and Considerations

This skill is suitable for developers or astrology enthusiasts who need quick BaZi Paipan results, particularly for integration into automated analysis tools. Key considerations include:

  • Precision: True solar time is automatically adjusted, and solar terms are calculated with a simplified VSOP87 algorithm, ensuring accuracy within ±1 minute.
  • City Support: It pre-supports 38 major cities (e.g., Beijing, Shanghai, Chengdu) for time zone and longitude/latitude calculations; for unsupported locations, provide longitude/latitude (e.g., --location "104.06,30.67") as an alternative.
  • Flow Year Definition: Flow year pillars are determined based on the Start of Spring, not the Gregorian New Year.
  • Dependencies: The script has no external dependencies but requires Python 3.7 or higher.
  • Interpretation Limits: The JSON output provides structured data, but final astrological interpretation requires domain expertise; the script handles computation only, not in-depth analysis.

In summary, this skill transforms the complex BaZi Paipan calculation into a parameterized call, ideal for batch processing or rapid prototyping in technical contexts.

Use Cases

  • In personal life planning, users input birth time and gender to generate a Bazi chart, analyzing Five Elements strength and destiny trends for decision support.
  • In software development, developers integrate BaZi calculation into web or mobile apps, using the script's structured JSON output for backend automation of user requests.
  • In astrology education or research, researchers batch compute Bazi charts for multiple birth data, conducting comparative analysis to explore astrological patterns and regularities.

Best For

  • Astrology analysts who need to quickly calculate clients' Bazi charts to provide personalized destiny interpretation and consultation services.
  • Mobile app developers aiming to embed BaZi chart functionality into apps to enhance the appeal of cultural or life service modules.
  • Traditional culture researchers for verifying or extending Bazi astrology knowledge, supporting academic or teaching work.