用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/HKUDS/OpenSpace --skill pdf-verification-check-112b09命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Incremental audio production with duration mismatch handling, adaptive stem extension, and pre-mix alignment verification
Audio production with diagnostic analysis, timecode parsing from documents, and verified export workflow
Incremental audio production with duration alignment handling, per-stem verification, and adaptive extension strategies
基于 SOC 职业分类
正在显示 SKILL.md
| name | pdf-verification-check-112b09 |
| description | Verify generated PDF files using PyPDF2 to check page counts and integrity |
After generating PDF files, always programmatically verify their structure and integrity before declaring task completion. This catches formatting errors, incorrect page counts, and corrupted files early.
Use this skill whenever your task involves:
pip install PyPDF2
Create a verification script or run inline Python:
from PyPDF2 import PdfReader
import os
def verify_pdf(pdf_path, expected_pages=None):
"""Verify PDF file exists, is readable, and has expected page count."""
try:
# Check file exists
if not os.path.exists(pdf_path):
return False, f"File not found: {pdf_path}"
# Check file size (non-empty)
file_size = os.path.getsize(pdf_path)
if file_size == 0:
return False, f"Empty file: {pdf_path}"
# Open and verify PDF structure
reader = PdfReader(pdf_path)
actual_pages = len(reader.pages)
# Check page count if expected
if expected_pages is not None and actual_pages != expected_pages:
return False, f"Expected {expected_pages} pages, got {actual_pages}"
return True, f"Valid PDF with {actual_pages} page(s)"
except Exception as e:
return False, f"PDF verification failed: {str(e)}"
# Example usage
pdf_files = [
("listings.pdf", 2),
("map.pdf", 1),
]
all_valid = True
for pdf_path, expected in pdf_files:
valid, message = verify_pdf(pdf_path, expected)
print(f"{pdf_path}: {'✓' if valid else '✗'} {message}")
if not valid:
all_valid = False
if not all_valid:
raise Exception("PDF verification failed - review and regenerate")
Execute the verification using run_shell:
python -c "
from PyPDF2 import PdfReader
import sys
pdf_path = 'output.pdf'
expected = 2
try:
reader = PdfReader(pdf_path)
actual = len(reader.pages)
if actual != expected:
print(f'ERROR: Expected {expected} pages, got {actual}')
sys.exit(1)
print(f'OK: {pdf_path} has {actual} page(s)')
except Exception as e:
print(f'ERROR: {e}')
sys.exit(1)
"
Critical: Only mark your task as complete after ALL PDF verification checks pass. If verification fails:
# 1. Generate PDF
generate_pdf("listings.pdf", content)
# 2. Verify before completion
valid, msg = verify_pdf("listings.pdf", expected_pages=2)
if not valid:
# Fix and regenerate
regenerate_pdf("listings.pdf", corrected_content)
valid, msg = verify_pdf("listings.pdf", expected_pages=2)
# 3. Only complete if verification passes
assert valid, f"Cannot complete: {msg}"