dnd5e-srd
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseD&D 5e SRD RAG
D&D 5e SRD RAG
This skill provides search-based retrieval access to the Dungeons & Dragons 5th Edition System Reference Document (SRD), organized by page ranges as markdown files in the directory.
references/本技能提供对《龙与地下城》第5版系统参考文档(SRD)的检索访问,该文档按页码范围拆分,以markdown文件形式存储在目录中。
references/When to Use This Skill
何时使用本技能
Use this skill whenever answering questions about D&D 5e SRD content, including:
- Core rules and gameplay procedures
- Ability checks, saving throws, and skill use
- Combat, actions, conditions, and movement
- Classes, backgrounds, equipment, and magic items
- Spells and spellcasting
- Creatures and stat blocks included in the SRD
在回答以下D&D 5e SRD相关内容的问题时,使用本技能:
- 核心规则与游戏流程
- 能力检定、豁免检定与技能使用
- 战斗、动作、状态与移动
- 职业、背景、装备与魔法物品
- 法术与施法
- SRD中包含的生物与属性块
Search Strategy
搜索策略
Follow this agentic search process for D&D 5e SRD queries:
针对D&D 5e SRD查询,遵循以下基于智能体的搜索流程:
1. Identify Relevant Page Ranges
1. 确定相关页码范围
The SRD is organized by page ranges. Use this file index to locate content:
Important: Always use the Python search tool () to get exact character positions for source citations.
scripts/search_with_positions.pySRD按页码范围组织。使用以下文件索引定位内容:
重要提示:务必使用Python搜索工具()获取用于来源引用的精确字符位置。
scripts/search_with_positions.pyFile Index (by page range)
文件索引(按页码范围)
Note: Topics below follow your provided outline and are aligned to the actual file splits; where a topic spans multiple files, it's marked as continued.
- : Intro through Character Creation
DND5eSRD_001-018.md - : Barbarian, Bard, Cleric (start)
DND5eSRD_019-035.md - : Cleric/Druid, Fighter, Monk (start)
DND5eSRD_036-046.md - : Monk, Paladin, Ranger, Rogue
DND5eSRD_047-063.md - : Sorcerer, Warlock, Wizard (start)
DND5eSRD_064-076.md - : Wizard, Origins, Feats
DND5eSRD_077-086.md - : Equipment
DND5eSRD_087-103.md - : Spells
DND5eSRD_104-120.md - : Spells
DND5eSRD_121-137.md - : Spells
DND5eSRD_138-154.md - : Spells
DND5eSRD_155-175.md - : Rules Glossary (part)
DND5eSRD_176-191.md - : Gameplay Toolbox, Magic Items (start, part 1)
DND5eSRD_192-203.md - : Gameplay Toolbox, Magic Items (continued)
DND5eSRD_204-229.md - : Magic Items (continued)
DND5eSRD_230-252.md - : Monsters intro + early entries
DND5eSRD_253-272.md - : Monsters
DND5eSRD_273-292.md - : Monsters
DND5eSRD_293-312.md - : Monsters
DND5eSRD_313-332.md - : Monsters / Animals (continued)
DND5eSRD_333-364.md
注:以下主题遵循给定大纲,与实际文件拆分对齐;若主题跨多个文件,会标记为“续”。
- : 引言至角色创建
DND5eSRD_001-018.md - : 野蛮人、吟游诗人、牧师(开始)
DND5eSRD_019-035.md - : 牧师/德鲁伊、战士、武僧(开始)
DND5eSRD_036-046.md - : 武僧、圣骑士、游侠、盗贼
DND5eSRD_047-063.md - : 术士、邪术师、巫师(开始)
DND5eSRD_064-076.md - : 巫师、起源、专长
DND5eSRD_077-086.md - : 装备
DND5eSRD_087-103.md - : 法术
DND5eSRD_104-120.md - : 法术
DND5eSRD_121-137.md - : 法术
DND5eSRD_138-154.md - : 法术
DND5eSRD_155-175.md - : 术语表(部分)
DND5eSRD_176-191.md - : 游戏工具箱、魔法物品(开始,第一部分)
DND5eSRD_192-203.md - : 游戏工具箱、魔法物品(续)
DND5eSRD_204-229.md - : 魔法物品(续)
DND5eSRD_230-252.md - : 怪物引言 + 早期条目
DND5eSRD_253-272.md - : 怪物
DND5eSRD_273-292.md - : 怪物
DND5eSRD_293-312.md - : 怪物
DND5eSRD_313-332.md - : 怪物/动物(续)
DND5eSRD_333-364.md
2. Search Using the Python Tools
2. 使用Python工具进行搜索
Primary method: use the search + expand workflow for accurate positions and structured context.
bash
undefined主要方法:使用“搜索+扩展”工作流获取准确位置和结构化上下文。
bash
undefinedStep 1: Search to find content with exact character positions
步骤1:搜索以找到带有精确字符位置的内容
python /skills/dnd5e-srd/scripts/search_with_positions.py "search term" --all
python /skills/dnd5e-srd/scripts/search_with_positions.py "search term" --all
Step 2: If you need more context, expand specific result(s)
步骤2:若需要更多上下文,扩展特定结果
python /skills/dnd5e-srd/scripts/expand_context.py "search term" --result 3 --mode section --all
python /skills/dnd5e-srd/scripts/expand_context.py "search term" --result 3 --mode section --all
Examples
示例
Search combat-related terms
搜索战斗相关术语
python /skills/dnd5e-srd/scripts/search_with_positions.py "grapple" --all
python /skills/dnd5e-srd/scripts/search_with_positions.py "grapple" --all
Search spells and expand result #1 by section
搜索法术并按章节扩展第1条结果
python /skills/dnd5e-srd/scripts/expand_context.py "fireball" --result 1 --mode section --all
python /skills/dnd5e-srd/scripts/expand_context.py "fireball" --result 1 --mode section --all
Search specific page ranges
搜索特定页码范围
python /skills/dnd5e-srd/scripts/search_with_positions.py "longsword" --pages 200-300
python /skills/dnd5e-srd/scripts/search_with_positions.py "longsword" --pages 200-300
Batch expand multiple results
批量扩展多个结果
python /skills/dnd5e-srd/scripts/expand_context.py "Attack" --results 1,3,5 --mode paragraph --all
The search tool returns:
- Filename
- Character range (start-end positions)
- Matched text with context
- Ready-to-use citation format: `[filename, chars START-END]`
The expand tool returns:
- Expanded text (paragraph, section, or entire document)
- Heading breadcrumb trail
- Original match position within the expansion
- Expansion bounds and metadatapython /skills/dnd5e-srd/scripts/expand_context.py "Attack" --results 1,3,5 --mode paragraph --all
搜索工具返回:
- 文件名
- 字符范围(起始-结束位置)
- 包含上下文的匹配文本
- 可直接使用的引用格式:`[filename, chars START-END]`
扩展工具返回:
- 扩展后的文本(段落、章节或整个文档)
- 标题层级路径
- 原始匹配位置在扩展内容中的位置
- 扩展范围边界和元数据3. Expand Context When Needed
3. 必要时扩展上下文
After searching, expand results that need deeper context:
- Use for surrounding text
--mode paragraph - Use to get the full rule section with headings
--mode section - Use to batch expand multiple results
--results 1,3,5
搜索完成后,对需要更深入上下文的结果进行扩展:
- 使用获取周围文本
--mode paragraph - 使用获取包含标题的完整规则章节
--mode section - 使用批量扩展多个结果
--results 1,3,5
4. Multi-hop Queries
4. 多跳查询
For questions requiring multiple pieces of information:
- Break down the query into components
- Search for each component separately
- Synthesize the information from multiple sources
对于需要多部分信息的问题:
- 将查询拆分为多个组件
- 分别搜索每个组件
- 综合多个来源的信息
5. Provide Accurate Answers with Source Citations
5. 提供带来源引用的准确答案
After retrieving information:
- Quote or paraphrase the exact rules as needed
- Always cite sources using the character position format:
[filename, chars START-END] - Include multiple sources when relevant
- Cite at the end of the relevant information, not inline
Citation examples:
The spell Fireball deals 8d6 fire damage on a failed save. [DND5eSRD_293-312.md, chars 12000-12100]
A grapple check uses Athletics vs. the target's escape DC (see Conditions). [DND5eSRD_087-103.md, chars 5400-5600]检索到信息后:
- 根据需要引用或转述精确规则
- 务必使用字符位置格式引用来源:
[filename, chars START-END] - 相关时包含多个来源
- 在相关信息末尾引用,而非内联引用
引用示例:
法术火球术在豁免失败时造成8d6火焰伤害。[DND5eSRD_293-312.md, chars 12000-12100]
擒抱检定使用 Athletics 对抗目标的逃脱DC(见状态)。[DND5eSRD_087-103.md, chars 5400-5600]References Directory Structure
参考目录结构
The directory contains the SRD split into page-range files.
Files are named where is the page range.
references/DND5eSRD_XXX-YYY.mdXXX-YYYTo list all files:
bash
ls -lh /skills/dnd5e-srd/references/To find which file contains specific content:
bash
grep -l "search term" /skills/dnd5e-srd/references/*.mdreferences/DND5eSRD_XXX-YYY.mdXXX-YYY列出所有文件:
bash
ls -lh /skills/dnd5e-srd/references/查找包含特定内容的文件:
bash
grep -l "search term" /skills/dnd5e-srd/references/*.mdPython Tools
Python工具
1. Search Tool (search_with_positions.py
)
search_with_positions.py1. 搜索工具(search_with_positions.py
)
search_with_positions.pyFeatures:
- Searches SRD reference files with regex-based term matching
- Returns precise character ranges for each match
- Includes contextual text around matches
- Supports filtering by page ranges or specific files
Usage:
bash
undefined特性:
- 基于正则表达式匹配检索SRD参考文件
- 返回每个匹配项的精确字符范围
- 包含匹配项周围的上下文文本
- 支持按页码范围或特定文件过滤
用法:
bash
undefinedBasic search across all files
基础搜索(所有文件)
python scripts/search_with_positions.py "term" --all
python scripts/search_with_positions.py "term" --all
Search specific page range
搜索特定页码范围
python scripts/search_with_positions.py "term" --pages 200-300
python scripts/search_with_positions.py "term" --pages 200-300
Control output
控制输出
python scripts/search_with_positions.py "term" --all --max-results 10 --context 200
python scripts/search_with_positions.py "term" --all --max-results 10 --context 200
Case-sensitive search
区分大小写的搜索
python scripts/search_with_positions.py "Attack" --all --case-sensitive
undefinedpython scripts/search_with_positions.py "Attack" --all --case-sensitive
undefined2. Context Expansion Tool (expand_context.py
)
expand_context.py2. 上下文扩展工具(expand_context.py
)
expand_context.pyFeatures:
- Expands specific search results with boundary-aware modes
- Modes: (default),
paragraph,section,section-only,chardocument - Provides heading breadcrumb trails for context
- Supports batch expansion and JSON output
Usage:
bash
undefined特性:
- 支持按边界感知模式扩展特定搜索结果
- 模式:(默认)、
paragraph、section、section-only、chardocument - 提供上下文的标题层级路径
- 支持批量扩展和JSON输出
用法:
bash
undefinedExpand a specific search result by section
按章节扩展特定搜索结果
python scripts/expand_context.py "fireball" --result 3 --mode section --all-search
python scripts/expand_context.py "fireball" --result 3 --mode section --all-search
Expand multiple results at once
同时扩展多个结果
python scripts/expand_context.py "Attack" --results 1,3,5 --mode paragraph --all-search
python scripts/expand_context.py "Attack" --results 1,3,5 --mode paragraph --all-search
Direct expansion from known file position
从已知文件位置直接扩展
python scripts/expand_context.py --file "DND5eSRD_121-137.md" --position 1234 --mode section
python scripts/expand_context.py --file "DND5eSRD_121-137.md" --position 1234 --mode section
JSON output for machine processing
输出JSON格式供机器处理
python scripts/expand_context.py "wizard" --result 1 --all-search --format json
undefinedpython scripts/expand_context.py "wizard" --result 1 --all-search --format json
undefinedBest Practices
最佳实践
- Use the Python tools: search first, then expand for deeper context
- Always cite sources with
[filename, chars START-END] - Leverage structure: use to get full rules and headings
--mode section - Be specific: search for exact SRD terminology
- Check multiple files: related rules may span multiple ranges
- Handle ambiguity: present possible interpretations with citations
- 使用Python工具:先搜索,再扩展以获取更深入的上下文
- 务必引用来源,使用格式
[filename, chars START-END] - 利用结构:使用获取完整规则和标题
--mode section - 精准搜索:使用SRD中的精确术语进行搜索
- 检查多个文件:相关规则可能跨多个页码范围
- 处理歧义:列出可能的解释并附上引用
Notes
注意事项
- Files are organized by page ranges (e.g., 001-018, 019-035)
- Some files are large (up to 120K+); prefer targeted searches
- This skill includes SRD content only; not supplements or non-SRD material
- 文件按页码范围组织(如001-018、019-035)
- 部分文件较大(超过120K字符);优先使用针对性搜索
- 本技能仅包含SRD内容;不包含补充资料或非SRD内容