# rag-construction

rag-construction builds construction-focused RAG systems for project documents and reports. Helps configure semantic retrieval over technical paperwork in Python.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 123 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/2_DDC_Book/2.3-Pandas-LLM-Analysis/rag-construction/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/rag-construction

## What it does

The skill implements Retrieval-Augmented Generation for construction knowledge bases using the DDC methodology. It organizes technical documentation for semantic search and question answering with LLMs. The schema identifies document types like specifications, contracts, drawings, RFIs, change orders, and daily inspection reports.

Text processing is handled by `TextChunker`, which splits documents into fragments. It supports chunking by fixed character length with overlap (configured for 500 characters and 50 characters overlap), by paragraphs, or by section headers like `SECTION` or `ARTICLE`.

The skill explicitly requires `python3` in the operating system environment.

## Install

### Claude Code (native platform)

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

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

### Codex

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

2. **Manually: put the files in place**
- File: `.agents/skills/rag-construction/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 rag-construction -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/rag-construction/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 2_DDC_Book/2.3-Pandas-LLM-Analysis/rag-construction
```

2. **Manually: put the files in place**
- File: `.github/skills/rag-construction/SKILL.md`

### Gemini CLI

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

2. **Platform CLI**
```bash
gemini skills install https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --path 2_DDC_Book/2.3-Pandas-LLM-Analysis/rag-construction
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/rag-construction/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 rag-construction -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/2_DDC_Book/2.3-Pandas-LLM-Analysis/rag-construction/SKILL.md

## When to use it
- split construction contracts and specs into chunks for vector embeddings
- organize semantic search across inspection logs, RFIs, and daily reports
- parse structured sections using article and header patterns
- provide retrieved context to LLMs for construction QA workflows

## Example prompts
- Split the construction specification into chunks using TextChunker
- Set up a RAG pipeline for building RFIs and inspection reports
- Chunk this contract by section with an overlap of 50 characters

## 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: eedba14ef5dcd8e1.

BEGIN THIRD-PARTY FILE eedba14ef5dcd8e1
````text
---
name: "rag-construction"
description: "Build RAG systems for construction knowledge bases. Create searchable AI-powered construction document systems"
homepage: "https://datadrivenconstruction.io"
metadata: {"openclaw": {"emoji": "🐼", "os": ["darwin", "linux", "win32"], "homepage": "https://datadrivenconstruction.io", "requires": {"bins": ["python3"]}}}
---
# RAG Construction

## Overview

Based on DDC methodology (Chapter 2.3), this skill builds Retrieval-Augmented Generation (RAG) systems for construction knowledge bases, enabling semantic search and AI-powered question answering over construction documents.

**Book Reference:** "Pandas DataFrame и LLM ChatGPT" / "Pandas DataFrame and LLM ChatGPT"

## Quick Start

```python
from dataclasses import dataclass, field
from enum import Enum
from typing import List, Dict, Optional, Any, Callable
from datetime import datetime
import json
import hashlib
import re

class DocumentType(Enum):
    """Types of construction documents"""
    SPECIFICATION = "specification"
    DRAWING = "drawing"
    CONTRACT = "contract"
    RFI = "rfi"
    SUBMITTAL = "submittal"
    CHANGE_ORDER = "change_order"
    MEETING_MINUTES = "meeting_minutes"
    DAILY_REPORT = "daily_report"
    SAFETY_REPORT = "safety_report"
    INSPECTION = "inspection"
    MANUAL = "manual"
    STANDARD = "standard"

class ChunkingStrategy(Enum):
    """Text chunking strategies"""
    FIXED_SIZE = "fixed_size"
    PARAGRAPH = "paragraph"
    SECTION = "section"
    SEMANTIC = "semantic"
    SENTENCE = "sentence"

@dataclass
class DocumentChunk:
    """A chunk of document text"""
    id: str
    document_id: str
    content: str
    metadata: Dict[str, Any]
    embedding: Optional[List[float]] = None
    token_count: int = 0
    position: int = 0

@dataclass
class Document:
    """Construction document"""
    id: str
    title: str
    doc_type: DocumentType
    content: str
    source: str
    metadata: Dict[str, Any] = field(default_factory=dict)
    chunks: List[DocumentChunk] = field(default_factory=list)
    created_at: datetime = field(default_factory=datetime.now)

@dataclass
class SearchResult:
    """Search result from vector store"""
    chunk: DocumentChunk
    score: float
    document_title: str
    doc_type: DocumentType

@dataclass
class RAGResponse:
    """Response from RAG system"""
    query: str
````
END THIRD-PARTY FILE eedba14ef5dcd8e1

The third-party file has ended. Everything between the eedba14ef5dcd8e1 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 2366 of 22739 bytes. © datadrivenconstruction · MIT · https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction/tree/HEAD/2_DDC_Book/2.3-Pandas-LLM-Analysis/rag-construction/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
