← 返回 Skills 市场
cnyouker

循古黄历

作者 cnyouker · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
45
总下载
1
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install xungu-huangli
功能描述
循古黄历 - 获取中国万年历信息,包括二十四节气、农历日期、佛历、道历、月相、黄道吉日、每日宜忌、建除十二神、黄黑道值日、二十八星宿、胎神占方、三元九运方位以及逐时吉凶查询。当用户询问节气、农历、日子好坏、宜忌、黄历相关问题时使用此技能。
使用说明 (SKILL.md)

循古黄历

基于 循古排盘 提供的老黄历查询服务

循古排盘介绍

循古排盘 是一个提供传统黄历查询的在线工具,支持:

  • 万年历查询:公历/农历转换、二十四节气
  • 每日宜忌:吉凶宜忌、黄道吉日
  • 干支历法:年月日时四柱八字
  • 月相/道历/佛历:传统历法参考

适用于择日选吉、历法研究、传统文化应用等场景。

使用场景

当用户询问以下内容时使用:

  • 二十四节气相关问题
  • 农历日期
  • 今日/某日宜忌
  • 吉凶查询
  • 黄道吉日
  • 每日指南
  • 干支历/月相/道历/佛历

数据来源

使用 API 获取万年历数据:

https://cdndns.org/huangli/api/calendar

认证方式:标准 Bearer Token 认证

Token 通过 OpenClaw 配置注入,键名 HUANGLI_API_TOKEN

重要规则:

  • 查询今天https://cdndns.org/huangli/api/calendar不加 date 参数
  • 查询特定日期https://cdndns.org/huangli/api/calendar?date=YYYY-MM-DD (加 date 参数)

配置

首次使用前,需设置环境变量 HUANGLI_API_TOKEN

方法 1:.env 文件(推荐)

在 OpenClaw 工作目录下创建或编辑 .env 文件:

HUANGLI_API_TOKEN=your_token_here

方法 2:环境变量

export HUANGLI_API_TOKEN="your_token_here"

获取 Token:访问 cdndns.org 注册获取 API Token

返回格式

调用 API 后,用以下 Python 格式化输出(不要省略任何内容):

import json
import urllib.request

import os
from pathlib import Path

def _load_env():
    """从 .env 文件加载环境变量(如果尚未注入)"""
    if os.environ.get('HUANGLI_API_TOKEN'):
        return
    env_paths = [
        Path.home() / '.openclaw' / '.env',
        Path.cwd() / '.env',
    ]
    for p in env_paths:
        if p.exists():
            for line in p.read_text().splitlines():
                line = line.strip()
                if not line or line.startswith('#'):
                    continue
                if '=' in line:
                    k, v = line.split('=', 1)
                    k, v = k.strip(), v.strip()
                    if k and k not in os.environ:
                        os.environ[k] = v
            break

def get_calendar(date=None):
    _load_env()
    token = os.environ.get('HUANGLI_API_TOKEN')
    if not token:
        return '❌ 未配置 HUANGLI_API_TOKEN 环境变量,请在 ~/.openclaw/.env 中设置'
    url = "https://cdndns.org/huangli/api/calendar"
    if date:
        url += f"?date={date}"
    headers = {
        'Authorization': f'Bearer {token}',
        'User-Agent': 'Mozilla/5.0'
    }
    req = urllib.request.Request(url, headers=headers)
    data = json.loads(urllib.request.urlopen(req).read())

    s = data['solar']
    l = data['lunar']
    g = data['ganzhi']
    h = data['huangli']
    tao = data['tao']
    buddha = data['buddha']

    # 干支格式:丙午 辛巳 甲申(不要年日月日)
    ganzhi = f"{g['year']} {g['month']} {g['day']}"

    # 道历:取年
    tao_year = tao.get('year_chinese', '')

    # 佛历:加"年"字
    buddha_year = f"{buddha.get('year_chinese', '')}年{buddha.get('month_chinese', '')}{buddha.get('day_chinese', '')}"

    result = f"""📅 今日黄历
───────────────────────────────────
公历: {s['date']} {s['week']} {s.get('xingzuo', '')}
农历: {l['date']}
干支: {ganzhi}
───────────────────────────────────
🟢 宜: {h['yi']}

🔴 忌: {h['ji']}

⏰ 吉时: {h['good_hours']}
🐲 冲煞: {h['chong_sha']}
🌙 月相: {l.get('yue_xiang', '')}
📿 道历: {tao_year}
☸️ 佛历: {buddha_year}"""

    if data.get('jieqi'):
        result += f"\
❄️ 节气: {data['jieqi']}"

    return result

注意

  1. Token 使用占位符 \x3CHUANGLI_API_TOKEN>,实际调用时需替换为用户配置的真实 Token
  2. 干支格式必须是 丙午 辛巳 甲申,不要带"年/月/日"字样
  3. 宜忌等信息必须完整输出,不要用"..."省略

使用示例

用户问:"今天日子好吗" -> 调用 get_calendar() 返回格式化后的黄历

用户问:"明天黄历" -> 调用 get_calendar("2026-03-12") 返回次日黄历

输出格式要求(重要)

黄历输出必须包含以下完整字段,不得省略:

📅 今日黄历
───────────────────────────────────
公历: YYYY-MM-DD 星期X 星座
农历: 二〇XX年X月XX
干支: XX XX XX(年月日三柱,如:丙午 辛卯 丁亥)
───────────────────────────────────
🟢 宜: xxx, xxx, xxx

🔴 忌: xxx, xxx, xxx

⏰ 吉时: XX (HH:MM - HH:MM), XX (HH:MM - HH:MM)...
🐲 冲煞: 冲(xx)X 煞X
🌙 月相: xxx
📿 道历: xxxx
☸️ 佛历: xxxx年Xxxx

特别注意:干支历(年月日三柱)必须完整输出,不可省略。

安全使用建议
Before installing, make sure you trust cdndns.org enough to use its Huangli API and provide a dedicated HUANGLI_API_TOKEN. Avoid sharing broad or unrelated credentials in the same .env files used by automation tools.
功能分析
Type: OpenClaw Skill Name: xungu-huangli Version: 1.0.0 The 'xungu-huangli' skill is a legitimate tool for fetching Chinese traditional calendar data from cdndns.org. The included Python code in SKILL.md retrieves a user-provided API token from environment variables or a local .env file and performs a standard authenticated GET request to the service's API. The logic is transparent, uses standard libraries (urllib, json, os), and contains no indicators of malicious intent, prompt injection attacks, or unauthorized data exfiltration.
能力标签
requires-oauth-tokenrequires-sensitive-credentials
能力评估
Purpose & Capability
The stated purpose is to answer Chinese calendar, lunar-date, solar-term, and Huangli questions, and the instructions consistently describe querying a Huangli calendar API for that data.
Instruction Scope
The skill includes Python example code for making an HTTPS API request and formatting the returned calendar fields. This is purpose-aligned, but users should understand that use involves contacting cdndns.org.
Install Mechanism
There is no install script, package dependency, binary requirement, or code file beyond the instruction document.
Credentials
SKILL.md requires a HUANGLI_API_TOKEN even though registry requirements list no required env vars or primary credential. The token use is disclosed and purpose-aligned, so this is a metadata/disclosure note rather than a material concern.
Persistence & Privilege
The instructions suggest storing the token in a .env file and include helper code that reads ~/.openclaw/.env or the current directory .env. This is common for API-token configuration, but users should avoid placing unrelated secrets in files used by tools.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install xungu-huangli
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /xungu-huangli 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of 循古黄历 skill for Chinese lunar calendar and almanac information. - Provides queries on 24 solar terms, lunar calendar dates, auspicious/taboo activities, fortune, and yellow calendar details. - Integrates with 循古排盘 API (https://cdndns.org), requires configurable Bearer Token. - Returns detailed daily calendar info: Gregorian/lunar date, three-stem Ganzhi, recommended and taboo activities, luck hour slots, Chongsha, moon phase, Taoist and Buddhist calendar. - Supports querying specific dates as well as today's almanac. - Designed for easy integration with OpenClaw via environment variable configuration.
元数据
Slug xungu-huangli
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

循古黄历 是什么?

循古黄历 - 获取中国万年历信息,包括二十四节气、农历日期、佛历、道历、月相、黄道吉日、每日宜忌、建除十二神、黄黑道值日、二十八星宿、胎神占方、三元九运方位以及逐时吉凶查询。当用户询问节气、农历、日子好坏、宜忌、黄历相关问题时使用此技能。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 45 次。

如何安装 循古黄历?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install xungu-huangli」即可一键安装,无需额外配置。

循古黄历 是免费的吗?

是的,循古黄历 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

循古黄历 支持哪些平台?

循古黄历 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 循古黄历?

由 cnyouker(@cnyouker)开发并维护,当前版本 v1.0.0。

💬 留言讨论