working-directory-resolution
하는 일
이 스킬은 명령을 잘못된 폴더에서 실행해서 생기는 파일 오류를 피하는 방법을 AI 에이전트에게 보여 줍니다. 파일은 있는데 에이전트가 찾을 수 없다고 보고하는 사람을 위한 스킬입니다.
사용하는 경우
- ✓파일 읽기가 파일이 있는데도 찾을 수 없음 오류로 실패할 때.
- ✓샌드박스가 작업에서 언급된 파일을 찾지 못할 때.
- ✓셸 명령이 있어야 할 파일을 없다고 보고할 때.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/working-directory-resolution/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“에이전트가 제 config.json이 없다고 합니다. 작업 공간에는 있는 것이 보입니다. 폴더 문제를 고치고 파일을 읽어 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 각 셸 명령 앞에 대상 폴더로 이동하는 cd를 붙여, 모든 명령이 올바른 위치에서 실행되도록 합니다. 이렇게 하면 작업 폴더와 파일 위치가 어긋나는 문제가 사라집니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Working Directory Resolution Pattern
Many file operation failures occur because the tool's current working directory doesn't match where the target files are located. This skill provides a reliable pattern for resolving such issues.
Problem Symptoms
File operations fail with errors like:
- "File not found" or "No such file or directory"
- "Permission denied" (when path is actually relative)
- Tools returning empty results for files that should exist
These failures often occur even when files are present in the workspace—the working directory context is simply wrong.
Solution
Always explicitly set the working directory before file operations by prepending cd to your shell commands.
Implementation Pattern
Basic Syntax
cd /path/to/target/directory && your-command-here
With run_shell
run_shell(command="cd /workspace/project && cat config.json")
Multiple Operations in Same Directory
cd /workspace/project && ls -la && cat README.md && python script.py
Conditional Directory Change
cd /workspace/project 2>/dev/null && cat file.txt || echo "Directory not found"
When to Apply
Use this pattern when:
read_filefails to locate an existing fileexecute_code_sandboxcan't find referenced files- Shell commands report missing files that should exist
- File paths work in some contexts but not others
- You're unsure of the tool's current working directory
Best Practices
Use absolute paths when possible
cd /workspace/project/src && python main.pyCombine related operations to avoid repeated
cdcallscd /workspace/project && ./build.sh && ./test.shVerify directory exists before operations
[ -d /workspace/project ] && cd /workspace/project && lsFor scripts, set working directory at the start
#!/bin/bash cd "$(dirname "$0")" || exit 1 # Rest of script runs from script's directory
Common Pitfalls
| Issue | Wrong Approach | Correct Approach |
|---|---|---|
| Relative paths | cat config.json |
cd /workspace && cat config.json |
| Assumed cwd | python script.py |
cd /workspace && python script.py |
| Multiple dirs | cd dir1; cd dir2; cmd |
cd dir1/dir2 && cmd |
Fallback Strategy
If cd also fails:
- Use
pwdto check current directory - Use
findorls -Rto locate files - Verify the path structure with
ls -la /path/to/check
pwd && find /workspace -name "target_file.txt" 2>/dev/null
This pattern is especially valuable when tools like execute_code_sandbox or read_file fail but run_shell with explicit directory context succeeds.
자주 묻는 질문
이것이 왜 파일 없음 오류를 고치나요?
대부분의 그런 오류는 명령이 파일이 있는 곳과 다른 폴더에서 실행되어 생기기 때문이라고 스킬은 설명합니다.
한 폴더에서 여러 명령을 실행할 수 있나요?
네, 스킬은 한 번의 cd 뒤에 명령을 이어서 모두 같은 폴더에서 실행하는 방법을 보여 줍니다.
폴더가 없으면 어떻게 하나요?
폴더를 찾을 수 없을 때 메시지를 출력하는 조건문 형태를 스킬이 보여 줍니다.
상세 정보
작성자의 원본 설명
Resolve file access failures by changing to the correct working directory before command execution
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #13030
- 라이선스
- 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프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.