/SKILL.md
翻译或生成 Claude Code 的 insights 中文报告。当用户说以下任一内容时自动触发: - "翻译 insights"、"翻译报告"、"中文版 insights" - "/insights-zh"、"生成中文报告"、"insights 中文翻译" - "把 insights 报告翻译成中文"、"生成中文的 insights HTML" - "中文 insights"、"生成 insights 中文版"、"我的 insights" - 提到将 ~/.claude/usage-data/report.html 翻译为中文 功能说明: - 智能判断:如果 report.html 不存在则提示用户先运行 /insights - 自动检查报告年龄(3 天内为新鲜,过期则提示用户) - 使用 TSV 格式提取文本,避免 JSON 转义问题 - 使用 Task 工具启动独立子代理翻译,避免嵌套会话问题 - 保留所有 HTML 标签、CSS 样式、JavaScript 代码 - 只翻译用户可见的文本内容 - 生成 report-zh.html 并在浏览器中打开
npx skillsauth add akira82-ai/insights-zh insights-zhInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
生成或翻译 Claude Code 的 insights HTML 报告为中文。
技能触发时,请先显示以下横幅:
═══════════════════════════════════════════════════════════════
▌ Insights 中文翻译 ▐
Claude Code 报告汉化工具
═══════════════════════════════════════════════════════════════
磊叔 │ 微信:AIRay1015 │ github.com/akira82-ai
────────────────────────────────────────────────────────────
📄 TSV 格式提取文本,避免 JSON 转义问题
🤖 Task 子代理翻译,避免嵌套会话错误
🎨 保留完整 HTML 结构、CSS 样式、JS 代码
✨ 自动检查报告年龄,智能提示更新
🌐 翻译用户可见文本,保留技术术语
═══════════════════════════════════════════════════════════════
技能已启动...
检查源文件:
ls -lh ~/.claude/usage-data/report.html
检查报告年龄:
/insights 生成新报告,结束技能判断用户意图:
/insights运行提取脚本:
python3 ~/.claude/skills/insights-zh/scripts/translate.py
脚本会:
/tmp/insights_blocks.tsv输出示例:
============================================================
Insights 报告翻译工具
============================================================
[1/4] 检查报告状态...
✅ 报告新鲜(0 天前生成)
[2/4] 提取文本块...
✅ 提取了 311 个文本块,共 15756 字符
✅ 已保存到 /tmp/insights_blocks.tsv
[3/4] 等待翻译...
请使用 Task 工具翻译 /tmp/insights_blocks.tsv
使用批量翻译模式,在主会话中实时显示进度:
启动批量翻译:
python3 ~/.claude/skills/insights-zh/scripts/auto_batch.py
查看进度和待翻译内容: 输出示例:
[██████░░░] 50.3% (140/309)
待翻译批次:15 行
═══════════════════════════════════════════════════════════
1. Conversation Insights
2. Dashboard Overview
3. Time Period
...
提供翻译:
更新 TSV 文件: 使用以下命令更新翻译:
python3 ~/.claude/skills/insights-zh/scripts/auto_batch.py --update <start_idx> <trans1> <trans2> ...
或者直接编辑 TSV 文件:
open /tmp/insights_blocks.tsv
重复步骤 1-4,直到显示:
✅ 所有行已翻译完成!
继续到步骤 3:合并翻译结果
翻译完成后,再次运行脚本:
python3 ~/.claude/skills/insights-zh/scripts/translate.py
脚本会自动:
report-zh.html输出示例:
[4/4] 合并翻译...
✅ 生成完成: ./report-zh.html
替换了 305 个文本节点
============================================================
✅ 翻译完成!
输出文件: /path/to/report-zh.html
============================================================
必须保留不翻译:
class、id、data-*、style、href 等)class="container"、id="header" 等)需要翻译:
翻译原则:
如果 ~/.claude/usage-data/report.html 不存在:
/insights 命令生成报告--path <your-report.html>如果报告超过 3 天未更新:
/insights 生成最新报告--force 参数强制翻译过期报告如果看到错误:
Error: Claude Code cannot be launched inside another Claude Code session
原因:使用了 subprocess.run(['claude', 'prompt', ...])
解决:使用 Task 工具启动独立子代理
如果 TSV 解析失败:
脚本需要 beautifulsoup4 库:
pip3 install beautifulsoup4
# 翻译指定报告
python3 ~/.claude/skills/insights-zh/scripts/translate.py --path <your-report.html>
# 指定输出文件
python3 ~/.claude/skills/insights-zh/scripts/translate.py --output result.html
# 强制翻译过期报告(不推荐)
python3 ~/.claude/skills/insights-zh/scripts/translate.py --force
✅ Insights 中文报告生成完成!
生成的文件:
- report-zh.html (当前目录)
原始报告:~/.claude/usage-data/report.html (未修改)
已在浏览器中打开翻译后的报告。
流程:
检查报告 → 提取文本 → TSV 格式 → Task 子代理翻译 → 合并 HTML
优势:
旧方案 translate_report.py 存在以下问题:
嵌套会话失败:
subprocess.run(['claude', 'prompt', '--model', 'haiku', ...])
# Error: Claude Code cannot be launched inside another Claude Code session
JSON 转义问题:
# 子代理生成的 JSON
{"translation": "例如,你多次用"算了,clear"这样的短语"}
# 中文引号导致解析失败
修复困难:
~/memory/insights-translation-fix.md早期版本的 translate.py 存在索引不一致问题:
HTMLParser,提取了 311 个文本块BeautifulSoup.find_all(string=True),找到 315 个文本节点统一使用 BeautifulSoup 进行文本提取和合并:
(NavigableString 对象, 文本) 元组原文 | 译文 两列development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.
development
End-to-end Parallels smoke, upgrade, and rerun workflow for OpenClaw across macOS, Windows, and Linux guests. Use when Codex needs to run, rerun, debug, or interpret VM-based install, onboarding, gateway smoke tests, latest-release-to-main upgrade checks, fresh snapshot retests, or optional Discord roundtrip verification under Parallels.