八字 + 紫微斗数 AI 排盘与综合分析。当用户提供生辰(阳历/农历日期、时辰、性别)询问八字、紫微、命理、命盘、流年大运相关问题时使用。基于 Yiqi 算法库 + enrichBazi 补全层精准排盘(杜绝 LLM 自行排盘出错),支持按需独立分析八字 / 独立分析紫微 / 两盘交叉印证。
npx skills add https://github.com/dzcmemory-web/bazi-ziwei-skill --skill bazi-ziwei
用户场景:
不触发:单纯的星座 / 塔罗 / 周公解梦 / 风水 / 姓名学。
公历或农历日期 (YYYY-MM-DD)
出生时刻 (HH:MM, 24 小时制)
性别 (男/女)
若用户没给时辰,必须主动询问,不要默认子时。时辰对四柱日柱和紫微命宫影响极大。
> 不需要出生地。排盘直接使用钟表时间,不做真太阳时经度校正。
问题 1:要看哪种命理?
> "我可以做三种分析:
> 1. 八字独立分析(事业 / 财运 / 婚恋 / 子女 / 六亲 / 健康,按八字格局推演 — 长文输出)
> 2. 紫微独立分析(十二宫 + 大限 + 生年四化 + 流年 — 长文输出)
> 3. 八字 + 紫微综合印证(两盘交叉对账 — 提供长文 / 可视化海报 / 两种都要)"
如果用户选 3,再追问问题 2:呈现形态
> "综合印证可以这样输出:
> A. 📜 长文深度版(Markdown 散文,沉浸阅读)
> B. 🎴 结构化海报版(单文件 HTML,可截图分享)
> C. 两种都要"
根据选择加载相应提示词和模板:
| 用户选 | 加载提示词 | 模板 | 输出 |
|---|---|---|---|
| 1 | prompts/bazi-prompt.md | — | Markdown 对话回复 |
| 2 | prompts/ziwei-prompt.md | — | Markdown 对话回复 |
| 3 + A | prompts/zonghe-yinzheng-prompt.md | — | Markdown 对话回复 |
| 3 + B | prompts/zonghe-poster.md | templates/report-zonghe-poster.html | <name>-zonghe.html |
| 3 + C | 上述两份都跑 | 同上 | Markdown + HTML 两份 |
> 海报模板仅综合印证一种。八字独立 / 紫微独立只有长文输出(用户深度阅读用)。这是经过设计的——海报是综合印证独占的杀手锏,承担社交分享 + 用户惊艳的角色。
绝对不要让 AI 自己排八字或紫微。必须调用算法层脚本:
cd calculator
node dist/run-chart.js --year=YYYY --month=MM --day=DD --hour=HH --minute=MM --gender=male > chart.json
注意:run-chart.ts 的 stdout 是纯 JSON,stderr 是 debug 信息。重定向时只取 stdout(> chart.json),不要 2>&1。
脚本输出 JSON:
bazi:四柱 / 十神 / 星运 / 自坐 / 纳音 / 藏干 / 大运(含 startAge/endAge/startYear/endYear)bazi.enrichment:格局 / 旺衰 / 调候 / 五行旺相 / 五行统计 / 天干关系 / 地支关系 / 整柱判定ziwei:十二宫 / 生年四化 / 大限 / 阴阳 / 五行局 / 命主身主> 关键约束:纯 LLM 排盘会错排日柱 → 日主 → 格局 → 用神,全链失真。Case B 测试证明 DeepSeek/Gemini 自行排盘均出错。算法层不可绕过。
LLM 读 JSON 不如读结构化文本。把 Step 1 的 JSON 转成文墨天机风格的树状文本:
node dist/dump-text.js --input=chart.json --output=chart.txt
文本盘包含:
将 chart.txt 内容连同对应提示词一起送给 LLM 做分析。
读取对应长文提示词(bazi-prompt.md / ziwei-prompt.md / zonghe-yinzheng-prompt.md),喂入 chart.txt,输出 Markdown 长文。
> 综合印证(3+A)的前置条件:先跑八字 + 紫微独立分析拿到中间报告,再喂给 zonghe-yinzheng-prompt.md。
> 如输出被截断,分段输出。
prompts/zonghe-poster.md,喂入 chart.txt{ 开头",照办即可analysis.json cd calculator
node dist/render.js \
--chart=chart.json \
--analysis=analysis.json \
--template=../templates/report-zonghe-poster.html \
--output=<user-name>-<date>.html \
--currentYear=<YYYY>
> 重要:海报版的视觉由 HTML 模板决定,LLM 只产数据不产 HTML。如果 LLM 输出含 markdown 包装(如 \\\json … \\\),渲染前需剥掉。
装好 Skill 后不要主动跑任何验证 / 自检命令。 不要试 Smoke Test、不要排示例盘、不要分析示例命主。装好就是装好,等用户来给生辰再开始工作。
> 自检命令在 TEST-GUIDE.md 中由人工按需运行,不在 Agent 的职责范围内。Agent 主动跑会浪费 token + 触发上下文压缩。
依赖检查(仅在用户首次提供生辰、Agent 准备跑 run-chart.ts 报错时):
cd <skill-root>/calculator
ls node_modules >/dev/null 2>&1 || npm install
也就是说,依赖问题报错时再修,不要装好就主动检查。
├── SKILL.md ← 本文件
├── calculator/
│ ├── run-chart.ts ← 入口:生辰 → JSON(stdout 纯 JSON / stderr debug)
│ ├── dump-text.ts ← JSON → 文墨天机风文本
│ ├── render.ts ← 渲染脚本:chart.json + analysis.json + 模板 → HTML
│ ├── package.json ← 算法层依赖声明
│ ├── yiqi-core/ ← Yiqi 算法(已 vendored 入库,无外部依赖)
│ └── bazi-enrich/ ← enrichBazi 补层(格局/旺衰/调候/关系/整柱)
├── prompts/
│ ├── bazi-prompt.md ← 八字独立分析(长文)
│ ├── ziwei-prompt.md ← 紫微独立分析(长文)
│ ├── zonghe-yinzheng-prompt.md ← ⭐ 综合印证(长文)
│ └── zonghe-poster.md ← ⭐ 综合印证(海报版 JSON 输出)
├── templates/
│ └── report-zonghe-poster.html ← 综合印证海报模板(占位符)
└── fixtures/ ← 7 个验证案例(Case A-G)
注:HTML 渲染目前仅支持综合印证模式。如用户选了八字独立 / 紫微独立又问"能不能出 HTML 报告",告知"目前 HTML 海报仅对综合印证开放,建议选综合印证(含八字+紫微)以拿到海报"。
用户:我是 2000 年 1 月 1 日 12:00 出生的男生,帮我看下命盘。
Skill 应该走:
run-chart.ts 产出 chart.jsondump-text.ts 产出 chart.txtprompts/bazi-prompt.md + 喂入 chart.txt → 输出八字分析| 现象 | 原因 | 处理 |
|---|---|---|
| 排盘脚本报错 | 日期超 1900-2100 / 时辰格式错 | 询问用户校正 |
| AI 想"凭记忆排盘" | 偷懒走捷径 | 拒绝。算法层是不可绕过的硬约束 |
| 输出被截断 | 三段一锅出超 token 上限 | 回到决策门,拆分输出 |
| 算法层和用户其他软件结果不一致 | 命名流派差异(建禄格 vs 比肩格) | 按算法层 notes 解释,不偷换说法 |
| Windows + 中文路径 + PowerShell 编码错乱 | 平台特性 | 在 cmd / git bash / WSL 下运行,避免 PowerShell |
> 本分析基于传统八字与紫微斗数理论框架,仅供文化研究与娱乐参考,不构成医疗、投资、婚姻、法律等任何决策依据。命运由个人选择与客观环境共同塑造。
Integration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io functionality into workflows. Applicable for protocol discovery, collaborative protocol development, experiment tracking, lab protocol management, and scientific documentation.
Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances
Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.
Build and distribute Expo development clients locally or via TestFlight
Use when you have a written implementation plan to execute in a separate session with review checkpoints
Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.
Benchling R&D platform integration. Access registry (DNA, proteins), inventory, ELN entries, workflows via API, build Benchling Apps, query Data Warehouse, for lab data management automation.
Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.
Take dzcmemory-web/bazi-ziwei from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npm.
Without those the skill loads but fails at the first command.