Community研究与数据分析github.com

colin4k/benben-kingdom-skill

奔奔王国(Benben Kingdom)游戏玩家专用攻略助手。读取本地 markdown 文件目录,构建 JSON 索引文件,基于关键词/BM25 检索回答关于奔奔王国的问题。**只要用户消息里出现"奔奔"或"奔奔王国"就必须触发本 skill**,不论是问攻略、问英雄搭配、问兑换建议、问活动玩法,还是想把一篇新的公众号文章/网页/本地 md 加入知识库。

benben-kingdom-skill 是什么?

benben-kingdom-skill is a Claude Code agent skill that 奔奔王国(Benben Kingdom)游戏玩家专用攻略助手。读取本地 markdown 文件目录,构建 JSON 索引文件,基于关键词/BM25 检索回答关于奔奔王国的问题。**只要用户消息里出现"奔奔"或"奔奔王国"就必须触发本 skill**,不论是问攻略、问英雄搭配、问兑换建议、问活动玩法,还是想把一篇新的公众号文章/网页/本地 md 加入知识库。.

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add colin4k/benben-kingdom-skill

Installed? Explore more 研究与数据分析 skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Benben Kingdom Helper(奔奔王国攻略助手)

Splits local markdown strategy notes for Benben Kingdom into sections by ## headings, stores them in a JSON index file, and answers all queries through BM25 keyword retrieval.

Core Capabilities

  1. Build/Rebuild Index — Splits all md files in the configured directory into sections by ## headings, writes to a JSON index file
  2. Semantic Query — Performs BM25 keyword retrieval on player questions, returns the most relevant chunks, and Claude organizes the answer in game terminology using context
  3. Incremental Update — Can add/update a local md, web article, or WeChat public account article to the knowledge base

Trigger Logic

Trigger when the user message contains "奔奔" or "奔奔王国".

The following scenarios each follow their corresponding flow:

  • Asking for guides / asking questions → [Query Flow]
  • Providing a md path or URL to be added → [Incremental Update Flow]
  • First-time use / requesting index rebuild / index is empty → [Initialization Flow]

Query Flow (all questions go through this)

Pure keyword/BM25 search, no embedding models or vector databases needed.

  1. Run: python -m scripts.query --question "<user question>" --top-k 8
  2. Parse the returned JSON (structure in references/schemas.md), take the _footer field for later use:
    • chunks: Most relevant original chunks (including source file, heading, section heading, content, tags, score)
    • concepts: Empty array (concept extraction removed)
    • sources: List of hit files (deduplicated)
    • max_score: Highest BM25 score
    • _footer: Fixed footer text
  3. Organize the answer using the retrieval results, append the _footer value from step 2 at the end:
    • Use Benben Kingdom's own terminology ("传说" "集结" "驻防" "夯" "白嫖" "体力" "号角" "试炼" "秘境" "四代" "三代"… do not translate into general language)
    • Talk like a veteran player who has played the game — give conclusions and reasons directly, don't use templates
    • If the retrieval results contain "trap" warnings ("千万别" "注意"), be sure to include them
  4. When max_score is 0 or results are empty, do not fabricate — honestly say "There is no relevant content in the note library. Would you like to add a new guide?"

Initialization Flow (first-time use)

Step 1 — Configure knowledge base path

python -m scripts.setup --set-vault /path/to/your/vault

/path/to/your/vault is the directory where you store your Benben Kingdom strategy markdown files.

Step 2 — Build index

python -m scripts.index_vault

Scans all .md files in the vault directory, splits them into sections by ## headings, and generates ~/.benben-kingdom/index.json.

For subsequent usage, just ask questions directly — the index is already built.

Incremental Update Flow

A. Local markdown file

python -m scripts.add_source --path <absolute path>

B. Webpage / WeChat public account URL

  1. Use the wechat-article-pdf skill (or other tools) to convert the URL to markdown, save to a temporary file
  2. Run:
python -m scripts.add_source --path /tmp/benben-xxx.md \
  --origin-url <original URL> --title "<article title>"

C. Directly pasted text

Write to a temporary md file, then follow path A, using --title to specify the title.

The index is automatically rebuilt after each incremental update; no extra steps needed.

Script Quick Reference

All scripts are run from the skill directory with python -m scripts.<name>:

ScriptPurposeKey Parameters
setup.pyCheck dependencies, initialize--check, --reset
index_vault.pyBuild JSON index--vault <path>
add_source.pyAdd/update a single md and rebuild index--path, --origin-url, --title
query.pyKeyword/BM25 retrieval, returns JSON--question, --top-k

Design Principles

  • Keyword retrieval is the only entry point: All questions must go through query.py; never read md files directly to answer.
  • Deterministic operations go to scripts, language understanding goes to the model: Index building and retrieval logic are clean and reliable; how to organize answers is up to Claude.
  • Don't fabricate: If nothing is retrieved, say so. Game versions update quickly; a wrong answer is worse than no answer.
  • Use player jargon: When players say "夯" "白嫖" "卡点" "上号子" "进队伍", use them directly — it feels like a veteran giving pointers.

Reference Documents

  • references/schemas.md — Script JSON schema / database table structure
  • references/configuration.md — Configuration item descriptions
  • references/troubleshooting.md — Common errors (missing index file, wrong vault path, etc.)

相关技能