shell-error-debug-workflow
하는 일
이 워크플로는 오류 메시지가 거의 정보를 주지 않을 때 AI 에이전트가 셸 명령이 왜 실패하는지 알아내도록 돕습니다. 자기 컴퓨터에서는 되지만 에이전트가 실행하면 실패하는 사람을 위한 것입니다.
사용하는 경우
- ✓셸 명령이 분명한 메시지 없이 알 수 없는 오류를 낼 때.
- ✓명령이 내 컴퓨터에서는 작동하지만 에이전트가 실행하면 실패할 때.
- ✓실패가 들쭉날쭉 나타나고 원인이 분명하지 않을 때.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/shell-error-debug-workflow/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 셸 명령이 알 수 없는 오류를 냅니다. 전체 오류 출력과 실행되는 폴더부터 확인해서 원인을 찾아 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 표준 오류를 표준 출력과 같은 곳으로 보내 오류 메시지를 캡처합니다. 그다음 작업 폴더와 내용을 확인하고, 필요한 명령이 있는지 살펴봅니다. 상대 경로가 문제를 일으키면 절대 경로로 바꿉니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Shell Error Debug Workflow
When run_shell returns an 'unknown error' or ambiguous failure, apply this systematic troubleshooting workflow to diagnose and resolve the issue.
When to Use This Skill
run_shellreturns an 'unknown error' message- Shell command fails without clear error output
- Command works locally but fails in the agent environment
- Intermittent or unexplained shell failures
Step-by-Step Troubleshooting Workflow
Step 1: Capture Explicit Stderr
Redirect stderr to stdout to capture all error output:
# Instead of:
run_shell command="some-command"
# Use:
run_shell command="some-command 2>&1"
This ensures error messages are captured in the output rather than being lost.
Step 2: Verify Working Directory
Confirm the current working directory and its contents:
run_shell command="pwd && ls -la"
Check that:
- You're in the expected directory
- Required files/directories exist
- Permissions are correct
Step 3: Check Tool/Command Availability
Verify the required command or tool exists and is accessible:
run_shell command="which some-command || command -v some-command || type some-command"
If the tool is not found, check PATH or install the required package.
Step 4: Use Absolute Paths
Replace relative paths with absolute paths to avoid directory-related issues:
# Instead of:
run_shell command="python script.py"
# Use:
run_shell command="$(pwd)/script.py"
# or
run_shell command="/absolute/path/to/script.py"
Step 5: Test with Minimal Command
Isolate the issue by running a minimal version of the command:
# Test basic functionality first
run_shell command="echo 'test'"
# Then gradually add complexity
run_shell command="some-command --version"
run_shell command="some-command --help"
Step 6: Check Environment Variables
Some commands depend on specific environment variables:
run_shell command="env | grep -i relevant_var"
Complete Diagnostic Sequence
For persistent unknown errors, run this complete diagnostic:
# 1. Capture full environment
run_shell command="pwd && echo '---' && ls -la && echo '---' && env"
# 2. Test command with full error capture
run_shell command="your-command 2>&1 | head -50"
# 3. Check command availability
run_shell command="which your-command || echo 'Command not found in PATH'"
# 4. Try with absolute path
run_shell command="/full/path/to/your-command 2>&1"
Common Causes and Solutions
| Symptom | Likely Cause | Solution |
|---|---|---|
| No output, unknown error | stderr not captured | Add 2>&1 to command |
| File not found | Wrong working directory | Use pwd to verify, use absolute paths |
| Permission denied | File/directory permissions | Check with ls -la, adjust permissions |
| Command not found | Tool not installed or not in PATH | Use which to check, install or specify full path |
| Intermittent failures | Race conditions or timing | Add delays, check for file locks |
Example: Troubleshooting a Python Script Failure
# Initial failing command
run_shell command="python process.py"
# Returns: unknown error
# Apply diagnostic workflow:
# Step 1: Capture stderr
run_shell command="python process.py 2>&1"
# Step 2: Verify directory
run_shell command="pwd && ls -la"
# Step 3: Check Python availability
run_shell command="which python && python --version"
# Step 4: Use absolute path
run_shell command="$(pwd)/process.py 2>&1"
# or
run_shell command="/usr/bin/python3 $(pwd)/process.py 2>&1"
Best Practices
- Always capture stderr when debugging:
2>&1 - Verify assumptions about working directory and file locations
- Start simple before running complex commands
- Use absolute paths in production/repeatable scripts
- Check tool versions when behavior seems inconsistent
- Document environment when errors are hard to reproduce
When to Escalate
If this workflow does not resolve the issue:
- The error may be environmental (container/runtime specific)
- Consider using
shell_agentfor complex shell tasks that require autonomous error handling - Check for resource constraints (disk space, memory, timeouts)
자주 묻는 질문
표준 오류를 캡처하면 무엇을 알 수 있나요?
오류 메시지가 사라지지 않고 출력에 나타나도록 해 줍니다.
에이전트는 명령이 있는지 어떻게 확인하나요?
which나 command -v 명령으로 도구가 설치되어 있고 경로에 있는지 확인합니다.
절대 경로는 왜 쓰나요?
절대 경로는 잘못된 폴더에서 실행해서 생기는 오류를 막아 줍니다.
상세 정보
작성자의 원본 설명
Systematic workflow for diagnosing and resolving unknown errors from run_shell commands
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #13000
- 라이선스
- MIT
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
agentpilot
7.8k작업을 준비하고 AgentPilot 루프를 실행해 변경을 제안, 테스트, 점수화하면서 프로젝트를 단계적으로 개선하도록 돕습니다.
openspace
7.8k에이전트 스킬을 저장하고 가져오는 도구인 OpenSpace를 설정하고, MCP를 통해 AI 앱에 연결하도록 돕습니다.
rsi-arena
7.8kAIME나 Terminal-Bench 같은 표준 AI 벤치마크 테스트를 설정하고 실행해 서로 다른 개선 방법을 비교하도록 돕습니다.
experiment-guide
7.8k프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.