pypdf-1-memory-management
БесплатноБез исполняемых скриптовНе проверенSub-skill of pypdf: 1. Memory Management (+2).
от vamseeachanta★ 21 звезда на GitHubОб этом скилле
1. Memory Management (+2)
1. Memory Management
"""Best practices for handling large PDFs."""
# DO: Process pages one at a time for large files
def process_large_pdf(input_path, output_path):
reader = PdfReader(input_path)
writer = PdfWriter()
for page in reader.pages:
# Process page
writer.add_page(page)
# Writer streams to file, not memory
writer.write(output_path)
# DO: Use context managers when available
with open('document.pdf', 'rb') as f:
reader = PdfReader(f)
# Process...
2. Error Handling
"""Robust error handling for PDF operations."""
from pypdf.errors import PdfReadError, PdfReadWarning
def safe_read_pdf(pdf_path):
"""Safely read PDF with error handling."""
try:
reader = PdfReader(pdf_path)
return reader, None
except PdfReadError as e:
return None, f"Invalid PDF: {e}"
except FileNotFoundError:
return None, f"File not found: {pdf_path}"
except PermissionError:
return None, f"Permission denied: {pdf_path}"
except Exception as e:
return None, f"Unexpected error: {e}"
3. Validation
"""Validate PDF files before processing."""
def validate_pdf(pdf_path):
"""Validate PDF file."""
path = Path(pdf_path)
if not path.exists():
return False, "File does not exist"
if path.suffix.lower() != '.pdf':
return False, "Not a PDF file"
try:
reader = PdfReader(pdf_path)
_ = len(reader.pages) # Try to access pages
return True, "Valid PDF"
except Exception as e:
return False, f"Invalid PDF: {e}"
Установить pypdf-1-memory-management в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл pypdf-1-memory-management?
Sub-skill of pypdf: 1. Memory Management (+2).
Как установить скилл pypdf-1-memory-management?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pypdf-1-memory-management запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic