본문으로 건너뛰기
Skillpedia
PDF, Word, 슬라이드7.8k · #12937

pdf-verification-check

하는 일

이 스킬은 PDF를 만드는 모든 작업의 검증 단계입니다. PDF 결과물을 쓰기 전에 유효하다는 증거가 필요한 사람에게 맞습니다.

사용하는 경우

  • ✓작업이 PDF 파일을 막 생성했을 때.
  • ✓쪽수가 요구 사항의 일부인 경우, 예를 들어 한 페이지 요약일 때.
  • ✓성공을 보고하거나 다음 단계로 넘어가려고 할 때.

스킬 링크

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

AI에게 요청하는 예시

“방금 만든 각 PDF를 확인해 주세요. 요약은 한 쪽, 목록은 두 쪽이어야 합니다.”

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

작동 방식

AI는 예상 파일과 쪽수 목록을 만들고, run_shell로 PyPDF2 스크립트를 실행해 결과를 확인하고, 맞지 않으면 파일을 다시 생성합니다.

기술 내용 (원본 SKILL.md)

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

PDF Verification Check

Use this skill whenever your task involves generating PDF files. Do not declare task completion until you have programmatically verified that the PDFs exist, are not corrupted, and match the expected page counts.

When to Use

  • Immediately after generating one or more PDF files.
  • Before reporting success or moving to the next phase of a task.
  • When specific page counts are required (e.g., "1-page summary", "2-page listing").

Verification Steps

  1. Identify Expected Outputs: List the file paths and their expected page counts.
  2. Run Verification Script: Use run_shell to execute a Python script using PyPDF2.
  3. Validate Results: Ensure the script exits successfully and reports the correct page counts.
  4. Remediate: If verification fails, inspect the generation logic and regenerate.

Verification Script

Use the following Python snippet with run_shell to verify PDFs. Adjust the expected_pages dictionary to match your task requirements.

import sys
from PyPDF2 import PdfReader

def verify_pdfs(files):
    """
    files: dict mapping filepath to expected_page_count (or None if any count is ok)
    """
    all_valid = True
    for path, expected_count in files.items():
        try:
            reader = PdfReader(path)
            actual_count = len(reader.pages)
            
            if expected_count is not None and actual_count != expected_count:
                print(f"FAIL: {path} has {actual_count} pages, expected {expected_count}")
                all_valid = False
            else:
                print(f"OK: {path} has {actual_count} pages")
                
        except Exception as e:
            print(f"ERROR: Cannot read {path} - {str(e)}")
            all_valid = False
            
    return 0 if all_valid else 1

# Example usage - modify this map for your specific task
files_to_check = {
    "output/listing.pdf": 2,
    "output/map.pdf": 1
}

sys.exit(verify_pdfs(files_to_check))

Integration Example

When using run_shell, pass the script as a heredoc or save it temporarily:

python3 -c "
import sys
from PyPDF2 import PdfReader
# ... insert logic here ...
"

Rules

  • Always Verify: Never assume a PDF generation tool succeeded without checking the output file.
  • Check Integrity: Successfully opening the file confirms it is not corrupted/empty.
  • Check Counts: Page count mismatches often indicate formatting errors or missing content.
  • Fail Fast: If verification fails, attempt to fix the generation code immediately rather than proceeding.

Dependencies

Ensure PyPDF2 is available in the environment. If not, install it first:

pip install PyPDF2
자주 묻는 질문

확인에는 무엇을 나열해야 하나요?

각 파일의 경로와 예상 쪽수입니다.

확인에 실패하면 어떻게 하나요?

가이드는 생성 로직을 점검하고 파일을 다시 만들라고 말합니다.

쪽수를 비워 둘 수 있나요?

네, 쪽수가 설정되지 않으면 스크립트는 어떤 쪽수든 받아들입니다.

상세 정보

작성자의 원본 설명

Verify generated PDFs for integrity and page count using PyPDF2 before task completion.

repo: HKUDS/AgentPilot

인기도

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

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬