genshin-data-generator
FreeRuns bundled scriptsNot checked原神角色伤害计算器数据配置辅助工具。从游戏解包数据预处理精简数据,提供数据导出和检查工具,支持AI分析和生成data.json配置。
by Kurarion★ 71 GitHub starsAbout this skill
原神数据配置辅助工具
⚠️ 核心理念
这个工具不会自动生成配置。配置生成需要 AI 根据预处理后的数据进行推理、分析和判断。
工作流程:
- 预处理:将原始解包数据(25MB+)精简为核心数据(7MB)
- AI 分析:AI 根据精简数据、游戏规则和代码逻辑进行推理
- 配置生成:AI 生成符合 interface.ts 和 const.ts 规范的配置
⚠️ 重要规则
1. 数据读取规则
永远不要直接读取 src/assets/genshin 以下的内容!
这些解包数据文件(avatar_map.json 12MB, weapon_map.json 13MB等)体积巨大,直接读取会:
- 占用大量上下文
- 导致处理缓慢
- 可能超出token限制
正确做法:使用版本系统读取预处理后的数据(见下方"数据读取流程")。
1.1 数据读取流程(⚠️ 重要)
fetch_version.py 是判断是否需要获取新数据的最权威工具。
推荐工作流程:始终优先使用 fetch_version.py,它会自动处理以下所有判断:
- 检查本地已有版本
- 比较远程最新版本
- 自动跳过已存在的版本
- 自动运行预处理
标准流程(推荐)⭐
# 步骤1:进入脚本目录
cd .claude/skills/genshin-data-generator/scripts
# 步骤2:运行 fetch_version.py(它将自动判断并执行)
# Windows 系统(使用 UTF-8 编码)
$env:PYTHONIOENCODING="utf-8"; python3 fetch_version.py
# Linux/Mac 系统
PYTHONIOENCODING=utf-8 python3 fetch_version.py
# 步骤3:使用预处理数据进行配置生成
# 预处理数据已生成在 versions/[commit-id]/processed/ 目录中
# 直接读取对应的单独文件
# 获取最新版本的 commit ID
COMMIT_ID=$(cat ../versions/metadata.json | grep -o '"latest": "[^"]*"' | cut -d'"' -f4)
# 读取角色数据(预处理后的原始游戏数据)
cat ../versions/$COMMIT_ID/processed/characters/character_10000073.json
# 读取武器数据
cat ../versions/$COMMIT_ID/processed/weapons/weapon_11301.json
# 读取 name_id_map.json(用于查找 ID)
cat ../versions/$COMMIT_ID/processed/name_id_map.json
fetch_version.py 的自动判断逻辑:
- 读取
versions/metadata.json获取本地版本列表 - 调用 Git API 获取远程仓库最新的 N 个 commit(默认3个)
- 对比本地和远程,筛选出需要获取的新版本
- 按顺序处理每个新版本:
- 执行 GenshinData Go 工具获取原始数据
- 自动运行
preprocess.py预处理数据 - 更新
metadata.json
- 如果所有远程版本都已存在,直接退出(无需重复获取)
手动检查(可选,用于调试)
如果需要手动检查版本状态(不推荐替代上述流程):
# 检查 metadata.json 获取版本信息
cat .claude/skills/genshin-data-generator/versions/metadata.json
# 输出示例:
{
"versions": [
{
"commitId": "fe7c8592b2fd1cd3f285de5039285c99e641a5e1",
"shortId": "fe7c859",
"timestamp": "2026-02-19T17:59:23.975011Z",
"sourceUrl": "https://gitlab.com/Dimbreath/AnimeGameData",
"branch": "master",
"fetchSource": "gitlab",
"stats": {
"characters": 136,
"weapons": 227,
"artifacts": 42
}
}
],
"latest": "fe7c8592b2fd1cd3f285de5039285c99e641a5e1"
}
检查 stats 字段:
- 存在且包含数据 → 预处理已完成,可以直接使用
- 不存在或为空 → 需要运行
fetch_version.py
验证预处理结果
# 检查最新版本的 processed 目录
COMMIT_ID=$(cat ../versions/metadata.json | grep -o '"latest": "[^"]*"' | cut -d'"' -f4)
ls ../versions/$COMMIT_ID/processed/
# 应该看到:
# - processed_data.json
# - name_id_map.json
# - characters/ (目录)
# - weapons/ (目录)
# - artifacts/ (目录)
⚠️ 重要提示:
- 始终优先使用
fetch_version.py,它会自动处理所有判断和预处理 latest是 metadata.json 中的一个字段,指向最新版本的 commit ID,不是实际的文件夹- 不要直接访问
versions/latest/路径,这个路径不存在 - 使用
--version latest参数时,query_data_config.py 会自动解析 metadata.json 中的 latest 字段 - Windows 系统务必设置
PYTHONIOENCODING=utf-8环境变量,避免中文乱码
2. data.json 配置插入规则(⚠️ 极其重要)
在向 src/assets/init/data.json 添加新配置时,必须遵循以下规则:
使用 name_id_map.json 确定插入顺序
正确的做法:通过 name_id_map.json 来确定新配置的插入位置。
- 读取 name_id_map.json:这个文件保持了与 data.json 完全相同的 ID 顺序
- 找到最接近的 ID:在 name_id_map.json 中查找与新 ID 最接近的现有 ID
- 插入位置正确:新配置必须插入在最接近的现有 ID 之后
- 特殊 ID 之前:不要插入到特殊 ID 之后(如旅行者的元素形态)
重要:preprocess.py 现在会自动读取 data.json 来保持 name_id_map.json 与 data.json 的顺序一致。
查找方法示例
# 方法1:使用 query_data_config.py(推荐)
cd .claude/skills/genshin-data-generator/scripts
# Windows 系统
$env:PYTHONIOENCODING="utf-8"; python3 query_data_config.py --type character --list
# 方法2:直接读取 name_id_map.json
# 首先获取最新版本的 commit ID
cd .claude/skills/genshin-data-generator
COMMIT_ID=$(cat versions/metadata.json | grep -o '"latest": "[^"]*"' | cut -d'"' -f4)
# Windows PowerShell 替代方案
$COMMIT_ID = (Get-Content versions/metadata.json | Select-String '"latest"' | ForEach-Object { $_ -replace '.*"latest": "(.*?)".*', '$1' })
# 然后读取对应版本的 name_id_map.json
cat versions/$COMMIT_ID/processed/name_id_map.json | python -c "
import json, sys
data = json.load(sys.stdin)
char_ids = list(data['characters'].keys())
print('最后10个角色ID:')
for cid in char_ids[-10:]:
print(f' {cid}: {data[\"characters\"][cid][\"en\"]}')
"
# Windows PowerShell 替代方案(使用 UTF-8)
$env:PYTHONIOENCODING="utf-8"; Get-Content versions/$COMMIT_ID/processed/name_id_map.json | python -c "import json, sys; data = json.load(sys.stdin); char_ids = list(data['characters'].keys())[-10:]; [print(f' {cid}: {data[\"characters\"][cid][\"en\"]}') for cid in char_ids]"
特殊 ID 识别
特殊 ID 通常有以下特征:
- 旅行者元素形态:
10000005502(火),10000005503(水),10000005504(风),10000005506(岩),10000005507(雷),10000005508(草) - 荧元素形态:
10000007702(火),10000007703(水),10000007704(风),10000007706(岩),10000007707(雷),10000007708(草) - 10位以上 ID:
1000011711702,1000011811802等
正确的插入示例
// 假设要添加 10000126 和 10000127
// 在 name_id_map.json 中看到:
{
"characters": {
...
"10000125": "Columbina", ← 最后一个普通 ID
"1000011711702": "Manekin (Pyro)", ← 第一个特殊 ID
...
}
}
/
Install genshin-data-generator in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the genshin-data-generator skill do?
原神角色伤害计算器数据配置辅助工具。从游戏解包数据预处理精简数据,提供数据导出和检查工具,支持AI分析和生成data.json配置。
How do I install the genshin-data-generator skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the genshin-data-generator skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
by Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
by Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
by Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
by Anthropic