feat: add new skills for context7-docs, cron-scheduling, excel-operations, hook-management, mcp-integration, notebook-edit, pdf-processing, and security-best-practices
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
---
|
||||
name: pdf-processing
|
||||
description: Read, extract, and manipulate PDF documents
|
||||
---
|
||||
|
||||
## When to use
|
||||
Use when the user asks to:
|
||||
- Extract text from PDF files
|
||||
- Read PDF content (full or specific pages)
|
||||
- Split or merge PDF documents
|
||||
- Extract metadata (title, author, page count)
|
||||
- Search within PDFs
|
||||
|
||||
## Workflow
|
||||
|
||||
### 1. Identify the PDF file
|
||||
Locate the PDF file path. Use `glob` or `ls` if needed.
|
||||
|
||||
### 2. Extract text (full or partial)
|
||||
|
||||
OpenClaw's `read` tool does not directly support PDF. You need to convert PDF to text first:
|
||||
|
||||
```bash
|
||||
# Convert PDF to text using pdftotext (if available)
|
||||
exec pdftotext path/to/file.pdf -
|
||||
|
||||
# Or use Python
|
||||
python -c "
|
||||
import pypdf;
|
||||
reader = pypdf.PdfReader('file.pdf');
|
||||
print('\n'.join([page.extract_text() for page in reader.pages]))
|
||||
"
|
||||
```
|
||||
|
||||
Then capture the output for processing.
|
||||
|
||||
### 3. Parse and structure content
|
||||
- If extracting form data, organize into key-value pairs
|
||||
- If extracting tables, preserve structure (CSV/markdown table)
|
||||
- If searching, return matching snippets with page numbers
|
||||
|
||||
### 4. For advanced operations
|
||||
- **Split PDF**: Use appropriate tool to split into separate files
|
||||
- **Merge PDFs**: Combine multiple PDFs in order
|
||||
- **Metadata**: Extract or modify PDF metadata
|
||||
|
||||
## Tool Requirements
|
||||
This skill assumes the following tools are available:
|
||||
- `exec` (to run conversion commands: pdftotext, python, etc.)
|
||||
- `read` (for text files after conversion)
|
||||
- `write`/`edit` (for saving extracted content)
|
||||
- Optional: `poppler-utils` package (pdftotext) or `pypdf` Python library
|
||||
|
||||
## Examples
|
||||
|
||||
<Good>
|
||||
User: "Lấy nội dung invoice.pdf"
|
||||
Assistant:
|
||||
1. Xác định đường dẫn file
|
||||
2. Dùng read để extract text
|
||||
3. Trích xuất thông tin quan trọng (số hóa đơn, ngày, tổng tiền)
|
||||
4. Trả về dữ liệu có cấu trúc
|
||||
</Good>
|
||||
|
||||
<Bad>
|
||||
Chỉ nói "Tôi đọc được nội dung PDF" mà không trích xuất thông tin cụ thể.
|
||||
</Bad>
|
||||
|
||||
## Limitations
|
||||
- Large PDFs (>100 pages) may be truncated — check tool limits
|
||||
- Scanned PDFs require OCR — ensure OCR tool is available
|
||||
- Password-protected PDFs need password first
|
||||
|
||||
## Verification Checklist
|
||||
- [ ] PDF file exists and is accessible
|
||||
- [ ] Extracted text is complete (no truncation)
|
||||
- [ ] Structured data is accurate
|
||||
- [ ] Page numbers/references are correct if cited
|
||||
- [ ] For tables, formatting is preserved
|
||||
Reference in New Issue
Block a user