跳到正文
Skillpedia
智能体7.8k · #12953

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/prioritize-reference-files-6e4111/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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:

  1. Verify the extracted content is complete and readable
  2. Proceed to use this extracted data as your reference file content
  3. 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:

  1. Find Massabama active listings.xlsx in task context
  2. Read the Excel file to extract property addresses, prices, details
  3. Use this real data to populate the PDF
  4. Only search web if verifying map locations or supplementing missing fields

Incorrect Approach:

  1. Ignore the Excel file
  2. Search web for "Massabama properties"
  3. Fabricate placeholder property data
  4. 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能