Overview
This skill takes the verified content in this repositorychart-casting rules, prompts, and chart context formatand hands them to any agent: it can generate chart context from Gregorian birth data, then outputa single HTML file, containing three sections: "Comprehensive Commentary / Annual Fortune / Life K-Line".
Chart-casting strategy (recommended priority: no Node + true solar time)
| Path | Command essentials | Dependencies | True solar time |
|---|---|---|---|
| A. Pure Python (default recommendation) | python3 tools/ziwei_offline.py --solar ... --time ... --gender ... [--birthplace ...] |
Python 3 only, no Node / npm | Enabled by default: when longitude/latitude are available or can be parsed birthplace , convert by longitude + equation of time before determining the lunar calendar and double-hour;--disable-true-solar-time can be turned off |
| B. iztro-aligned App stars | First use Python to output the "Gregorian time after true solar time correction", then feed it to iztro, then assemble the context (see below) | This directory npm install + Node.js |
can be consistent: use --emit-iztro-birth-json to inject the true solar time convention into iztro |
| C. iztro clock time only (consistent with the App input field) | IZTRO_MODE=raw-clock or directly connect to chart_iztro.cjs --solar --time |
Node + npm | No(same as when the user only fills in clock time in the App) |
Conclusion: if you wantto leave Node behind → use only Path A(already includes true solar time). If you wantmain stars consistent with the App/iztro and still want true solar time → use Path B(cannot avoid Node, because iztro is a JS library), and cannot be replaced by a "zero-dependency static file".
Path B one-click(environment variables; requires existing npm install):
cd skills/ziwei-ai-html-report
SOLAR=1995-07-19 TIME=11:40 GENDER=male BIRTHPLACE="广东省深圳市" TARGET_YEAR=2026 ./tools/report_payload_iztro.sh
Path B step by step(true solar → iztro → context):
python3 tools/ziwei_offline.py --solar 1995-07-19 --time 11:40 --gender male \
--birthplace "广东省深圳市" --target-year 2026 --emit-iztro-birth-json \
| node tools/chart_iztro.cjs --birth-json - \
| python3 tools/ziwei_offline.py --from-chart-json --target-year 2026 --format json
--emit-iztro-birth-json outputs one line of JSON (solarDate、time、gender、trueSolarApplied),chart_iztro.cjs --birth-json - reads from stdin; Python then fills in patterns, validation, and the three Contexts.
Path C(no true solar time, pure clock-time iztro):IZTRO_MODE=raw-clock ./tools/report_payload_iztro.sh -- ... or the old-style node chart_iztro.cjs --solar ... | python3 ... --from-chart-json。
Pure Python:tools/ziwei_offline.py(standard library). Gregorian range 1900-01-31 to 2100-12-31. Path A is a self-developed star-placement implementation,and may still differ from iztro on individual charts; to use iztro as the standard, use Path B/C.
Core constraint: violating the letter is violating the intent—do not skip input validation or disclaimers because of "saving time" or "the user is in a hurry".
For the complete prompts and templates, see the same directory:prompts.md. For the HTML boilerplate, see:report-template.html。
Prerequisites (simplified)
This skill runs in an agent environment, and by default a model is already available to participate in interpretation generation.
Therefore this document focuses on: offline chart-casting facts, prompt structure, and HTML delivery consistency, and does not repeat model availability details.
When to Use
- Needs to output in any chat model / agent environmentan offline-openablefortune-telling report;
- The user only provides the Gregorian birthday, birth hour, gender, and analysis year, and cannot or is unwilling to install additional runtime dependencies;
- The user has already pastedthis-life AI context(and the annual fortune block, if an annual fortune section is made), it is hoped to directly assemble the report;
- The deliverable must bea single-file HTML(convenient for saving, emailing, and sharing via cloud storage).
When NOT to Use
- The user's birth date is outside 1900-2100 and no lunar calendar/chart context can be provided — the current offline calendar table cannot cover it;
- Only compatibility charting is needed: the current release does not include a compatibility section; if needed, please add a separate prompt section in this directory;
- The user only wants to view it within an existing product UI, rather than deliver an offline HTML.
Input contract (required / optional)
A. Birth information (preferred, can chart independently)
Minimum input:
| Field | Description |
|---|---|
| Gregorian date | YYYY-MM-DD, range 1900-01-31 to 2100-12-31 |
| Birth time | HH:mm(recommended) or hour(0-23);23:00-23:59 use late zi hour day change |
| Gender | male/female or male/female |
| Birthplace | Optional; used for true solar time conversion, default hybrid mode prioritizes online geocoding, falls back to the built-in city table on failure |
| Annual analysis year | Optional, defaults to the current year |
Age convention: for major limits and annual overlaying palaces, usenominal age(分析年 − 农历生年 + 1). The report header and annual context will both indicateactual age(as of December 31 of the analysis year, and as of the generation date if different from year-end).
Run the tool to generate context:
python3 tools/ziwei_offline.py \
--solar 1996-01-06 \
--time 11:30 \
--gender female \
--birthplace "广东省佛山市顺德区" \
--target-year 2026 \
--format json
The output JSON contains:
| Field | Purpose |
|---|---|
chart |
Offline structured chart data |
natalContext |
Comprehensive annotation user context |
yearlyContext |
Annual fortune user context |
klineData |
Deterministic life K-line data, directly embedded into HTML |
klineContext |
K-line text interpretation context; must not be used as a source of numeric trends |
Standard example (display layer):
- Gregorian birthday: January 6, 1996
- Lunar birthday: may be left blank (calculated automatically by the system)
- Birth time: 11:30
- Gender: female
- Birthplace: Shunde District, Foshan City, Guangdong Province
Corresponding machine fields:
solar=1996-01-06time=11:30(orhour=11)gender=femalebirthplace=广东省佛山市顺德区targetYear=2026(optional)
B. Natal context (alternative)
Under this skill's Zhongzhou school rules, any one of the following is consideredvalid natal input:
- Preferred: Markdown text equivalent to this tool's
build_prompt_contextoutput (starting with【命盘完整信息】, including## 十二宫星曜分布、## 十二大限, optionally including## 近年流年信息, etc.). - Alternative: structured JSON (can be restored to the same Markdown as above). Minimum field mapping:
| Field | Meaning |
|---|---|
命宫主星 |
{ name, group?, description? }[], at least name |
身宫主星 |
same as above |
身宫位置 |
Palace name string |
十二宫 |
{ name, stem, majorStars[], minorStars[], adjectiveStars?, isBodyPalace?, decadalRange? }[] |
大限 |
{ palaceName, ageRange, stem, mutagens[] }[] |
流年 |
{ year, stem, branch, mutagens[], palaceName }[](may be an empty array) |
四化分布 |
{ star, sihua: { name, effect }, palace }[] |
格局提示 |
string[] |
If the birth date is outside the offline tool's range and the above content is unavailable:Stop generating judgments, ask the user to supply reliable context, or output HTML containing only an "insufficient information statement" (do not fabricate stars).
Annual fortune section (if the HTML contains an "Annual Fortune")
If using the offline tool, directly use the output yearlyContext. If the user provides context, then in addition to the natal context, you must also [Annual Chart Information] block: annual heavenly stems and earthly branches, annual four transformations, annual life palace; current major limit heavenly stems and earthly branches and four transformations; key palace stars.Prohibitedto fabricate stacked palaces based solely on the Gregorian year.
K-line section
By default, use the offline tool's output klineData as the numerical source, directly fill into report-template.html in #kline-data。klineContext is only used to generate reason/brief and other textual supplements; the model must not freely decide open/high/low/close。
Numerical standard (schematic score, peak scarcity):tools/ziwei_offline.py First calculate the raw score for ages 1-100, then perform relative mapping across the entire lifespan; closing upper limit is about 98, maximum can reach 100(constant KLINE_CLOSE_CAP / KLINE_HIGH_CAP), allowing a few of the strongest years to approach full score, but long stretches near the ceiling should be avoided. Validation allows ∈ [0,100].
Path A brightness: Pure Python chart calculation will write in for the main stars 庙/旺/得/利/平/不/陷 brightness (aligned with iztro STARS_INFO), and is used for K-line scoring and HTML chart display. Path B can still be used for App/iztro alignment verification.
Each klineData contains:age/year/ganZhi/daYun/daYunRange、OHLC、score、dimensions(career/wealth/relationship/health),yearlyMutagens; after merging kline-brief.json , can add brief, optional reason。
Report page interaction:report-template.html Under the K-line chart, providehover detailsandan expandable 1–100 age numerical table; users can view each year's number and brief comment without separately checking JSON. The annual long-form text is still in the "Annual Fortune" section.
Product alignment (calendar and school)
Consistent with this directory's rule baseline (see docs/rules-baseline.md):Zhongzhou school, dividing years/fortune limits by the first day of the first lunar month,23:00 late zi hour day change.Must notswitch to Start of Spring or other schools without explanation.
Time standard:
- Default fixed UTC+8(no historical daylight saving time retrospection);
- If longitude and latitude are provided or the birthplace can be parsed, true solar time will be used:
标准时 + 经度修正 + 时间方程; - CLI default
--geocode-mode hybrid: online first, on failure fall back totools/cn_locations.json, then on failure fall back to standard time; - If fully offline is required, you may explicitly pass
--geocode-mode offline; if reproducible coordinates are required, prefer passing--longitude/--latitude; - If usable longitude and latitude are missing, fall back to standard time and give a prompt in the output.
Offline tool built-in:
- 1900-2100 Gregorian-to-lunar compressed table;
- life palace/body palace, twelve palaces, five tiger escape palace stems, five element bureau;
- Ziwei/Tianfu and the fourteen main stars;
- Zuofu Youbi, Wenchang Wenqu, Kui Yue, Lucun Yangtuo, Huo Ling, Kong Jie;
- birth-year four transformations, major limits, target annual context.
Currently intentionally conservative:
- does not rely on the brightness system of external charting libraries; brightness in the output may be empty;
- does not claim 100% consistency with any commercial charting tool unless later aligned item by item using samples.
Execution steps (agent)
- Validate input: If birth data is available, first run
tools/ziwei_offline.pyto generate JSON; if context already exists, confirm the presence ofnatalContextequivalent text andyearlyContext。 - chart self-check: Confirm the JSON contains
chart.palaces12 palaces,fiveElementsClass、natalContext、yearlyContext、klineContext、klineData。 - Render prompt (recommended): Run
tools/render_prompts.py --payload-json payload.json --out-dir work --work-root work, readprompt-manifest.json;do not transcribe by hand prompts.md, use the rendered file as the sole injection source. - Model-generated output:
natal.html: useprompts/natal.system.md+natal.user.md;yearly.html: useyearly.system.md+yearly.user.md;kline-brief.json: usekline.system.md+kline.user.md, may only returnage/brief/reason, must not return or rewriteopen/high/low/close。
- K-line: values must use the offline tool's output
klineData; if textual explanation is needed, only merge the model-generatedbrief/reasoninto the corresponding age. - K-line self-check(must not be written into HTML before correction):
- Exactly 100 entries,
ageis 1–100 each appearing once; age===1whenopen === 50;- for
age>1:openand the previous entry'scloseare numerically consistent (tolerance 1e-6, or equal to two decimal places); high >= max(open,close),low <= min(open,close), and all values ∈ [0,100]; near full marks there should be a few peaks, do not artificially change it into a long stretch at the maximum.
- Exactly 100 entries,
- Assemble HTML: use
tools/generate_report.pyand report-template.html to assemble; formal delivery prohibits--skip-validation. Page order is fixed:Zi Wei chart → Zi Wei comprehensive chart annotation → Annual fortune → Life fortune K-line(including hover/table lookup of each year's OHLC and brief) → data integrity status. Fill the chart JSON intoscript#chart-data, fill the comprehensive/annual main text into the corresponding#content-*, embed the merged K-line JSON intoscript#kline-data; the footer retains thedisclaimer。 - Output: deliver to the usercomplete
<!DOCTYPE html>document (can be copied as a.htmlfile and opened directly by double-clicking).
Run mode
Mode A: Model enhancement (recommended)
- Use the offline tool to obtain
natalContext/yearlyContext/klineData/klineContext; - use
render_prompts.pyto generate the prompt file andprompt-manifest.json; - obtain the comprehensive annotation, annual main text, and optional
kline-brief.json, then usegenerate_report.pyto assemble the HTML; - K-line values are generated by the tool and pass strict validation; the model may only supplement text, and must not change the trend values.
Quick Reference
| Report section | System prompt source | User data source |
|---|---|---|
| Chart context | tools/ziwei_offline.py |
Gregorian date + hour + gender + analysis year |
| Comprehensive annotation | prompts.md Section 1 | natalContext |
| Annual fortune | prompts.md Section 2 | natalContext + yearlyContext |
| Life K-line | Offline tool deterministic scoring | klineData(values) + klineContext(text reference) |
Baseline Pressure Scenarios (common failures when there is no skill)
Recorded for self-checking whether the skill is followed:
| Scenario | Common erroneous behavior |
|---|---|
| Only birthday and gender | Do not run the offline tool and directly write the life palace main star and interpretation |
| User urging | Skip the K-line JSON continuity validation, or let the model replace the deterministic K-line values |
| Environment inertia | Still force when only the Python path is needed npm install / iztro (path A does not want Node) |
| Delivery format | Only provide a Markdown fragment, not a single-file HTML |
| School | Change on your own to using Lichun for the year change |
Red Flags — STOP & Realign
- There is birth data but
tools/ziwei_offline.pywas not run before producing specific star placements; - The offline tool reports an error (date out of range/missing input) but the interpretation continues;
- K-line
open[n] ≠ close[n-1]is still stored; - There is
klineDatabut it switches to free model-generatedopen/high/low/close; - Delete or rewrite the disclaimer to "look better";
- List
npm、iztroor Node asrequiredto complete the report (pure Python is available by default; iztro is optional only when aligning with App star placements).
Rationalization Table
| Excuse | Fact |
|---|---|
| "It can roughly derive the life palace" | The offline tool must be run or reliable context must be read |
| "The user has no time to open the app" | This is exactly the scenario for using the offline tool |
| "Markdown is more convenient for the user" | This skill explicitly requires a single-file HTML |
| "Validate the K-line after testing" | It must be validated before writing into the template |
| "The model understands trends better" | The model is only suitable for supplementary description; numerical trends must come from the deterministic scoring tool |
| "A descriptive sentence can replace the disclaimer" | The wording consistent with reference-only and do-not-be-attached in the prompt must be retained |
Common Mistakes
- Treat raw JSON outside HTML as the final deliverable;
- Chart casting: hand-write star placements instead of running
tools/ziwei_offline.py; - Annual fortune: missing major-limit anchor or
yearlyContextyet still writing overlays; - K-line: prefer embedding the tool output's
klineData;yearfield; if filled in, it should be consistent withbirthYear + age - 1; - Repeatedly paste the full system prompt in the skill body—should reference prompts.md to maintain a single source of truth.