Skip to content
Back to skills

Wareki

ASecurity

西暦と和暦(元号+年)を相互変換する。和暦、元号、令和、平成、昭和、西暦変換、生年月日の元号、年齢の和暦表記の質問に対応。計算のみでネットワーク不要。祝日の判定はjapan-holidays、六曜はrokuyoを使う。

  • 4 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 19, 2026
ai-agentsgoapi

Works with

  • api

Security analysis

A100/100

Scanned September 26, 2026

npx -y skills add tahodev/kurashi-skill --skill wareki --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Wareki?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Wareki
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tahodev-wareki/badge)](https://www.skillsdirectory.com/skills/tahodev-wareki)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: wareki
description: 西暦と和暦(元号+年)を相互変換する。和暦、元号、令和、平成、昭和、西暦変換、生年月日の元号、年齢の和暦表記の質問に対応。計算のみでネットワーク不要。祝日の判定はjapan-holidays、六曜はrokuyoを使う。
license: MIT
metadata:
  category: calendar
  locale: ja-JP
  data_as_of: 2026-09-11
  valid_through: 2027-09-11
  source_version: "Japanese era boundaries verified 2026-09-11"
---

# wareki

西暦と和暦(元号+年)を相互変換するスキル。純粋な計算なのでAPIもダウンロードも不要。

## 元号の境界(新暦)

| 元号 | 開始日 | 終了日 | 西暦Y年→和暦n年 |
| --- | --- | --- | --- |
| 令和 | 2019-05-01 | (現在) | n = Y - 2018 |
| 平成 | 1989-01-08 | 2019-04-30 | n = Y - 1988 |
| 昭和 | 1926-12-25 | 1989-01-07 | n = Y - 1925 |
| 大正 | 1912-07-30 | 1926-12-24 | n = Y - 1911 |
| 明治 | 1868-10-23 | 1912-07-29 | n = Y - 1867 |

根拠: 国立天文台暦計算室の暦Wiki (https://eco.mtk.nao.ac.jp/koyomi/wiki/) および暦要項 (https://eco.mtk.nao.ac.jp/koyomi/yoko/)。2026-09-11に内容確認。

## 基本の流れ

### 西暦 → 和暦

1. 上の表で日付が属する元号を探す(年だけでなく開始日・終了日の境界に注意)。
2. `n = 西暦年 - 開始年 + 1` が和暦の年。
3. `n = 1` の年は「1年」ではなく「元年」と書くのが一般的。

例: 2026-09-11 → 令和に属する → n = 2026 - 2019 + 1 = 8 → **令和8年9月11日**。

### 和暦 → 西暦

`西暦年 = 開始年 + n - 1`。元年は n = 1 として計算する。

例: 平成7年 → 1989 + 7 - 1 = **1995年**。

## 読み方の注意(境界日)

改元日の前後は年の切れ目ではなく日の切れ目。同じ西暦年に2つの元号が同居する。

- 1989-01-07 = 昭和64年1月7日、1989-01-08 = 平成元年1月8日
- 2019-04-30 = 平成31年4月30日、2019-05-01 = 令和元年5月1日
- 1912-07-30 = 大正元年7月30日(1912年 = 明治45年と大正元年)

## エラー・失敗時の対応


共通の取得時チェックリストは [共通レスポンス契約](../docs/response-contract.md) の「取得時の落とし穴チェックリスト」を参照。
- このスキルはネットワークを使わない。失敗するのは入力の解釈だけ。
- **明治より前(1868-10-22以前)の日付**: この表の対象外。「対象外」と明示して推測しない。
- **境界が怪しい入力**(例: 「昭和64年6月」→ 昭和64年は1月7日まで): 存在しない和暦日付は「存在しない」とはっきり返す。丸めて近い日付にしない。
- **将来の改元**: 新しい元号は事前に予測できない。改元が発表されたら表を更新する。令和の終了日が空欄なのは現行のため。

## 注意

- 明治の暦は特殊: 1872-12-31(明治5年12月2日)までは旧暦(太陰太陽暦)で運用され、1873-01-01(明治6年1月1日)から新暦(グレゴリオ暦)。このスキルの日付はすべて新暦ベース。明治期の日付を扱うときはその旨をユーザーに伝える。
- 改元があった日は新しい元号の1日目と数える(例: 1989-01-08は平成元年1月8日)。国立天文台暦計算室の元号表も同じ扱い。
- 明治元年は1868年に遡及して数える(改元の詔書は1868-09-08=旧暦、新暦1868-10-23)。慶応4年と明治元年は同じ1868年。
- 和暦は日本の公文書・年齢確認などで必須の表記。変換結果は和暦・西暦の両方を併記すると誤読がない。

## English summary

Converts between Gregorian dates and Japanese era names (wareki: Reiwa, Heisei, Showa, Taisho, Meiji). Pure calculation, no network access. Era boundaries are day-exact (e.g. 1989-01-08 is Heisei 1, but 1989-01-07 is still Showa 64); year 1 of an era is written "元年" (gannen). Dates before 1868-10-23 are out of scope; never guess them. Meiji-era dates before 1873-01-01 used the old lunisolar calendar - flag that to the user.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.