# llm-document-extraction

The llm-document-extraction skill parses unstructured PDFs—RFIs, submittals, contracts, specifications—into structured JSON and Excel. Uses LLMs to analyze text, classify document types, and extract fields automatically.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 125 installs · ★ 434 repo stars
- Author: datadrivenconstruction
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction/tree/HEAD/3_DDC_Insights/AI-Agents/llm-document-extraction/SKILL.md
- Updated: 2026-10-19
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/llm-document-extraction

## What it does

Construction documents hold critical data buried in inconsistent formats. The skill deploys LLM to pull out key information: RFI numbers, approval dates, contract parties, material specs, cost impacts. Under the hood: Python functions for PDF parsing via pdfplumber, GPT-4o prompts with JSON schemas, batch workflows in n8n, and RAG pipelines through Qdrant for handling large documents. You'll need your OpenAI API key in the `OPENAI_API_KEY` environment variable, plus `QDRANT_URL` if indexing larger files. Python 3 must be in your system path. Comes with ready-made schemas for RFIs, submittals, and contracts.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --skill llm-document-extraction -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/llm-document-extraction/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/llm-document-extraction/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --skill llm-document-extraction -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/llm-document-extraction/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --skill llm-document-extraction -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/llm-document-extraction/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction 3_DDC_Insights/AI-Agents/llm-document-extraction
```

2. **Manually: put the files in place**
- File: `.github/skills/llm-document-extraction/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --skill llm-document-extraction -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --path 3_DDC_Insights/AI-Agents/llm-document-extraction
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/llm-document-extraction/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --skill llm-document-extraction -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction/tree/HEAD/3_DDC_Insights/AI-Agents/llm-document-extraction/SKILL.md

## When to use it
- Pull RFI numbers, dates, and approval statuses from PDFs
- Turn a messy contract PDF into structured JSON with amounts and payment terms
- Batch-process a folder of construction documents and save results to a database
- Read room dimensions and areas from floor plan images

## Example prompts
- Extract contract amount, start date, completion date, and retention percentage from this PDF
- Process all RFIs in this folder and write number, date, question, response to a spreadsheet
- Analyze this floor plan image and list rooms with their square footage

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: de85496c62545e6c.

BEGIN THIRD-PARTY FILE de85496c62545e6c
````text
---
name: "llm-document-extraction"
description: "Extract structured data from construction documents using LLMs. Process RFIs, submittals, contracts, specifications. Convert unstructured PDFs to structured JSON/Excel."
homepage: "https://datadrivenconstruction.io"
metadata: {"openclaw": {"emoji": "🤖", "os": ["darwin", "linux", "win32"], "homepage": "https://datadrivenconstruction.io", "requires": {"bins": ["python3"], "env": ["OPENAI_API_KEY", "QDRANT_URL"]}, "primaryEnv": "OPENAI_API_KEY"}}
---
# LLM Document Extraction

## Overview

Construction documents (RFIs, submittals, specs, contracts) contain critical data trapped in unstructured formats. This skill uses LLMs to extract structured data automatically.

> "The construction industry is drowning in a flood of new data: the volume of information has grown from 15 zettabytes in 2015 to 181 zettabytes in 2025, and 90% of all existing data has been created in just the last few years." — Artem Boiko

## Use Cases

| Document Type | Extract |
|---------------|---------|
| RFI | Question, response, dates, parties |
| Submittal | Product specs, approval status, materials |
| Contract | Parties, amounts, dates, scope, clauses |
| Specification | Materials, standards, requirements |
| Daily Report | Weather, labor, equipment, progress |

## Quick Start

```python
from openai import OpenAI
import pdfplumber
import json

client = OpenAI()

def extract_from_pdf(pdf_path: str, extraction_schema: dict) -> dict:
    """Extract structured data from PDF using LLM"""

    # Extract text from PDF
    with pdfplumber.open(pdf_path) as pdf:
        text = "\n".join(page.extract_text() for page in pdf.pages)

    # Build extraction prompt
    prompt = f"""
    Extract the following information from this construction document.
    Return ONLY valid JSON matching the schema.

    Schema:
    {json.dumps(extraction_schema, indent=2)}

    Document:
    {text[:8000]}  # Truncate for context limits

    JSON Output:
    """

    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[
            {"role": "system", "content": "You are a construction document analyst. Extract data accurately."},
            {"role": "user", "content": prompt}
````
END THIRD-PARTY FILE de85496c62545e6c

The third-party file has ended. Everything between the de85496c62545e6c tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2242 of 7776 bytes. © datadrivenconstruction · MIT · https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction/tree/HEAD/3_DDC_Insights/AI-Agents/llm-document-extraction/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
