prioritize-reference-files-6e4111
它能做什么
这项技能告诉 AI 智能体,先阅读任务中的每一份参考文件,并优先使用这些文件而非其他来源。它适合为 AI 提供文档作为工作依据的人。
适用场景
- ✓当你上传电子表格、PDF 或 Word 文件,并希望 AI 以它为基础工作的时候。
- ✓当 AI 在阅读你的文件之前就去网上搜索的时候。
- ✓当 Word 文件无法打开,而你需要 AI 尝试其他方式读取它的时候。
技能链接
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/prioritize-reference-files-6e4111/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请阅读我上传的 Massabama 房源文件,并据此制作摘要,而不是依据搜索结果。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会找到附在任务上的文件,并在进行任何网络搜索之前读取每一个文件。如果 Word 文件读取失败,它会解压该文件并读取其中的文字。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Prioritize Reference Files
This skill ensures agents correctly prioritize provided reference files over external data sources, preventing the use of fabricated or incorrect information when structured data is already available.
Core Principle
When reference files are provided in task context, you MUST read and prioritize them for data before attempting web searches or generating synthetic data.
Step-by-Step Instructions
Step 1: Scan Task Context for Files
Before taking any action, identify all files provided in the task context:
- Look for file attachments, uploads, or references
- Check for common data formats:
.xlsx,.csv,.json,.pdf,.docx,.txt - Note the file names and their apparent purpose
Step 2: Read Reference Files First
Read all relevant reference files before any web searches:
# Example: Read provided Excel file
file_content = read_file(file_path="Massabama active listings.xlsx", filetype="xlsx")
# Example: Read provided CSV
file_content = read_file(file_path="data.csv", filetype="csv")
# Example: Read provided PDF
file_content = read_file(file_path="report.pdf", filetype="pdf")
Important: Handling DOCX Read Failures
If read_file(filetype='docx') fails with an error (common issue), use this fallback method:
# Method 1: Unzip and parse XML directly (docx is a zip archive)
mkdir -p temp_docx && cd temp_docx
unzip -o ../document.docx
# Extract text from word/document.xml
cat word/document.xml | grep -oP '(?<=>)[^<>]+' > extracted_text.txt
# Method 2: Use python-docx via shell
run_shell(command="python -c \"from docx import Document; doc = Document('document.docx'); print('\n'.join([p.text for p in doc.paragraphs]))\"")
# Method 3: Use shell_agent for robust extraction
extraction_result = shell_agent(task="Extract all text content from document.docx using any reliable method (unzip+XML, python-docx, or pandoc)")
After extracting via fallback:
- Verify the extracted content is complete and readable
- Proceed to use this extracted data as your reference file content
- Continue with Step 3 (Extract and Validate Data) using the fallback-extracted content
Step 3: Extract and Validate Data
- Extract structured data from the reference files
- Verify the data is complete and relevant to your task
- Map the file data to your required output format
Step 4: Use Reference Data as Primary Source
- Populate outputs using data from reference files
- Cite the reference files when using their data
- Only mark data as "to be verified" if reference files are incomplete
Step 5: Search Web Only When Necessary
Web searches should only occur when:
- Reference files do not contain the needed information
- You need to verify or supplement reference file data
- The task explicitly requires current/external information
# Decision flow example
if has_reference_file("listings.xlsx"):
data = extract_from_excel("listings.xlsx")
# Use this data for output
else:
# Only then search web
data = search_web("property listings")
Anti-Patterns to Avoid
❌ DO NOT ignore provided files and search the web first ❌ DO NOT fabricate data when reference files exist ❌ DO NOT assume reference files are irrelevant without reading them ❌ DO NOT create placeholder/synthetic data before checking available files
Checklist
Before completing any data-dependent task:
- I have identified all files provided in the task context
- I have read all relevant reference files
- I have extracted available data from reference files
- I am using reference file data as my primary source
- Web searches are only for gaps not covered by reference files
- I have cited reference files in my output where applicable
Example Application
Task: Create property listings PDF from provided data
Correct Approach:
- Find
Massabama active listings.xlsxin task context - Read the Excel file to extract property addresses, prices, details
- Use this real data to populate the PDF
- Only search web if verifying map locations or supplementing missing fields
Incorrect Approach:
- Ignore the Excel file
- Search web for "Massabama properties"
- Fabricate placeholder property data
- Create PDF with synthetic/fabricated information
常见问题
如果 Word 文件无法打开,智能体会怎么做?
这项技能提供了一种备用方法,即解压 Word 文件并直接读取其 XML 文字。
我提供了文件,智能体还需要上网搜索吗?
这项技能要求先阅读你的文件,只有在文件中没有所需数据时才进行搜索。
这项技能提到了哪些文件类型?
它列出了 xlsx、csv、json、pdf、docx 和 txt 文件,作为智能体应阅读的参考文件。
详情
作者的原始描述
Always read and use provided reference files for data before attempting external searches or fabricating information
repo: HKUDS/AgentPilot
热度
- GitHub 星标
- 7.8k
- 排名
- #12953
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
agentpilot
7.8k帮你的智能体准备任务并运行 AgentPilot 循环,逐步改进项目:循环会提出修改、测试修改并为其打分。
openspace
7.8k帮你的智能体设置 OpenSpace,这是一个用于存储和获取智能体技能的工具,并通过 MCP 将其连接到你的 AI 应用。
rsi-arena
7.8k帮你的智能体设置并运行标准 AI 基准测试,例如 AIME 和 Terminal-Bench,用来比较不同的改进方法。
experiment-guide
7.8k帮你的智能体规划小型实验、阅读实验结果并记录发现,同时研究如何改进一个程序。