| name | bazi-engineering |
| description | Build, debug, compare, or integrate Bazi/Four Pillars software and Codex skills. Use when users ask to create a 八字 skill, research GitHub open-source 八字排盘 projects, implement 节气/立春换年/子时换日/大运 logic, validate 八字 calculation accuracy, or connect reliable Bazi data into an AI agent or MCP server. Prefer established calendar engines such as 6tail lunar-* or tyme4ts over hand-written approximate scripts. |
Bazi Engineering
This skill is for software work around Bazi, not only for interpretation.
If the task is mainly命理解读, use this skill together with bazi-mingli. If the task is mainly engineering, repo selection, calculation accuracy, or agent integration, this skill should lead.
Core Rule
Do not trust hand-written Bazi calculators that hard-code approximate solar-term dates.
Red flags:
- fixed tables such as
2/4 = 立春, 3/6 = 惊蛰
- month pillar logic that does not use actual solar terms
- year pillar logic that only checks Gregorian year
- no explicit handling for
23:00-23:59 day-boundary sect differences
- no note about local civil time vs timezone/longitude correction
For serious calculation, prefer a maintained calendar engine.
Preferred Stack
Use these layers separately instead of treating them as the same thing:
- Calculation engine
- Interpretation rules
- Agent or MCP interface
- Product UI
Recommended defaults:
- Core engine:
6tail/lunar-python, 6tail/lunar-javascript, or 6tail/tyme4ts
- Agent interface reference:
cantian-ai/bazi-mcp
- UI/product reference:
axbug/8Char-Uni-App
- Interpretation-heavy CLI reference:
china-testing/bazi
When you need a local calculator in this skill, use scripts/calc_bazi.cjs.
Local Workflow
Skill root:
/Users/zhangzhaoyang/.codex/skills/bazi-engineering
Install dependencies if needed:
cd /Users/zhangzhaoyang/.codex/skills/bazi-engineering
npm install
Run the regression tests:
cd /Users/zhangzhaoyang/.codex/skills/bazi-engineering
npm test
Run the local calculator with Gregorian local civil time:
node /Users/zhangzhaoyang/.codex/skills/bazi-engineering/scripts/calc_bazi.cjs --solar "1998-07-31 14:10:00" --gender male --sect 2
Run with lunar local civil time:
node /Users/zhangzhaoyang/.codex/skills/bazi-engineering/scripts/calc_bazi.cjs --lunar "1998-06-09 14:10:00" --gender male --sect 2
Notes:
sect 1: treat 23:00-23:59 as the next day
sect 2: treat 23:00-23:59 as the same day
- input time should be the birth location's local civil time
- this skill does not do true solar time correction by longitude unless the user explicitly asks for that feature
Discussion Framework
When discussing a repo or implementation, separate the evaluation into:
排盘准确性
规则透明度
工程可复用性
是否适合接入 Codex / MCP
Good deep-dive questions:
- Which engine computes solar terms exactly, and which only approximates?
- How does the implementation handle
立春换年?
- How does it handle
节气换月?
- Does it expose a configurable
sect for late-zi-hour day changes?
- Can it return structured data for hidden stems, ten gods, Na Yin, Xun Kong, and Da Yun?
- Is the code suitable as a library, or only as an end-user app?
Repo Research
When the user asks for GitHub options, read references/open-source.md and then verify current repo activity before recommending.
Do not recommend a single repo blindly. Usually give a layered answer:
- best calculation engine
- best ready-made MCP/server layer
- best UI/product reference
- best interpretation-heavy reference
Deliverable Style
For software tasks, avoid mixing metaphysical interpretation with calculation certainty.
Use wording like:
这是排盘层的确定结果
这是某一流派的解释,不是历法层的硬规则
这里的风险不在命理观点,而在节气/换日实现