verify-success-after-unknown-error
できること
このスキルは、ツールが原因不明のエラーを報告しても、ファイルが作られている場合があるため、再試行の前に作業が完了したかを確認するようAIエージェントに伝えます。エラーと出力が一致しない人向けです。
使う場面
- ✓コードサンドボックスが原因不明のエラーを返したが、コードは完了していたかもしれないとき。
- ✓ファイル作業で、シェルコマンドが分かりにくいメッセージで失敗したとき。
- ✓ファイルの作成や変更が、誤ったエラーを報告したかもしれないとき。
スキルのリンク
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/verify-success-after-unknown-error/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“ツールがPDFの作成時に原因不明のエラーを返しましたが、ファイルはあるかもしれません。再試行する前に、作成されたかと読み取れるかを確認してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、想定した出力フォルダーを一覧表示し、想定したファイルがそれぞれ存在するかを確認します。さらにファイルを開いて想定した内容があるかを確かめ、すでに成功した作業を再実行しないようにします。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Verify Success After Unknown Error
Purpose
When execute_code_sandbox or run_shell return "unknown error" messages, the underlying task may have actually succeeded. This skill provides a systematic approach to verify actual completion before assuming failure and retrying unnecessarily.
When to Apply
Use this pattern when:
execute_code_sandboxreturns "unknown error" but your code may have completedrun_shellfails with unclear error messages- File creation, modification, or transformation tasks report errors
- The error message is generic/unspecified rather than a clear failure reason
Verification Steps
Step 1: Check Expected Output Files
After receiving an unknown error, immediately verify if expected files were created:
# Example: Verify file creation after execute_code_sandbox
from tools import list_dir, read_file
# List directory to check if files exist
files = list_dir(path="/workspace/output")
print(files)
# Check specific file existence
expected_files = ["report.pdf", "data.xlsx"]
for f in expected_files:
try:
content = read_file(filetype="pdf", file_path=f"/workspace/output/{f}")
print(f"✓ {f} exists and is readable")
except:
print(f"✗ {f} not found or unreadable")
Step 2: Validate File Content/State
Don't just check existence — verify the files have expected content:
# For spreadsheets
file_content = read_file(filetype="xlsx", file_path="/workspace/output/schedule.xlsx")
# Verify expected sheets, columns, or data exist
# For text/json files
file_content = read_file(filetype="txt", file_path="/workspace/output/result.json")
# Parse and validate structure
# For directories
dir_contents = list_dir(path="/workspace/output")
# Verify expected number of files or specific files exist
Step 3: Decision Logic
IF expected files exist AND content is valid:
→ Task succeeded despite error message
→ Proceed to next step without retry
ELIF files exist but content is incomplete:
→ Partial success, may need targeted fix
ELSE (files missing or corrupted):
→ True failure, retry or debug required
Code Example: Complete Pattern
def execute_with_verification(code, expected_files):
"""Execute code and verify success even if error returned."""
# Attempt execution
result = execute_code_sandbox(code=code)
# Check for unknown/generic errors
if "unknown error" in result.get("output", "").lower() or result.get("error"):
print("Received error, verifying actual outcome...")
# Verify filesystem state
all_present = True
for f in expected_files:
try:
list_dir(path=f"/workspace/{f}") # or appropriate path
print(f"✓ {f} verified")
except:
print(f"✗ {f} missing")
all_present = False
if all_present:
print("Task completed successfully despite error message")
return {"status": "success_verified", "files": expected_files}
else:
print("True failure - files not created")
return {"status": "failed", "error": result.get("error")}
return {"status": "success", "output": result.get("output")}
Shell Command Example
# After run_shell returns error, verify with:
ls -la /workspace/output/
test -f /workspace/output/result.pdf && echo "File exists" || echo "File missing"
file /workspace/output/result.pdf # Verify file type is correct
Benefits
- Saves iterations: Avoids unnecessary retries when task already succeeded
- Handles tool bugs: Works around sandbox/shell tool reporting issues
- Faster completion: Move forward immediately when verification passes
- Clearer debugging: Distinguishes true failures from false positives
Anti-Patterns to Avoid
- ✗ Immediately retrying on any error without verification
- ✗ Assuming "unknown error" means complete failure
- ✗ Only checking file existence without validating content
- ✗ Skipping verification for "minor" tasks (any file output should be verified)
Related Tools
list_dir— Check directory contentsread_file— Validate file content and accessibilityexecute_code_sandbox— Primary execution tool this pattern supportsrun_shell— Shell execution tool this pattern supports
よくある質問
なぜ再試行の前に確認するのですか?
ツールが原因不明のエラーを報告しても作業が成功している場合があり、再試行は無駄になるためです。
内容の確認は何を加えますか?
ファイルを開くことで、存在するだけでなく、想定したデータが入っていることを確認できます。
どのファイルを確認しますか?
作業で作られるはずだった出力ファイルを確認します。
詳細
作者による元の説明
Verify task completion by checking filesystem state when execute_code_sandbox or run_shell return misleading unknown errors
repo: HKUDS/AgentPilot
人気
- GitHubのスター
- 7.8k
- ランキング
- #13026
- ライセンス
- 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エージェントが、プログラムを改善する方法を調べる間に、小さな実験を計画し、その結果を読み、発見を記録できるよう支援します。
似ているスキル
diffs
394k編集内容の実際の共有可能な差分を、手書きの要約ではなく、ビューアーのリンクや画像ファイルとして作成するようエージェントを支援します。
coding-agent
394kCodex、Claude Code、OpenCodeに大きめのコーディング作業をバックグラウンドのワーカーとして渡し、その進捗を確認するようエージェントを支援します。
gh-issues
394kGitHubのイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。