Document processing

From Luohaothu/everything-codex · View interactive version

Document processing is an AI agent skill from the GitHub repository Luohaothu/everything-codex. Turn unstructured documents into validated, auditable structured data with clear schemas and edge-case handling

How to use this skill

Skill file

Document Processing

Use this skill when you need to turn unstructured or semi-structured documents (PDFs, scans, images, HTML, emails, DOCX) into structured outputs (JSON/CSV) with validation, provenance, and clear error handling.

First Questions (Fail Fast)

Before proposing an approach, clarify:

If any of these are unknown, state assumptions explicitly and propose options.

Output Contract (Recommended)

Prefer an explicit schema and provenance so consumers can trust the results.

Suggested JSON shape

{
  "document_id": "string",
  "document_type": "string",
  "source": {
    "filename": "string",
    "page_count": 12
  },
  "extracted": {
    "fields": {
      "vendor_name": "string",
      "invoice_number": "string",
      "total_amount": 123.45,
      "currency": "USD"
    },
    "tables": [
      {
        "name": "line_items",
        "rows": [
          { "description": "string", "quantity": 1, "unit_price": 1.23, "amount": 1.23 }
        ]
      }
    ]
  },
  "provenance": [
    {
      "path": "extracted.fields.total_amount",
      "evidence": "snippet or normalized text",
      "location": { "page": 2, "bbox": [0, 0, 0, 0] },
      "confidence": 0.92
    }
  ],
  "validation": {
    "status": "pass",
    "errors": []
  }
}

Rules:

Workflow

  1. Define the extraction schema: required fields, types, enums, and table shapes.
  2. Segment the document: pages/sections; detect headers/footers; isolate tables.
  3. Parse/OCR:
  1. Extract:
  1. Validate:
  1. Quality gates:
  1. Export:

Edge Cases Checklist

Handle explicitly:

Security & Privacy

Related Skills

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.