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

prioritize-reference-files

它能做什么

这项技能引导 AI 智能体在做任何其他事情之前,先找到并阅读任务中的参考文件。它适合期望 AI 使用自己文件的人。

适用场景

  • ✓当你附上文件,并期望 AI 使用其中内容作答的时候。
  • ✓当 AI 报告的数据没有出现在你的文件中的时候。
  • ✓当读取 Word、PDF 或 Excel 文件时出现错误,你需要 AI 找到其他方法的时候。

技能链接

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/prioritize-reference-files/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

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

可以这样问 AI

“请使用我附上的 Excel 和 PDF 回答我的问题,不要编造任何数字。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会查找附在任务上的文件,为每种类型使用合适的读取器,并在网络搜索之前先阅读它们。如果文件读取失败,这项技能会列出可以尝试的备用方法。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Prioritize Reference Files

Purpose

This skill ensures that when reference files are provided in task context, you MUST read and extract data from them FIRST before attempting web searches or generating synthetic data. Ignoring available structured data leads to fabricated outputs and incorrect results.

Core Principle

Reference files in context > Web search > Data fabrication (never)

Workflow

Step 1: Scan Task Context for Reference Files

Before taking any action, identify all files provided in the task context:

  • Look for file attachments, uploads, or references in the task description
  • Common formats: .xlsx, .csv, .json, .pdf, .docx, .txt
  • Check for phrases like "attached", "provided", "reference file", "see file"

Step 2: Read Reference Files First

Use the appropriate tool to read each reference file:

# For Excel files
read_file(filetype="xlsx", file_path="path/to/file.xlsx")

# For CSV files  
read_file(filetype="csv", file_path="path/to/file.csv")

# For PDF files
read_file(filetype="pdf", file_path="path/to/file.pdf")

# For JSON files
read_file(filetype="json", file_path="path/to/file.json")

# For text files
read_file(filetype="txt", file_path="path/to/file.txt")

If read_file fails on .docx files (returns error, empty content, or 'unknown error'):

Fallback Approach 1: Direct zipfile/XML extraction via run_shell

# .docx files are ZIP archives containing XML; extract document.xml directly
unzip -p path/to/file.docx word/document.xml | grep -oP '(?<=<w:t>)[^<]+' | tr '\n' ' '

Or for more complete extraction:

mkdir -p /tmp/docx_extract && cd /tmp/docx_extract && unzip path/to/file.docx && cat word/document.xml

Fallback Approach 2: Use shell_agent for complex extraction If direct extraction fails, delegate to shell_agent:

shell_agent(task="Extract text content from path/to/file.docx using zipfile and XML parsing")

The agent will attempt multiple extraction methods and report results.

Fallback Approach 3: Verify extraction success before proceeding After any extraction method, confirm content was retrieved:

  • Check that output is non-empty and contains expected document structure
  • Look for familiar text from the document (headings, known phrases)
  • If extraction appears incomplete, try an alternative method
  • Document which method succeeded: "Content extracted using [method] after read_file failed"

Important: Never proceed to data fabrication if reference files exist but read_file fails. Always attempt at least one fallback extraction method first.

Step 3: Extract and Validate Data

After reading:

  1. Parse the content to understand the data structure
  2. Identify relevant fields/columns for your task
  3. Verify the data is complete and usable
  4. Note any limitations or missing information

Step 4: Use Reference Data as Primary Source

  • Base all outputs on the reference file data
  • Only supplement with web search if reference data is incomplete
  • NEVER fabricate data when reference files exist
  • If reference data is insufficient, explicitly state what's missing

Step 5: Document Data Source

In your outputs, acknowledge the source:

  • "Data sourced from [filename]"
  • "Based on provided reference file: [filename]"
  • This confirms you used the actual provided data

Anti-Patterns to Avoid

❌ Ignoring reference files and searching the web instead ❌ Fabricating data when structured data is available ❌ Assuming file contents without reading them ❌ Using outdated web data when current reference files exist ❌ Giving up after read_file fails without trying fallback extraction methods

Example

Task Context: "Create a property listings report. See Massabama_active_listings.xlsx for current data."

Correct Approach:

1. Read Massabama_active_listings.xlsx first
2. Extract property addresses, prices, specifications
3. Generate report using actual listing data
4. Note: "Data sourced from Massabama_active_listings.xlsx"

Incorrect Approach:

1. Search web for "Massabama property listings"
2. Fabricate property data from search results
3. Create report with unverified/generated data

Verification Checklist

Before completing any task with reference files:

  • I have identified all reference files in the task context
  • I have read each reference file using appropriate tools
  • I have extracted relevant data from the files
  • My output is ba
常见问题

智能体如何决定先读哪些文件?

它会查找附件,以及任务中“附上”或“提供”之类的表述,然后优先读取这些文件。

如果 Excel 读取器失败怎么办?

智能体可以使用其他方法,例如脚本,来打开文件并读取其中的数据。

这项技能只适用于数据类任务吗?

它面向依赖所提供文件的任务,例如报告、分析和摘要。

详情

作者的原始描述

Ensures agents read and use provided reference files before searching or fabricating data

repo: HKUDS/AgentPilot

热度

GitHub 星标
7.8k
排名
#12954
许可证
MIT
更新时间
2026/11/1

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能