pdf-verification
하는 일
이 스킬은 PDF를 만든 직후 잘못된 쪽수, 빈 페이지, 손상된 파일을 찾아냅니다. 사용하기 전에 PDF 결과물을 믿어야 하는 사람에게 맞습니다.
사용하는 경우
- ✓PDF 생성 작업이 막 끝났을 때.
- ✓작업에 특정 쪽수가 필요한 경우.
- ✓끝내기 전에 PDF가 비어 있거나 손상되지 않았는지 확인하고 싶을 때.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pdf-verification/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“PDF는 두 쪽이어야 합니다. 만들어지면 쪽수를 확인하고 제대로 열리는지 확인해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI는 필요하면 PyPDF2를 설치하고, run_shell로 짧은 검사를 실행해 파일을 열고, 쪽수를 목표와 비교한 뒤 불일치를 보고합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
PDF Verification Skill
Purpose
After generating PDF files, always verify page counts and file integrity programmatically before declaring task completion. This catches formatting issues, empty pages, and corrupted files early.
When to Use
- After any PDF generation task
- When specific page counts are required
- Before marking a PDF-related task as complete
Verification Steps
1. Install PyPDF2 (if needed)
pip install PyPDF2
2. Verify Page Count and Integrity
Use run_shell to execute a Python verification script:
python -c "
from PyPDF2 import PdfReader
import sys
def verify_pdf(filepath, expected_pages=None):
try:
reader = PdfReader(filepath)
actual_pages = len(reader.pages)
print(f'✓ {filepath}: {actual_pages} pages')
if expected_pages and actual_pages != expected_pages:
print(f'✗ Page count mismatch: expected {expected_pages}, got {actual_pages}')
return False
# Check file is not empty/corrupted
if actual_pages == 0:
print(f'✗ Empty PDF: {filepath}')
return False
return True
except Exception as e:
print(f'✗ Error reading {filepath}: {e}')
return False
# Verify each PDF
results = []
results.append(verify_pdf('output.pdf', expected_pages=2))
print(f'All checks passed: {all(results)}')
sys.exit(0 if all(results) else 1)
"
3. Verify Multiple PDFs
For tasks with multiple PDFs, verify each one:
python -c "
from PyPDF2 import PdfReader
pdfs = {
'listings.pdf': 2,
'map.pdf': 1,
'summary.pdf': 1
}
all_passed = True
for filepath, expected in pdfs.items():
try:
reader = PdfReader(filepath)
actual = len(reader.pages)
status = '✓' if actual == expected else '✗'
print(f'{status} {filepath}: {actual}/{expected} pages')
if actual != expected:
all_passed = False
except Exception as e:
print(f'✗ {filepath}: {e}')
all_passed = False
print(f'Verification: {\"PASSED\" if all_passed else \"FAILED\"}')
"
4. Check File Size (Optional)
Add file size validation to catch empty or near-empty files:
python -c "
import os
from PyPDF2 import PdfReader
filepath = 'output.pdf'
min_size = 1000 # minimum bytes
file_size = os.path.getsize(filepath)
if file_size < min_size:
print(f'✗ File too small: {file_size} bytes')
else:
reader = PdfReader(filepath)
print(f'✓ {filepath}: {len(reader.pages)} pages, {file_size} bytes')
"
Best Practices
- Verify immediately after generation - Don't wait until the end of the task
- Check all required PDFs - Verify each file meets specifications
- Fail fast - If verification fails, regenerate before proceeding
- Log results - Print verification results for debugging
- Set reasonable minimums - Use file size checks to catch empty outputs
Common Issues Caught
- Wrong page counts (extra blank pages, missing content)
- Corrupted or unreadable PDF files
- Empty PDFs (0 pages)
- Files that appear generated but contain no actual content
Example Task Completion Check
# Final verification before marking task complete
python -c "
from PyPDF2 import PdfReader
import sys
required = {'listings.pdf': 2, 'map.pdf': 1}
passed = True
for f, pages in required.items():
try:
actual = len(PdfReader(f).pages)
if actual != pages:
print(f'FAIL: {f} has {actual} pages, expected {pages}')
passed = False
except Exception as e:
print(f'FAIL: Cannot read {f}: {e}')
passed = False
if passed:
print('SUCCESS: All PDFs verified')
sys.exit(0)
else:
sys.exit(1)
"
자주 묻는 질문
빈 PDF도 잡아내나요?
네, 스크립트는 쪽수가 0인 PDF를 빈 파일로 보고합니다.
불일치하면 어떻게 되나요?
예상 쪽수와 실제 쪽수를 출력해서 문제가 보이게 합니다.
언제 확인해야 하나요?
PDF를 만든 직후, 작업을 완료로 표시하기 전에 확인해야 합니다.
상세 정보
작성자의 원본 설명
Verify PDF page counts and file integrity programmatically using PyPDF2 after generation
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #12941
- 라이선스
- 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프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.
비슷한 스킬
feishu-doc
394k에이전트가 문서 도구를 사용해 텍스트, 이미지, 표를 포함한 Feishu 클라우드 문서를 읽고, 만들고, 편집하도록 돕습니다.
feishu-drive
394k에이전트가 봇과 공유된 Feishu 클라우드 폴더의 파일을 찾아보고, 정리하고, 댓글을 달도록 돕습니다.
feishu-perm
394k에이전트가 요청을 충족하는 가장 작은 권한을 골라, Feishu 파일에 누가 접근할 수 있는지 확인하고 바꾸도록 돕습니다.