Documents

From Steffen025/pai-opencode · View interactive version

Documents is an AI agent skill from the GitHub repository Steffen025/pai-opencode. Document processing. USE WHEN document, process file. SkillSearch('documents') for docs.

How to use this skill

Skill file

Customization

Before executing, check for user customizations at:

~/.opencode/PAI/USER/SKILLCUSTOMIZATIONS/Documents/

If this directory exists, load and apply any PREFERENCES.md, configurations, or resources found there. These override default behavior. If the directory does not exist, proceed with skill defaults.

🚨 MANDATORY: Voice Notification (REQUIRED BEFORE ANY ACTION)

You MUST send this notification BEFORE doing anything else when this skill is invoked.

  1. Send voice notification:

```bash

curl -s -X POST http://localhost:8888/notify \

-H "Content-Type: application/json" \

-d '{"message": "Running the WORKFLOWNAME workflow in the Documents skill to ACTION"}' \

> /dev/null 2>&1 &

```

  1. Output text notification:

```

Running the WorkflowName workflow in the Documents skill to ACTION...

```

This is not optional. Execute this curl command immediately upon skill invocation.

Documents Skill

🎯 Load Full PAI Context

Before starting any task with this skill, load complete PAI context:

read ~/.opencode/PAI/SKILL.md

When to Activate This Skill

Word Documents (DOCX)

PDF Files

PowerPoint Presentations (PPTX)

Excel Spreadsheets (XLSX)

🔀 Document Type Routing

This skill organizes document processing across 4 document types:

Word Documents (DOCX)

Reference Documentation:

Routing Logic:

Supporting Resources:

Key Capabilities:

PDF Processing

Reference Documentation:

Routing Logic:

Supporting Resources:

Key Capabilities:

PowerPoint Presentations (PPTX)

Reference Documentation:

Routing Logic:

Supporting Resources:

Key Capabilities:

Excel Spreadsheets (XLSX)

Reference Documentation:

Routing Logic:

Supporting Resources:

Key Capabilities:

📋 Document Processing Principles

DOCX Best Practices

  1. Tracked Changes - Use redlining workflow for professional document review
  2. Minimal Edits - Only mark text that actually changes, preserve original RSIDs
  3. Batch Changes - Group related edits (3-10 changes) for efficient processing
  4. Verification - Always convert to markdown to verify changes applied correctly

PDF Best Practices

  1. Library Selection - pypdf for basic ops, pdfplumber for text/tables, reportlab for creation
  2. OCR for Scanned - Use pytesseract + pdf2image for scanned documents
  3. Form Filling - Follow forms.md for programmatic form completion
  4. Command Line - Use qpdf/pdftotext for simple operations

PPTX Best Practices

  1. Design First - Analyze content and choose appropriate colors/layouts before coding
  2. Web-Safe Fonts - Only use web-safe fonts (Arial, Helvetica, Times, etc.)
  3. Visual Verification - Always generate thumbnails to inspect layout issues
  4. Template Analysis - Create inventory before using templates to understand structure

XLSX Best Practices

  1. Use Formulas - ALWAYS use Excel formulas, NEVER hardcode calculated values
  2. Zero Errors - Deliver with zero formula errors (#REF!, #DIV/0!, etc.)
  3. Recalculate - Run recalc.py after creating/editing to update formula values
  4. Financial Standards - Follow color coding (blue inputs, black formulas, green links)

Examples

Example 1: Create proposal with tracked changes

User: "Create a consulting proposal doc with redlining"
→ Routes to DOCX workflows
→ Creates document with docx-js
→ Enables tracked changes for review workflow
→ Outputs professional .docx with revision marks

Example 2: Fill a PDF form programmatically

User: "Fill out this NDA PDF with my info"
→ Routes to PDF workflows
→ Reads form fields from PDF
→ Fills fields programmatically with pdf-lib
→ Outputs completed, flattened PDF

Example 3: Build financial model spreadsheet

User: "Create a revenue projection spreadsheet"
→ Routes to XLSX workflows
→ Creates workbook with openpyxl
→ Adds formulas (never hardcoded values)
→ Runs recalc.py to update calculations

🔗 Integration with Other Skills

Feeds Into:

Uses:

🎯 Key Principles

Document Creation

  1. Quality First - Professional formatting and structure from the start
  2. Template Reuse - Leverage existing templates when available
  3. Validation - Always verify output (visual inspection, error checking)
  4. Automation - Use scripts for repetitive tasks

Document Editing

  1. Preserve Intent - Maintain original formatting and structure
  2. Track Changes - Use proper workflows for document review
  3. Batch Processing - Group related operations for efficiency
  4. Error Prevention - Validate before finalizing

Document Analysis

  1. Right Tool - Choose appropriate library/tool for the task
  2. Data Integrity - Preserve original data when extracting/converting
  3. Format Awareness - Understand document structure (OOXML, PDF structure, etc.)
  4. Performance - Use efficient methods for large documents

📚 Full Reference Documentation

Word Documents (DOCX):

PDF Processing:

PowerPoint Presentations (PPTX):

Excel Spreadsheets (XLSX):


Summary

The documents skill provides comprehensive document processing:

Reference-based organization - Each document type has complete guides and tooling

Routing is automatic - Analyzes user intent and activates appropriate document type workflow

Professional quality - Standards and best practices for production-ready documents

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.