MCPInstall

document-chat-interface

Build chat interfaces for querying documents using natural language. Extract information from PDFs, GitHub repositories, emails, and other sources. Use when creating interactive document Q&A systems, knowledge base chatbots, email search interfaces, or document exploration tools.

Installs
146
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/qodex-ai/ai-agent-skills --skill document-chat-interface
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads document-chat-interface automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Document Chat Interface

Build intelligent chat interfaces that allow users to query and interact with documents using natural language, transforming static documents into interactive knowledge sources.

Overview

A document chat interface combines three capabilities:

  1. Document Processing - Extract and prepare documents
  2. Semantic Understanding - Understand questions and find relevant content
  3. Conversational Interface - Maintain context and provide natural responses

Common Applications

  • PDF Q&A: Answer questions about research papers, reports, books
  • Email Search: Find information in email archives conversationally
  • GitHub Explorer: Ask questions about code repositories
  • Knowledge Base: Interactive access to company documentation
  • Contract Review: Query legal documents with natural language
  • Research Assistant: Explore academic papers interactively

Architecture

Document Source
    ↓
Document Processor
    ├→ Extract text
    ├→ Process content
    └→ Generate embeddings
    ↓
Vector Database
    ↓
Chat Interface ← User Question
    ├→ Retrieve relevant content
    ├→ Maintain conversation history
    └→ Generate response

Core Components

1. Document Sources

See examples/document_processors.py for implementations:

PDF Documents

  • Extract text from PDF pages
  • Preserve document structure and metadata
  • Handle scanned PDFs with OCR (pytesseract)
  • Extract tables (pdfplumber)

GitHub Repositories

  • Extract code files from repositories
  • Parse repository structure
  • Process multiple file types

Email Archives

  • Extract email metadata (from, to, subject, date)
  • Parse email body content
  • Handle multiple mailbox formats

Web Pages

  • Extract page text and structure
  • Preserve heading hierarchy
  • Extract links and navigation

YouTube/Audio

  • Get transcripts from YouTube videos
  • Transcribe audio files
  • Handle multiple formats

2. Document Processing

See examples/text_processor.py for implementations:

Text Extraction & Cleaning

  • Remove extra whitespace and special characters
  • Smart text chunking with overlap
  • Intelligent sentence boundary detection

Metadata Extraction

  • Extract title, author, date, language
  • Calculate word count and document statistics
  • Track document source and format

Structure Preservation

  • Keep heading hierarchy in chunks
  • Preserve section context
  • Enable hierarchical retrieval

3. Chat Interface Design

See examples/conversation_manager.py for implementations:

Conversation Management

  • Maintain conversation history with size limits
  • Track message metadata (timestamps, roles)
  • Provide context for LLM integration
  • Clear history as needed

Question Refinement

  • Expand implicit references in questions
  • Handle pronouns and context references
  • Improve question clarity with previous context

Response Generation

  • Use document context for answering
  • Maintain conversation history in prompts
  • Provide source citations
  • Handle out-of-scope questions

4. User Experience Features

Citation & Sources

def format_response_with_citations(response: str, sources: List[Dict]) -> str:
    """Add source citations to response"""

    formatted = response + "\n\n**Sources:**\n"
    for i, source in enumerate(sources, 1):
        formatted += f"[{i}] Page {source['page']} of {source['source']}\n"
        if 'excerpt' in source:
            formatted += f"    \"{source['excerpt'][:100]}...\"\n"

    return formatted

Clarifying Questions

def generate_follow_up_questions(context: str, response: str) -> List[str]:
    """Suggest follow-up questions to user"""

    prompt = f"""
    Based on this Q&A, generate 3 relevant follow-up questions:
    Context: {context[:500]}
    Response: {response[:500]}
    """

    follow_ups = llm.generate(prompt)
    return follow_ups

Error Handling

def handle_query_failure(question: str, error: Exception) -> str:
    """Handle when no relevant documents found"""

    if isinstance(error, NoRelevantDocuments):
        return (
            "I couldn't find information about that in the documents. "
            "Try asking about different topics like: "
            + ", ".join(get_main_topics())
        )
    elif isinstance(error, ContextTooLarge):
        return (
            "The answer requires too much context. "
            "Can you be more specific about what you'd like to know?"
        )
    else:
        return f"I encountered an issue: {str(error)[:100]}"

Implementation Frameworks

Using LangChain

from langchain.document_loaders import PDFLoader
from langchain.text_splitter import CharacterTextSplitter
from langchain.embeddings import OpenAIEmbeddings
from langchain.vectorstores import Chroma
from langchain.chat_models import ChatOpenAI
from langchain.chains import ConversationalRetrievalChain

# Load document
loader = PDFLoader("document.pdf")
documents = loader.load()

# Split into chunks
splitter = CharacterTextSplitter(chunk_size=1000)
chunks = splitter.split_documents(documents)

# Create embeddings
embeddings = OpenAIEmbeddings()
vectorstore = Chroma.from_documents(chunks, embeddings)

# Create chat chain
llm = ChatOpenAI(model="gpt-4")
qa = ConversationalRetrievalChain.from_llm(
    llm=llm,
    retriever=vectorstore.as_retriever(),
    return_source_documents=True
)

# Chat interface
chat_history = []
while True:
    question = input("You: ")
    result = qa({"question": question, "chat_history": chat_history})
    print(f"Assistant: {result['answer']}")
    chat_history.append((question, result['answer']))

Using LlamaIndex

from llama_index import GPTVectorStoreIndex, SimpleDirectoryReader, ChatMemoryBuffer
from llama_index.llms import ChatMessage, MessageRole

# Load documents
documents = SimpleDirectoryReader("./docs").load_data()

# Create index
index = GPTVectorStoreIndex.from_documents(documents)

# Create chat engine with memory
chat_engine = index.as_chat_engine(
    memory=ChatMemoryBuffer.from_defaults(token_limit=3900),
    llm="gpt-4"
)

# Chat loop
while True:
    question = input("You: ")
    response = chat_engine.chat(question)
    print(f"Assistant: {response}")

Using RAG-Based Approach

from sentence_transformers import SentenceTransformer
import faiss
import numpy as np

# Load and embed documents
model = SentenceTransformer('all-MiniLM-L6-v2')
documents = load_documents("document.pdf")
embeddings = model.encode(documents)

# Create FAISS index
dimension = embeddings.shape[1]
index = faiss.IndexFlatL2(dimension)
index.add(np.array(embeddings).astype('float32'))

# Chat function
def chat(question):
    # Embed question
    q_embedding = model.encode(question)

    # Retrieve documents
    k = 5
    distances, indices = index.search(
        np.array([q_embedding]).astype('float32'), k
    )

    # Get relevant documents
    context = " ".join([documents[i] for i in indices[0]])

    # Generate response
    response = llm.generate(
        f"Context: {context}\nQuestion: {question}\nAnswer:"
    )
    return response

Best Practices

Document Handling

  • ✓ Support multiple formats (PDF, TXT, docx, etc.)
  • ✓ Handle large documents efficiently
  • ✓ Preserve document structure
  • ✓ Extract metadata
  • ✓ Handle multiple languages
  • ✓ Implement OCR for scanned PDFs

Conversation Quality

  • ✓ Maintain conversation context
  • ✓ Ask clarifying questions
  • ✓ Cite sources
  • ✓ Handle ambiguity
  • ✓ Suggest follow-up questions
  • ✓ Handle out-of-scope questions

Performance

  • ✓ Optimize retrieval speed
  • ✓ Implement caching
  • ✓ Handle large document sets
  • ✓ Batch process documents
  • ✓ Monitor latency
  • ✓ Implement pagination

User Experience

  • ✓ Clear response formatting
  • ✓ Ability to cite sources
  • ✓ Document browser/explorer
  • ✓ Search suggestions
  • ✓ Query history
  • ✓ Export conversations

Common Challenges & Solutions

Challenge: Irrelevant Answers

Solutions:

  • Improve retrieval (more context, better embeddings)
  • Validate answer against context
  • Ask clarifying questions
  • Implement confidence scoring
  • Use hybrid search

Challenge: Lost Context Across Turns

Solutions:

  • Maintain conversation memory
  • Update retrieval based on history
  • Summarize long conversations
  • Re-weight previous queries

Challenge: Handling Long Documents

Solutions:

  • Hierarchical chunking
  • Summarize first
  • Question refinement
  • Multi-hop retrieval
  • Document navigation

Challenge: Limited Context Window

Solutions:

  • Compress retrieved context
  • Use document summarization
  • Hierarchical retrieval
  • Focus on most relevant sections
  • Iterative refinement

Advanced Features

Multi-Document Analysis

def compare_documents(question: str, documents: List[str]):
    """Analyze and compare across multiple documents"""
    results = []

    for doc in documents:
        response = query_document(doc, question)
        results.append({
            "document": doc.name,
            "answer": response
        })

    # Compare and synthesize
    comparison = llm.generate(
        f"Compare these answers: {results}"
    )
    return comparison

Interactive Document Exploration

class DocumentExplorer:
    def __init__(self, documents):
        self.documents = documents

    def browse_by_topic(self, topic):
        """Find documents by topic"""
        pass

    def get_related_documents(self, doc_id):
        """Find similar documents"""
        pass

    def get_key_terms(self, document):
        """Extract key terms and concepts"""
        pass

Resources

Document Processing Libraries

  • PyPDF: PDF handling
  • python-docx: Word document handling
  • BeautifulSoup: Web scraping
  • youtube-transcript-api: YouTube transcripts

Chat Frameworks

  • LangChain: Comprehensive framework
  • LlamaIndex: Document-focused
  • RAG libraries: Vector DB integration

Implementation Checklist

  • Choose document source(s) to support
  • Implement document loading and processing
  • Set up vector database/embeddings
  • Build chat interface
  • Implement conversation management
  • Add source citation
  • Handle edge cases (large docs, OCR, etc.)
  • Implement error handling
  • Add performance monitoring
  • Test with real documents
  • Deploy and monitor

Getting Started

  1. Start Simple: Single PDF, basic chat
  2. Add Features: Multi-document, conversation history
  3. Improve Quality: Better chunking, retrieval
  4. Scale: Support more formats, larger documents
  5. Polish: UX improvements, error handling

FAQ

What does the document-chat-interface skill do?

Build chat interfaces for querying documents using natural language. Extract information from PDFs, GitHub repositories, emails, and other sources. Use when creating interactive document Q&A systems, knowledge base chatbots, email search interfaces, or document exploration tools.

How do I install document-chat-interface?

Run npx skills add https://github.com/qodex-ai/ai-agent-skills --skill document-chat-interface in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/document-chat-interface/ (personal) or .claude/skills/document-chat-interface/ (project).

Which AI agents can use document-chat-interface?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is document-chat-interface safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains document-chat-interface?

It is published by qodex-ai in qodex-ai/ai-agent-skills. It has 146 recorded installs.

More from qodex-ai/ai-agent-skills

View all →

word-document-processor

qodex-ai/ai-agent-skills

Comprehensive word document processing with full format support. Handles creation, editing, formatting preservation, tracked changes, and metadata management.

Docs & Writing3.6K installs

multi-agent-orchestration

qodex-ai/ai-agent-skills

Design and coordinate multi-agent systems where specialized agents work together to solve complex problems. Covers agent communication, task delegation, workflow orchestration, and result aggregation. Use when building coordinated agent teams, complex workflows, or systems requiring specialized expertise across domains.

AI & Agents2.1K installs

financial-analysis-agent

qodex-ai/ai-agent-skills

Create agents for financial analysis, investment research, and portfolio management. Covers financial data processing, risk analysis, and recommendation generation. Use when building investment analysis tools, robo-advisors, portfolio trackers, or financial intelligence systems.

Business & Finance1.3K installs

legal-document-analyzer

qodex-ai/ai-agent-skills

Build agents for legal document analysis, contract review, and compliance checking. Handles document parsing, risk identification, and legal research. Use when creating contract analysis tools, legal research assistants, compliance checkers, or document review systems.

Business & Finance1.2K installs

ecommerce-platform-specialist

qodex-ai/ai-agent-skills

Provide expert guidance on Shopify e-commerce platform. Advises on store setup, products, customization, and optimization.

Business & Finance657 installs

spreadsheet-processor

qodex-ai/ai-agent-skills

Process and manipulate spreadsheet documents. Creates, edits, analyzes, and transforms Excel files with formula and formatting support.

Data & Databases620 installs

Popular ai & agents skills

View category →

google-agents-cli-publish

google/agents-cli

This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).

AI & Agents513.9K installs

google-agents-cli-eval

google/agents-cli

This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).

AI & Agents513.5K installs

skill-creator

anthropics/skills

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

OfficialAI & Agents416.4K installs

codex-pet

prime-skills/runcomfy-agent-skills

Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.

AI & Agents402.1K installs

full-output-enforcement

leonxlnx/taste-skill

Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.

AI & Agents401K installs

executing-plans

obra/superpowers

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

AI & Agents245.7K installs