본문으로 건너뛰기
Skillpedia
일반 코딩7.8k · #13024

verified-script-execution

하는 일

이 스킬은 AI 에이전트가 스크립트와 파일을 직접 만들고 생성되었는지 확인하는 수동 방법을 제공합니다. PDF, Word 문서, 보고서처럼 정확해야 하는 중요한 파일을 다루는 사람을 위한 스킬입니다.

사용하는 경우

  • ✓코드 샌드박스가 연속으로 세 번 이상 실패할 때.
  • ✓셸 에이전트가 진전 없이 계속 오류를 낼 때.
  • ✓작업 폴더가 헷갈려서 파일이 예상한 곳에 만들어지지 않을 때.

스킬 링크

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/verified-script-execution/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/verified-script-execution/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“샌드박스와 셸 에이전트가 모두 제 보고서 작업에서 계속 실패합니다. 셸에서 스크립트를 단계별로 만든 뒤 파일이 있는지 확인해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 먼저 작업 디렉터리를 확인한 다음 heredoc으로 스크립트를 씁니다. 스크립트를 실행하고 결과를 확인하는데, 변수를 확장해야 하는지에 따라 따옴표가 있는 종료 표시나 없는 종료 표시를 사용합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Verified Script Execution Workflow

When execute_code_sandbox or shell_agent fails repeatedly, use this manual fallback pattern to reliably create and verify files through explicit shell commands.

When to Activate This Pattern

  • After 3+ consecutive failures with execute_code_sandbox
  • When shell_agent produces repeated errors without progress
  • For critical deliverables (PDFs, Word docs, reports) that must be created reliably
  • When working directory confusion causes file creation failures

Step 1: Verify Working Directory

Always confirm your current location before creating any files:

pwd
ls -la

This ensures you're writing to the correct workspace directory and reveals any existing files that might conflict.

Step 2: Create Scripts via Heredoc

Use shell heredoc syntax to create scripts with proper escaping. Choose the heredoc delimiter style based on your needs:

For literal content (no variable expansion):

cat > script_name.sh << 'EOF'
#!/bin/bash
# Your script content here
# Variables like $VAR will NOT be expanded
echo "Literal text with $symbols"
EOF

For content requiring variable expansion:

cat > script_name.sh << EOF
#!/bin/bash
OUTPUT_DIR="$PWD/output"
# Variables WILL be expanded
echo "Working in $OUTPUT_DIR"
EOF

Key escaping rules:

  • Use << 'EOF' (quoted delimiter) to prevent variable expansion and command substitution
  • Use << EOF (unquoted delimiter) when you need shell variables expanded
  • Escape single quotes inside quoted heredoc as '\''
  • For nested heredocs, use different delimiters (e.g., EOF and INNER)

Step 3: Make Executable and Run with Explicit Path

chmod +x script_name.sh
./script_name.sh

Or use the explicit full path for certainty:

bash /full/path/to/script_name.sh

Step 4: Verify Output

Always verify file creation and inspect content:

# Check file exists and see size
ls -lh expected_output.pdf
ls -lh expected_output.docx

# For PDFs, verify structure and page count
pdfinfo expected_output.pdf

# For Word docs, inspect internal structure
unzip -l expected_output.docx | head -20

Complete Example: PDF and Word Document Generation

# Step 1: Verify directory
pwd
ls -la

# Step 2: Create document generation script
cat > generate_deliverables.sh << 'EOF'
#!/bin/bash
set -e

# Create PDF checklist
cat > checklist_content.txt << 'CONTENT'
Safety Checklist
================
Page 1: Overview
Page 2: Requirements  
Page 3: Verification Steps
Page 4: Sign-off
CONTENT

# Create Word action tracker
cat > tracker_content.txt << 'CONTENT'
Action Tracker
==============
Item,Owner,Due,Status
Task 1,Team A,2024-01-15,Pending
Task 2,Team B,2024-01-20,In Progress
CONTENT

# Convert to target formats (adapt to available tools)
echo "Files created in: $(pwd)"
ls -lh *.txt
EOF

# Step 3: Execute with explicit path
chmod +x generate_deliverables.sh
./generate_deliverables.sh

# Step 4: Verify all outputs
ls -lh checklist_content.txt tracker_content.txt
# For PDFs: pdfinfo output.pdf
# For DOCX: unzip -l output.docx | head -20

Efficiency Tips

  1. Combine related operations in a single script to reduce iteration count
  2. Verify incrementally - check each file before proceeding to the next step
  3. Use explicit paths throughout to avoid directory confusion
  4. Test heredoc syntax in isolation before building complex nested scripts
  5. Document expected outputs (filenames, sizes, page counts) before running
  6. Use set -e in scripts to fail fast on errors

Common Pitfalls to Avoid

  • Unquoted heredoc delimiters when you need literal $ symbols
  • Missing chmod +x before script execution
  • Not verifying output before assuming success
  • Nested heredocs with same delimiter causing premature termination
  • Assuming current directory without explicit pwd verification

Migration Back to Automated Tools

Once files are created successfully with this pattern:

  1. Study what worked in the manual script
  2. Translate the working approach back to execute_code_sandbox format
  3. Test incrementally with smaller code blocks
  4. Revert to automated tools for subsequent iterations

This pattern prioritizes reliability over iteration efficiency, ensuring deliverables are created correctly even when automated tools struggle.

자주 묻는 질문

이 방법은 언제 시작하나요?

샌드박스가 세 번 실패했거나 셸 에이전트에서 반복 오류가 나온 뒤 시작합니다.

왜 디렉터리를 먼저 확인하나요?

파일이 올바른 작업 공간 폴더에 쓰이도록 하기 위해서라고 스킬은 설명합니다.

종료 표시의 차이는 무엇인가요?

따옴표가 있는 표시는 달러 기호를 그대로 두고, 따옴표가 없는 표시는 셸 변수를 확장합니다.

상세 정보

작성자의 원본 설명

Fallback workflow for reliable file creation and verification when automated code execution fails

repo: HKUDS/AgentPilot

인기도

GitHub 스타
7.8k
순위
#13024
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬