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

fallback-file-creation

하는 일

이 스킬은 코드 실행 도구가 계속 실패할 때 파일을 만들고 확인하는 수동 셸 방법을 AI에게 제공합니다. 특정 파일 형식을 안정적으로 만들어야 하는 사람에게 맞습니다.

사용하는 경우

  • ✓파일 작업에서 코드 실행 도구나 셸 도우미가 여러 번 실패했을 때.
  • ✓PDF나 Word 파일을 만들어야 하는데 평소 도구가 작동하지 않는 경우.
  • ✓파일을 쓴 뒤 각 파일을 확인하고 싶을 때.

스킬 링크

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/fallback-file-creation/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/fallback-file-creation/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분.

작동 방식

AI는 작업 폴더를 확인하고, 셸 heredoc으로 스크립트를 쓰고, 명시적인 경로로 실행한 뒤, 각 결과 파일이 있는지 확인합니다.

기술 내용 (원본 SKILL.md)

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

Fallback File Creation Workflow

Use this skill when execute_code_sandbox or shell_agent fails repeatedly for file creation tasks. This pattern provides a manual but reliable approach to create and verify files.

When to Use

  • Code execution tools fail after multiple retries
  • You need to create specific file formats (PDF, DOCX, etc.)
  • Direct shell commands are more reliable than generated scripts
  • You need explicit verification of file outputs

Step-by-Step Instructions

Step 1: Verify Working Directory

Before any file operations, confirm your current location:

pwd
ls -la

This ensures you're creating files in the correct workspace directory.

Step 2: Create Scripts via Heredoc

Use shell heredocs to create scripts with properly escaped syntax:

cat > /path/to/script.sh << 'EOF'
#!/bin/bash
# Your script content here
# Variables are NOT expanded inside 'EOF' (quoted)
echo "Creating file..."
# Commands to generate output
EOF

Key escaping rules:

  • Use 'EOF' (quoted) to prevent variable expansion inside the heredoc
  • Use EOF (unquoted) if you want shell variables to expand
  • Escape any $, backticks, or special characters if using unquoted EOF

Step 3: Execute with Explicit Path

Always run scripts with their full or explicit relative path:

chmod +x /path/to/script.sh
/path/to/script.sh
# or
bash /path/to/script.sh

Avoid relying on . or implicit paths.

Step 4: Verify Output

After execution, verify files were created correctly:

# Check file exists and size
ls -lh /path/to/output.file

# For PDFs: inspect metadata
pdfinfo /path/to/output.pdf

# For DOCX: check structure
unzip -l /path/to/output.docx | head -20

# For any file: check content preview
file /path/to/output.file
head -c 500 /path/to/output.file

Step 5: Iterative Debugging

If verification fails:

  1. Check error messages from script execution
  2. Verify all dependencies are available (which command)
  3. Test individual commands from the script manually
  4. Re-run with verbose output (bash -x script.sh)

Example: Creating a PDF Document

# Step 1: Verify directory
pwd
ls -la

# Step 2: Create conversion script
cat > /workspace/create_pdf.sh << 'EOF'
#!/bin/bash
cd /workspace
libreoffice --headless --convert-to pdf checklist.odt --outdir .
EOF

# Step 3: Execute
chmod +x /workspace/create_pdf.sh
/workspace/create_pdf.sh

# Step 4: Verify
ls -lh /workspace/checklist.pdf
pdfinfo /workspace/checklist.pdf

Example: Creating a DOCX Document

# Step 1: Verify directory
pwd
ls -la

# Step 2: Create document script
cat > /workspace/create_docx.sh << 'EOF'
#!/bin/bash
cd /workspace
pandoc -f markdown -t docx action_tracker.md -o action_tracker.docx
EOF

# Step 3: Execute
chmod +x /workspace/create_docx.sh
/workspace/create_docx.sh

# Step 4: Verify
ls -lh /workspace/action_tracker.docx
unzip -l /workspace/action_tracker.docx | head -20

Best Practices

  1. Always verify before and after - Check directory state before starting and after completion
  2. Use absolute or explicit paths - Avoid ambiguity in file locations
  3. Quote heredoc delimiters - Use 'EOF' to prevent unwanted variable expansion
  4. Make scripts executable - Always chmod +x before running
  5. Inspect file metadata - Use format-specific tools (pdfinfo, unzip -l, file) to verify content
  6. Keep scripts simple - Each script should do one thing well
  7. Clean up temporary files - Remove intermediate files after successful completion

Troubleshooting

Issue Solution
Script not found Use full path: /workspace/script.sh
Permission denied Run chmod +x script.sh
File not created Check script output, verify working directory in script
Wrong file format Verify conversion tool supports target format
Corrupted output Re-run with verbose mode, check intermediate files
자주 묻는 질문

heredoc을 쓰는 이유는 무엇인가요?

AI가 스크립트 전체를 셸 명령 하나로 파일에 쓸 수 있기 때문입니다.

작업 폴더를 먼저 확인하는 이유는 무엇인가요?

파일이 올바른 작업 공간에 만들어지도록 하기 위해서입니다.

스크립트 안의 변수가 펼쳐지나요?

따옴표로 감싼 EOF 표시를 쓰면 펼쳐지지 않으므로 스크립트 텍스트가 그대로 유지됩니다.

상세 정보

작성자의 원본 설명

Fallback pattern for reliable file creation when code execution tools fail

repo: HKUDS/AgentPilot

인기도

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

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬