resilient-context-extraction
できること
このスキルは、添付されたファイルをすべて読み、それを主な事実の情報源として扱うようAIエージェントに指示します。AIに参考ファイルを渡して作業させたい人向けです。
使う場面
- ✓スプレッドシート、PDF、データファイルを添付して、それをもとに何かを作るようAIに頼むとき。
- ✓AIの回答が、渡したファイルを無視しているように見えるとき。
- ✓ファイルの読み取りが不完全に見えて、別の方法でも開いてみたいとき。
スキルのリンク
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/prioritize-context-data-enhanced/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“添付した売上ファイルの数字をレポートに使ってください。その数字はウェブで検索しないでください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントはタスクに提供されたファイルを一覧にし、タスクに合うものを確認して、ほかの場所を見る前にそれらを読みます。読み取りが不完全に見えたら、別の方法を試します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Resilient Context Extraction
Objective
Prevent data hallucination and inefficiency by mandating that agents inspect, validate, and fully extract data from provided reference files before attempting web searches or generating synthetic data. When extraction is incomplete, use fallback strategies before making assumptions.
Critical Rule
If a reference file is provided in the task context, it is the source of truth. Do not fabricate data or search the web for information that may exist within the provided attachments. If extraction appears incomplete, attempt alternative methods before proceeding.
Workflow Steps
1. Scan Context for Attachments
At the start of every task, explicitly list all files provided in the context window or attachment panel.
- Check for spreadsheets (
.xlsx,.csv), documents (.pdf,.docx,.pptx), or data dumps (.json,.txt,.xml,.yaml). - Note the filename, file size (if available), and inferred content type.
- Record this list for later verification.
2. Evaluate Relevance
Determine if any provided file contains the data required to complete the task.
- Match Keywords: Do filenames or expected column headers match task requirements?
- Check Scope: Does the data cover the necessary timeframe or region?
- Prioritize: Rank files by likelihood of containing required data.
3. Extract Data with Validation
If relevant files are found:
- Read the file content using appropriate tools (e.g.,
read_file,pandas,pdf_reader). - Validate Extraction Completeness (NEW CRITICAL STEP):
- Check if output appears truncated (e.g., sudden cutoff mid-sentence, character limits hit).
- Compare expected data points vs. extracted data points (e.g., "Task mentions pricing tiers; did extraction include pricing numbers?").
- Look for structural indicators of incompleteness (e.g., unclosed tables, missing document endings).
- If extraction is incomplete or suspicious, proceed to Step 4 (Fallback Strategies) before using the data.
4. Apply Fallback Extraction Strategies
When initial extraction is incomplete or critical data is missing, attempt these strategies in order before making assumptions:
4a. Alternative Library/Tool Approach
- For
.docx: Trypython-docxdirectly viaexecute_code_sandboxifread_filewas truncated. - For
.xlsx/.csv: Trypandaswith explicit sheet selection oropenpyxldirectly. - For
.pdf: Trypdfplumber,PyPDF2, or shell-basedpdftotextif available. - For any format: Try reading as raw bytes/text via shell commands (
cat,xxd,strings).
4b. Shell-Based Extraction
- Use
shell_agentorrun_shellfor format-specific tools:unzip -p file.docx word/document.xml | xmllint --format -(extract raw docx XML)in2csv file.xlsx(convert Excel to CSV via shell)pdftotext file.pdf -(extract PDF text via command line)
- This bypasses potential sandbox or library limitations in
read_file.
4c. Targeted Re-Reading
- If specific sections are missing (e.g., "pricing table on page 3"), attempt to re-read with focus on that region.
- Use tools that support page/section ranges if available.
4d. Document What's Missing
- Before any assumptions or external searches, explicitly document:
- What data was expected but not found.
- What extraction methods were attempted.
- Why each method failed or what portions remain unavailable.
- Example: "Attempted
read_fileonPricing_email.docx(truncated at 980 chars). Attemptedpython-docxextraction via sandbox—pricing table in section 2 not present in file. Pricing numbers unavailable from provided context."
5. Cite Source Explicitly
When presenting data in the final output:
- Explicitly state which file the data came from.
- Example: "According to
Massabama_active_listings.xlsx..." - If fallback methods were used, note this: "Extracted via shell-based
pdftotextfromreport.pdf..." - This verifies to the user that real data was used, not hallucinated.
6. Fallback to Search (Last Resort Only)
If all extraction strategies fail to provide the specific data needed:
- State clearly what was missing from the files.
- Document all extraction methods attempted and why they failed.
- Then proceed with web search or estimation.
- Mark any non-file data clearly as "External Search" or "Estimated (file data unavailable)".
- Never present estimated data as if it came from the file.
Che
よくある質問
ファイルに事実がない場合、エージェントはウェブを検索しますか?
スキルは、ファイルに本当にその事実がないことをまず確認するよう求めます。その後にのみ、ほかの場所を探します。
どの種類のファイルを扱いますか?
スプレッドシート、PDF、Word、CSV、JSON、テキストのファイルが挙げられています。
AIがそれでもファイルを無視したら?
AIが見えているファイルを一覧にし、必要なファイルを読んでから続けるよう求めてください。
詳細
作者による元の説明
Ensures agents extract data from context files with validation and fallback strategies before resorting to assumptions or external searches.
repo: HKUDS/AgentPilot
人気
- GitHubのスター
- 7.8k
- ランキング
- #12951
- ライセンス
- MIT
- 更新日
- 2026/11/1
コメント
- …
このリポジトリの他のスキル
agentpilot
7.8kエージェントが、作業を準備し、変更案を提案してテストし、評価するAgentPilotのループを実行することで、プロジェクトを段階的に改善できるよう支援します。
openspace
7.8kエージェントが、スキルを保存し取り出すツールであるOpenSpaceをセットアップし、MCPを通じてAIアプリに接続できるよう支援します。
rsi-arena
7.8kエージェントが、AIMEやTerminal-Benchなどの標準的なAIベンチマークテストをセットアップして実行し、異なる改善方法を比較できるよう支援します。
experiment-guide
7.8kエージェントが、プログラムを改善する方法を調べる間に、小さな実験を計画し、その結果を読み、発見を記録できるよう支援します。
似ているスキル
add-model-provider
394k安全なセットアップコマンドで新しいAIモデルプロバイダーをOpenClawに接続し、APIキーを平文で残さず、ライブテストを行うようエージェントを支援します。
acp-router
394kClaude CodeやCursorなどのコーディングアシスタントに、OpenClaw経由でタスクを渡し、その作業がそのツール内で行われるようエージェントを支援します。
browser-automation
394kログイン、タブ、応答しなくなったページからの復旧を含め、Webページを段階的に操作するようエージェントに教えます。