← Back to Skills Marketplace
tjefferson

帝王纪年转换 / Emperor Year Converter

by Jeff · GitHub ↗ · v1.4.0 · MIT-0
cross-platform ✓ Security Clean
143
Downloads
0
Stars
0
Active Installs
3
Versions
Install in OpenClaw
/install emperor-year-converter
Description
帝王纪年转换 / Chinese imperial year converter. 年号与公元纪年双向转换,查询朝代、帝王、年号、历史年代,覆盖西周厉王(公元前878年)至清宣统(1911年)共790个年号。Convert between Chinese imperial reign years (年号) and...
README (SKILL.md)

帝王纪年转换器 Emperor Year Converter

帝王纪年(年号)与公元纪年双向转换。 Convert between Chinese imperial reign years and CE/BCE dates.

触发条件 When to use

当用户提到以下内容时使用本 Skill: Use this skill when the user mentions any of:

  • 帝王年号(如"贞观二年"、"康熙六十一年"、"洪武元年")/ A Chinese reign year
  • 年号转公元 / Converting an imperial year to CE/BCE
  • 公元转年号(如"公元1644年是什么朝代")/ What dynasty was in a given CE year
  • 搜索年号或列出某朝代年号 / Searching reign names or listing a dynasty's periods
  • 任何使用年号纪年的历史日期 / Any historical Chinese date using reign notation

不适用于 / Do not use for: 日本/韩国/越南年号、1911年之后的日期。Japanese/Korean/Vietnamese reign years, dates after 1911.

数据来源 Data source

Skill 目录中的 emperor_years_data.json 包含 790 条年号记录。 The file emperor_years_data.json contains 790 reign period records.

每条记录格式 / Record format:

{
  "dynasty": "唐 唐",
  "emperor": "太宗",
  "reign": "貞觀",
  "start": 627,
  "end": 649
}
  • start/end:公元年范围,负数为公元前(如 -140 = 公元前140年)/ CE year range, negative = BCE
  • reign: "無":该帝王无年号,使用在位第N年 / No reign name, use ordinal year
  • 公元0年不存在:公元前1年的下一年是公元1年 / Year 0 doesn't exist: 1 BCE → 1 CE

查询数据命令 / Query commands:

# 加载全部数据 / Load all data
cat emperor_years_data.json | jq .

# 按年号搜索(支持简繁体)/ Search by reign name
cat emperor_years_data.json | jq '[.[] | select(.reign | test("貞觀|贞观"))]'

# 按公元年查询 / Find by CE year
cat emperor_years_data.json | jq '[.[] | select(.start \x3C= 645 and .end >= 645)]'

转换逻辑 Conversion logic

年号→公元 Reign year → CE year

  1. 查找 reign 匹配的记录(同时匹配简体和繁体)/ Find matching record (simplified & traditional)
  2. 计算 / Calculate:公元年 = start + 第N年 - 1
  3. 跳过公元0年:若范围跨越0年需调整 / Skip year 0 if range crosses it
  4. 同名年号全部列出(如貞觀同时出现于唐和西夏)/ Show all matches for shared names

公元→年号 CE year → Reign year

  1. 查找所有 start \x3C= 公元年 \x3C= end 的记录 / Find all matching records
  2. 计算 / Calculate:第N年 = 公元年 - start + 1(跨0年需调整)
  3. 改朝换代年份会有多个结果(如1644年 = 崇祯17年 = 顺治1年)/ Transition years have multiple results

简繁匹配 Simplified ↔ Traditional

常见年号用字映射 / Common mappings:

  • 贞↔貞、观↔觀、宁↔寧、庆↔慶、显↔顯、万↔萬、历↔曆、启↔啟、统↔統、宪↔憲、义↔義、兴↔興、丰↔豐、乐↔樂、圣↔聖

搜索时两种形式都要尝试 / Always try both forms.

输出规则 Output rules

语言 Language

使用用户的语言输出。中文用户用中文,英文用户用英文。 Output in the user's language. Chinese → Chinese, English → English.

单次查询 Single query

年号→公元 / Reign → CE:

✅ 唐 · 太宗 · 贞观 2年 → 公元628年
   年号跨度: 公元627年~公元649年(共23年)

公元→年号 / CE → Reign:

📅 公元1644年 对应:
   明 · 思宗 · 崇祯 17年
   清 · 世祖 · 顺治 1年

公元前格式 BCE formatting

  • 正数 → 公元N年 / N CE
  • 负数 → 公元前N年 / N BCE

搜索结果 Search results

按朝代分组展示 / Group by dynasty:

【唐】
  太宗 · 贞观  公元627年~公元649年(23年)
【西夏】
  崇宗 · 贞观  公元1101年~公元1113年(13年)

多结果处理 Multiple matches

成功结果优先展示,超出范围的折叠显示 / Show successes first, fold errors:

✅ 清 · 宣宗 · 道光 28年 → 公元1848年
(另有 N 个含「光」的年号因年份超出范围未显示)

自然语言理解 Natural language

用户可能用自然语言提问 / Users may ask naturally:

用户说 User says 处理方式 Action
"贞观二年是哪年" / "What year is Zhenguan 2" 年号→公元:贞观, 第2年
"公元645年是什么朝代" / "What dynasty in 645 CE" 公元→年号:645
"鸦片战争那年对应什么年号" / "Opium War year in reign" 结合历史知识:1840 → 公元→年号
"康熙在位多少年" / "How long did Kangxi reign" 搜索康熙,返回总年数
"列出明朝所有年号" / "List all Ming dynasty reigns" 按朝代筛选含"明"的记录
"乾隆最后一年是哪年" / "Last year of Qianlong" 搜索乾隆,使用 end 年份

可以适当补充简短的历史背景 / Feel free to add brief historical context.

错误处理 Error handling

情况 Situation 处理 Action
年号未找到 Reign not found 建议相似年号或提示搜索 / Suggest similar names
年份超出范围 Year out of range 显示该年号的有效范围 / Show valid range
公元0年 Year 0 说明公元0年不存在 / Explain year 0 doesn't exist
输入模糊 Ambiguous input 列出所有可能匹配,让用户选择 / Show all matches
超出数据范围 Out of data range 说明覆盖范围:公元前878年~公元1911年 / Explain coverage: 878 BCE – 1911 CE
Usage Guidance
This skill appears to be a self-contained converter: it includes a large local JSON dataset and a Python script that reads that file and does conversions/searches. Before installing, consider: (1) verify you trust the publisher (source/homepage unknown) because the package includes executable Python code—if you run it locally, it will execute on your system; (2) the skill uses local file access (reads emperor_years_data.json) but does not contact external networks in its code; (3) if your platform allows autonomous execution of skills, this skill can be invoked by the agent by default (normal behavior) — review whether you want any skill to run without explicit prompts; (4) if you need guarantees about data provenance or accuracy, inspect the JSON dataset for errors or omissions; (5) avoid running the included script in environments that require strict code provenance unless you first audit the file. Overall, the package is coherent with its stated purpose and contains no obvious data-exfiltration or unrelated privilege requests.
Capability Analysis
Type: OpenClaw Skill Name: emperor-year-converter Version: 1.4.0 The skill bundle is a legitimate tool for converting Chinese imperial reign years to CE/BCE dates. The Python script (emperor_year_converter.py) implements standard data processing logic, simplified/traditional Chinese character mapping, and file I/O for batch processing without any high-risk system calls, network activity, or obfuscation. The SKILL.md instructions are strictly aligned with the stated purpose, and the data file (emperor_years_data.json) contains valid historical records with no evidence of malicious payloads or prompt injection attempts.
Capability Assessment
Purpose & Capability
Name/description (convert between 年号 and CE/BCE) matches the included assets: a JSON data file of 790 records and a Python converter script. Nothing requested (no env vars, no binaries) is unrelated to this purpose.
Instruction Scope
SKILL.md describes searching the local JSON and conversion logic; it shows example jq/cat commands and describes output rules. The included Python implements the same behavior. Instructions do not ask the agent to read unrelated files, contact remote endpoints, or exfiltrate data.
Install Mechanism
No install spec is provided (instruction-only), and code/data shipped with the skill are static files. There are no downloads, package installs, or external installers referenced.
Credentials
The skill requires no environment variables, credentials, or config paths. The Python script only reads its bundled JSON and local filesystem for optional input files—proportionate to a conversion/listing tool.
Persistence & Privilege
always is false and the skill does not attempt to modify other skills or system-wide configuration. It contains a runnable script but does not claim or require permanent presence or elevated privileges.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install emperor-year-converter
  3. After installation, invoke the skill by name or use /emperor-year-converter
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.4.0
优化 ClawHub 改版后的搜索可发现性:新增 Data & APIs 分类、description 中文关键词前置、display name 支持双语
v1.3.1
- Added new data file: emperor_years_data.json, containing 790 reign period records from 878 BCE to 1911 CE. - Enables programmatic and accurate conversion between Chinese imperial reign years and CE/BCE dates using structured data. - Supports enhanced queries and searches based on the new data source, covering all specified reign periods. - No changes to conversion logic or user interface specifications.
v1.3.0
- Expanded skill to support conversion between Chinese imperial reign years and CE/BCE dates for 790 reign periods from 878 BCE to 1911 CE. - Detailed usage instructions, query examples, and output formatting guidelines for both Chinese and English users. - Clarified conversion logic for both reign year → CE and CE → reign year, including BCE handling. - Included guidance for handling ambiguous queries and errors, with rules for natural language understanding. - Listed explicit exclusions: Japanese, Korean, Vietnamese reigns and post-1911 dates are not covered.
Metadata
Slug emperor-year-converter
Version 1.4.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 3
Frequently Asked Questions

What is 帝王纪年转换 / Emperor Year Converter?

帝王纪年转换 / Chinese imperial year converter. 年号与公元纪年双向转换,查询朝代、帝王、年号、历史年代,覆盖西周厉王(公元前878年)至清宣统(1911年)共790个年号。Convert between Chinese imperial reign years (年号) and... It is an AI Agent Skill for Claude Code / OpenClaw, with 143 downloads so far.

How do I install 帝王纪年转换 / Emperor Year Converter?

Run "/install emperor-year-converter" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is 帝王纪年转换 / Emperor Year Converter free?

Yes, 帝王纪年转换 / Emperor Year Converter is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does 帝王纪年转换 / Emperor Year Converter support?

帝王纪年转换 / Emperor Year Converter is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created 帝王纪年转换 / Emperor Year Converter?

It is built and maintained by Jeff (@tjefferson); the current version is v1.4.0.

💬 Comments